473,322 Members | 1,538 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Lazy Registration issue with Activator.CreateInstance

I have currently an issue with the following piece of code. The assembly is
to run under com+ (as Library) and the class derives from ServicedComponent.

Code: C# - .NET framework V1.1.4322

// Prepare fully qualified class name

fullyQualifiedNetClassTypeName = Namespace + "." + ClassName + ", " +
AssemblyName + ", " + "Version=" + AssemblyVersion + ", " + "Culture=" +
AssemblyCulture + ", " + "PublicKeyToken=" + PublicKeyToken;

// Create an instance of the class

netStatusType = Type.GetType(fullyQualifiedNetClassTypeName,true);
netStatusObject = Activator.CreateInstance(netStatusType);

When the blue line executes, I receive the following exception: "A first
chance exception of type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll . Additional information: File or assembly name
d:\projects\hfdm\03 - developing\01 - development\source\maincodeline\hfdm
services\dell.hfdm.processflowcontroller\bin\debug \dell.hfdm.processflowclasses.dll, or one of its dependencies, was not found."

I checked multiple times and the dll exists. If I register the assembly
manually in COM+, it works. If it uses the autoregistration process (when
Activator.CreateInstance(netStatusType)is executed) I get the exception. If I
remove EnterpriseServices specific configuration (the class does not derive
from ServicedComponent), it works.

Checking the call stack (below), I see a strange call: The Assembly.Load
method has the path of the assembly as parameter but it should be the
Assembly name. Is it a bug?

mscorlib.dll!System.Reflection.Assembly.InternalLo ad(System.Reflection.AssemblyName
assemblyRef = {System.Reflection.AssemblyName}, bool stringized = true,
System.Security.Policy.Evidence assemblySecurity = <undefined value>,
System.Threading.StackCrawlMark stackMark = LookForMyCaller) + 0x1ac bytes
mscorlib.dll!System.Reflection.Assembly.InternalLo ad(string assemblyString
= @"d:\projects\hfdm\03 - developing\01 -
development\source\maincodeline\hfdm
services\dell.hfdm.processflowcontroller\bin\debug \dell.hfdm.processflowclasses.dll",
System.Security.Policy.Evidence assemblySecurity = <undefined value>,
System.Threading.StackCrawlMark stackMark = LookForMyCaller) + 0x68 bytes

