Groups | Blog | Home
all groups > dotnet interop > may 2006 >

dotnet interop : Can unmanged code corrupt dot net


Jrax
5/16/2006 1:07:01 PM
Hi,

If a dot net app calls unmanaged code can that unmanaged code corrupt the
dot net app. I'm thinking about a lang using pointers.

If yes, are there any good debugging techniques to catch this?

Thanx

Mattias Sjögren
5/17/2006 12:11:03 AM
[quoted text, click to view]

Unmanaged code can certainly do harm. But the end result is usually
that you get an exception or the process is terminated, both are easy
to detect. Managed Debugging Assistants (MDAs) will alert you of
certain common errors.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
cody
5/19/2006 5:54:26 PM
I think I know what he means. What is if a "wild" pointer overwrites data
which belongs to a .net object? Iam not sure wheather .NET will be able to
detect such things, how could it?

--


"Mattias Sjögren" <mattias.dont.want.spam@mvps.org> schrieb im Newsbeitrag
news:eXL88WTeGHA.564@TK2MSFTNGP02.phx.gbl...
[quoted text, click to view]

Willy Denoyette [MVP]
5/19/2006 10:06:03 PM
You are right, it can't, it's very easy to corrupt the GC heap from
unmanaged code, and there is nothing the CLR can do about it. It's even
possible to corrupt the heap from managed code, simply use unsafe constructs
and let pointers go wild when writing stuff to the heap and watch your
process die in a nice crash.


Willy.

[quoted text, click to view]
|I think I know what he means. What is if a "wild" pointer overwrites data
| which belongs to a .net object? Iam not sure wheather .NET will be able to
| detect such things, how could it?
|
| --
|
|
| "Mattias Sjögren" <mattias.dont.want.spam@mvps.org> schrieb im Newsbeitrag
| news:eXL88WTeGHA.564@TK2MSFTNGP02.phx.gbl...
| > >If a dot net app calls unmanaged code can that unmanaged code corrupt
the
| >>dot net app. I'm thinking about a lang using pointers.
| >>
| >>If yes, are there any good debugging techniques to catch this?
| >
| > Unmanaged code can certainly do harm. But the end result is usually
| > that you get an exception or the process is terminated, both are easy
| > to detect. Managed Debugging Assistants (MDAs) will alert you of
| > certain common errors.
| >
| >
| > Mattias
| >
| > --
| > Mattias Sjögren [C# MVP] mattias @ mvps.org
| > http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
| > Please reply only to the newsgroup.
|
|

AddThis Social Bookmark Button