Question

A partner created a COM lib x.dll and x.tlb in C#, with .NET framework 4. He had the "Com Interop" checkbox checked in VS.

He then referred to this Register a C#/VB.NET COM dll programmatically to create a tool that registers the .dll. It worked. (Our Delphi app can access the .COM object) The code he used to register (from the above link) is:

Assembly asm = Assembly.LoadFile (@"c:\temp\x.dll");
RegistrationServices regAsm = new RegistrationServices();
bool bResult = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase);

We imported the x.tlb into Delphi 7, creating a .pas file through which we are making calls to the COM library.

In Delphi, when we call a function in the COM library, we're getting an error:

...exception class EOleException with message 'Method not found: 'Void
 System.Threading.Monitor.Enter(System.Object, Boolean ByRef)''. Process stopped. 

We have no idea what this means or how to resolve it.

Any suggestions?

Was it helpful?

Solution

When compiling the C# dll, it is targeting a .NET version prior to framework 4.

Make sure the setting in the compiler is targeting the correct platform version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top