c# writeprocessmemory

M

miketillman

I'm having an issue with WriteProcessMemory in which the application is forced to exit because of a SystemAccessViolation.

Is there any way I can prevent this from happening? I'm basically looking to have a single thread or something be forced close because of the access violation instead of the entire app. I really don't know how to explain exactly what it is I need to do other than that.

Thanks.
 
A

Arne Vajhøj

I'm having an issue with WriteProcessMemory in which the application
is forced to exit because of a SystemAccessViolation.

Is there any way I can prevent this from happening? I'm basically
looking to have a single thread or something be forced close because
of the access violation instead of the entire app. I really don't
know how to explain exactly what it is I need to do other than that.

They changed how that type of exceptions are handled in .NET 4.0.

I believe you need to:
* have a catch
* indicate that you really want to catch that type of exception

<legacyCorruptedStateExceptionsPolicy enabled="true"/>

in app.config or:

[HandleProcessCorruptedStateExceptions]

on the method.

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top