Hello,
We are trying to write our own .NET profiler and we are encountering a weird issue.
We have a PS script which loads theSystem.Windows.Forms module by doing
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
and afterwards uses an icon using
$icon = New-Object System.Drawing.Icon(...)
This scripts works successfully when our profiler is not attacked and it throws and error if our profiler is attached on the powershell .exe ("Cannot find type"System.Drawing.Icon": verify that the assembly containing this type is loaded")
By digging into that a bit, it seems that when our profiler is not installed, the .ni version of the Sytem.Windows.Form module is loaded (System.Windows.Forms.dll.ni) and this one loads the System.Drawing.dll.ini
When our profiler is loaded, the original JITTED module is loaded System.Windows.Forms.dll, and theSystem.Drawing.dll is not loaded and therefore the error is thrown.
Any idea why this happens? any lead will be helpful.
Thanks a lot!
Ghila