I want to modify the behavior a .NET program I did not write. I used ILSpy to have a look at the relevant source code and found the program was using a static field to load the data I wanted to change, so I wrote a simple program to reflect onto the static field, change the value, and then launch the program.
The problem is, the change seems to be ignored by the program when it is launched! I looked around and found that static variables are only static within an AppDomain
. I suspect that's my problem. My launcher app is modifying the "static" variable fine, but the call to Process.Start
creates a new AppDomain
which makes my change irrelevant.
Any way to either:
1) Change a static variable in another AppDomain
or
2) Different approach to solve the problem?