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: ironruby-core-boun...@rubyforge.org [mailto:ironruby-core-boun...@rubyforge.org] On Behalf Of Orion Edwards Sent: Wednesday, August 12, 2009 9:33 PM To: ironruby-core@rubyforge.org Subject: Re: [Ironruby-core] COM security question On Thu, Aug 13, 2009 at 4:17 PM, Tomas Matousek <tomas.matou...@microsoft.com<mailto:tomas.matou...@microsoft.com>> 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 Ironruby-core@rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core