I made a class library, COM visible, in CSharp with Visual Studio 2010.
When I try to call this method:
public string Version {
get { return Assembly.GetEntryAssembly().GetName().Version.ToString(); }
}
from VB6 client I obtain Object reference not set to an instance of an object. Other methods works properly.
From .NET client all works fine!
What’s wrong?
Thanks, Luigi.
Assembly.GetEntryAssembly()returns the assmebly that launched this .Net process (withMain())In an unmanaged process, it will return null.
To get the assembly containing your code, use
typeof(MyType).Assembly.