-
June 2nd, 2010, 02:10 PM
#1
Unmanaged exceptions
Hi Gurus,
I am porting my application C# which is using several unmanaged c++ DLL's to 64 bit.
On 32 bits it' works just fine.
C++: throw
C#: catch as a SEHException
On 64 bits(Vista, 7) i have an application crash. I can't catch any of these exceptions...
Any ideas?
-
June 3rd, 2010, 02:36 AM
#2
Re: Unmanaged exceptions
You can use catch withou exception type, it should catch all exceptions including unmanaged.
Code:
try
{
....
}
catch
{
...
}
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
-
June 3rd, 2010, 05:48 AM
#3
Re: Unmanaged exceptions
I tried it without any success.
The application just crashes whenever i try to throw from unmanaged c++ DLL.
Fault module name:StackHash_579c... Not mine...
-
June 3rd, 2010, 07:00 AM
#4
Re: Unmanaged exceptions
I don't know if this will work, but try adding a handler to the UnhandledException.
Something like:
Code:
AppDomain.CurrentDomain.UnhandledException += UnhandledExceptionEventRaised;
and then make a method to catch it:
Code:
private static void UnhandledExceptionEventRaised(object sender, UnhandledExceptionEventArgs e)
{
//do stuff here
}
But I'm unsure if it will catch your exceptions.
-
June 3rd, 2010, 10:26 AM
#5
Re: Unmanaged exceptions
Can you rebuild the C++ dlls for 64-bit?
-
June 3rd, 2010, 10:51 AM
#6
Re: Unmanaged exceptions
Thanks for trying, but it doesn't help..
-
June 3rd, 2010, 04:54 PM
#7
Re: Unmanaged exceptions
The DLL's are native 64 bit
-
June 3rd, 2010, 07:54 PM
#8
Re: Unmanaged exceptions
Originally Posted by urisol
The DLL's are native 64 bit
Help clear up some confusion, please.
Are you saying that you've already rebuild the 32-bit dlls for 64-bit?
If so, how do you know they work as 64-bit? What I would do is write some C++ unit tests to debug the dlls.
Once you know they work in a 64-bit environment, then you can get them working under .Net.
-
June 4th, 2010, 02:12 AM
#9
Re: Unmanaged exceptions
What does happen if you check C++ Exceptions in Debug/Exceptions dialog and run the application under debugger. Are you able to determine the exact exception? Maybe it is rewrapped in some way or it could be a security exception because your applications lacks some permission.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post.
-
June 4th, 2010, 03:46 AM
#10
Re: Unmanaged exceptions
Yes i have already rebuilt my C++ DLL's for 64 bit and they work just fine.
Actually the whole application .NET / C++/drivers woks fine except of the unmanaged interrupts issue.
I see the crash only if i test the unmnaged interrupts flows or just call to c++ foo function from C#(PInvoke)
c++:
extern "C" XXINTERFACE_API void foo()throw(...);
void foo()
{
throw blabla;
}
I tried to make Blabla to be a native type (int) with no effect..
I will try to establish 64 bit development environment(mine is 32... cross compiler issue?), to see what happens under debug..
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|