Accessing currently active CLRPolicy from a loaded dll

76 views Asked by At

I'm trying to access the application's CLR runtime host and change its policy via the poilcy manager.

The problem is that all the examples i've seen seem to create a new CLR runtime and start it the application with it.

I'm looking for a way to access the CLR runtime that's already running, and use SetActionOnFailure() to change its failure policies.

So, how can i do that in C# or c++/cli ?

Examples I've found (but don't seem to work on a running CLR runtime host):

Specifying Escalation Policy Using the CLR Hosting Interfaces

Surviving after StackOverflowException

1

There are 1 answers

0
Ben Voigt On BEST ANSWER

I believe the policy has to be set before any code is JITted, because it will be baked in during native code generation.