-------- THE (MAYBE) WRONG CALL -----------
mscorlib.dll!System.Reflection.Assembly.Load(strin g assemblyString =
@"d:\projects\hfdm\03 - developing\01 - development\source\maincodeline\hfdm
services\dell.hfdm.processflowcontroller\bin\debug \dell.hfdm.processflowclasses.dll") + 0x1c bytes
---------------------------------------------

system.enterpriseservices.dll!System.EnterpriseSer vices.RegistrationDriver.NewLoadAssembly(string
assembly = @"d:\projects\hfdm\03 - developing\01 -
development\source\maincodeline\hfdm
services\dell.hfdm.processflowcontroller\bin\debug \dell.hfdm.processflowclasses.dll") + 0x2d bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.RegistrationDriver.InstallAssembly(System.En terpriseServices.RegistrationConfig
regConfig = {System.EnterpriseServices.RegistrationConfig}, System.Object
obSync = {System.EnterpriseServices.CatalogSync}) + 0xcb bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.RegistrationHelperTx.InstallAssemblyFromConf ig(System.EnterpriseServices.RegistrationConfig
regConfig = {System.EnterpriseServices.RegistrationConfig}, System.Object
sync = {System.EnterpriseServices.CatalogSync}) + 0x5c bytes

mscorlib.dll!System.Runtime.Remoting.Messaging.Sta ckBuilderSink.SyncProcessMessage(System.Runtime.Re moting.Messaging.IMessage
msg = {System.Runtime.Remoting.Messaging.Message}, int methodPtr = 0, bool
fExecuteInContext = true) + 0x1a6 bytes

mscorlib.dll!System.Runtime.Remoting.RemotingServi ces.ExecuteMessage(System.MarshalByRefObject
target = {System.Runtime.Remoting.Proxies.__TransparentProx y},
System.Runtime.Remoting.Messaging.IMethodCallMessa ge reqMsg =
{System.Runtime.Remoting.Messaging.Message}) + 0xcb bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.ServicedComponentProxy.LocalInvoke(System.Ru ntime.Remoting.Messaging.IMessage
reqMsg = {System.Runtime.Remoting.Messaging.Message}) + 0x200 bytes

system.enterpriseservices.thunk.dll!System.Enterpr iseServices.Thunk.Callback.CallbackFunction( pData = 173406288) + 0xd5 bytes

system.enterpriseservices.thunk.dll!System.Enterpr iseServices.Thunk.Callback.DoCallback(System.Objec t
otp = {System.Runtime.Remoting.Proxies.__TransparentProx y},
System.Runtime.Remoting.Messaging.IMessage msg =
{System.Runtime.Remoting.Messaging.Message}, int ctx = 1339536, bool
fIsAutoDone = false, System.Reflection.MemberInfo mb =
{System.Reflection.RuntimeMethodInfo}, bool bHasGit = true) + 0x272 bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.ServicedComponentProxy.CrossCtxInvoke(System .Runtime.Remoting.Messaging.IMessage
reqMsg = {System.Runtime.Remoting.Messaging.Message}) + 0x231 bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.ServicedComponentProxy.Invoke(System.Runtime .Remoting.Messaging.IMessage
request = {System.Runtime.Remoting.Messaging.Message}) + 0x55 bytes

mscorlib.dll!System.Runtime.Remoting.Proxies.RealP roxy.PrivateInvoke(System.Runtime.Remoting.Proxies .MessageData
msgData = {System.Runtime.Remoting.Proxies.MessageData}, int type = 1) +
0x42a bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.RegistrationHelper.TryTransactedInstall(Syst em.EnterpriseServices.RegistrationConfig
regConfig = {System.EnterpriseServices.RegistrationConfig}) + 0x114 bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.RegistrationHelper.InstallAssemblyFromConfig (System.EnterpriseServices.RegistrationConfig
regConfig = {System.EnterpriseServices.RegistrationConfig}) + 0x122 bytes

system.enterpriseservices.dll!System.EnterpriseSer vices.RegistrationThreadWrapper.InstallThread() + 0x46 bytes

--
Stephane Dattenny

Jul 21 '05 #1
0 1991

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: David Sworder | last post by:
Hi, I need to design a method that creates and returns a large array of objects. The problem is that the *type* of object to create isn't know until runtime. As a result, a parameter of type...
2
by: shmeian | last post by:
I have the following code which works fine. However I want to pass the object I'm instantiating a string for its constructor. I can't get the syntax right. Can someone give me an example of...
7
by: hazz | last post by:
this is a repost with more concise code (well, for me) and better questions (I hope....) . given the following two classes, my intent is to use either Activator.CreateInstance or InvokeMember pass...
3
by: System.Reflection Activator | last post by:
************************************** //Load the Assembly Assembly a = Assembly.LoadFrom(sAssembly); //Get Types so we can Identify the Interface. Type mytypes = a.GetTypes(); BindingFlags...
1
by: hazz | last post by:
this is a repost with a hopefully more clearly stated scenario and more concise questions at the end. given the following two classes, my intent is to use pass a token into the instantiated class...
0
by: Stephane D. | last post by:
I have currently an issue with the following piece of code. The assembly is to run under com+ (as Library) and the class derives from ServicedComponent. Code: C# - .NET framework V1.1.4322 //...
1
by: Johnny R | last post by:
Hello, I'm loading a Class from Assemly DLL using Activator.CreateInstance. That loaded Class is executed in a worker Thread with no loop. What actually happends when class is loaded using...
1
by: learning | last post by:
Hi how can I instaltiate a class and call its method. the class has non default constructor. all examples i see only with class of defatul constructor. I am trying to pull the unit test out from...
0
by: =?Utf-8?B?QW5kcmV3?= | last post by:
Found it. string name = Properties.Settings.Default.ClassName.ToString(); //"myproject.myclass, myassembly" format. //name = "ABC.MyClass, Assem" ; Type t = Type.GetType(name); Object obj...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.