-
-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unhandled exception 0xE0434352 #43
Comments
@jpeg729 You should use pointer to allocated string. I already gave an examples for Java & C++ here: |
You misunderstand me... I was not asking a question. My function returns a A stupid mistake, I know. So I posted it hoping that others would profit from my experience. I would have lost many fewer hours debugging this problem had there been a warning saying that a |
It exactly related to question anyway, and as a tip for other guys. Btw, I recommend to update title for clarify. In general the PInvoke-mechanism does not support complex types at all. You should use IntPtr instead of this. The
Well, I can try to write some detection of this before final generated binaries, but ... I hope that simply keeping of this in your mind will be not so hard for any type of developments :) However, if it's still is needed by someone, just create new issue about this feature-request, it will be considered later. |
I just spent HOURS debugging the following problem.
My DLL stopped working after some code changes. There was this one function call that would always cause an unhandled exception regardless of my error handling.
Do you see the error?
Note that as the entire function body is enclosed in a
try
block, and as the correspondingcatch
is nigh on empty, there doesn't seem to be any code that could cause an exception.Any ideas?
No? Then compare lines 2 and 3. According to line 2 the output is marshalled as a string pointer, but according to line 3 the output is a
bool
. It compiles beautifully, no mess, no fuss, and then it crashes horribly for a nigh on undetectable reason.I have no idea how DLLExport works, so I don't know if a warning or error would be easy to implement. In any case let this be a warning to future passers by: "Marshall only when necessary."
The text was updated successfully, but these errors were encountered: