Apparently, the [STAThread] on the Main of ir.exe is the source of the problem. It's forcing the runtime to initialize security. You'll need to use a custom host for this scenario. :(
From: [email protected] [mailto:[email protected]] On Behalf Of Orion Edwards Sent: Wednesday, August 12, 2009 9:33 PM To: [email protected] Subject: Re: [Ironruby-core] COM security question On Thu, Aug 13, 2009 at 4:17 PM, Tomas Matousek <[email protected]<mailto:[email protected]>> wrote: AssemblyResolve should only be called if you load an assembly from a path. Like require 'foo.dll'. If you use strong names for all assemblies you load the event shouldn't kick in. Besides requiring mscorlib is not necessary since it is loaded automatically. I didn't know that, that's cool Anyway: I have VirtualServerHelper.dll which contains a class as follows: public class VirtualServerHelper { public VirtualServerHelper() { CoInitializeSecurity(IntPtr.Zero, -1, IntPtr.Zero, IntPtr.Zero, (uint)RpcAuthnLevel.PktPrivacy, (uint)RpcImpLevel.Impersonate, IntPtr.Zero, (uint)EoAuthnCap.DynamicCloaking, IntPtr.Zero); } // other methods } And then I do this: D:\Dev\VirtualServerHelper> iirb irb(main):001:0> include System::Reflection => Object irb(main):002:0> Assembly.Load 'VirtualServerHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.to_clr_string => VirtualServerHelper, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null irb(main):003:0> h = VirtualServerHelper.new System::Runtime::InteropServices::COMException: Security must be initialized before any interfaces are marshalled or unmarshalled. It cannot be changed once initialized. (Exception from HRESULT: 0x80010119) Damn :-(
_______________________________________________ Ironruby-core mailing list [email protected] http://rubyforge.org/mailman/listinfo/ironruby-core
