DllImport and debug ...

  • Thread starter Thread starter Fabien Penso
  • Start date Start date
F

Fabien Penso

Hi.

I imported a .dll in my C# code and call a C function that takes a
struct of pointers of functions as callback functions. It seems to work
fine (the callbacks function wrote in my C# code are called) for this
part, but then crashes.

When it crashes Visual offers me to use a debugger, but the current
instance of visual can't be selected (only "new instance of visual C++")
and if I choose "new instance" it says another debugger is already
attached to it.

Anyone knows how to fix that ?

I have a very simple question also, how can I enter the .dll code to put
breakpoints while running the C# compiled code ?
 
I imported a .dll in my C# code and call a C function that takes a
struct of pointers of functions as callback functions. It seems to work
fine (the callbacks function wrote in my C# code are called) for this
part, but then crashes.

Do you hold references to the delegates you pass to the DLL to ensure
that they don't get garbage collected?

When it crashes Visual offers me to use a debugger, but the current
instance of visual can't be selected (only "new instance of visual C++")
and if I choose "new instance" it says another debugger is already
attached to it.

Anyone knows how to fix that ?

See if it makes a difference if you enable unmanaged debugging in the
project properties.



Mattias
 
Mattias said:
Do you hold references to the delegates you pass to the DLL to ensure
that they don't get garbage collected?

Yes I do, I now got to see where the error is, thanks to your reply !
Now I need to fix the error :)
See if it makes a difference if you enable unmanaged debugging in the
project properties.

Fixed it, thanks.
 
Back
Top