LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Error 1172 Could not load file or assembly 'DNEventRegAsm

I am developing an Automation interface for a fairly complex product with remoted objects. When trying to register for an event on one of these objects I get an error of 1172. I have created a simple C# program and VI that duplicates the problem. Through Visual Studio I was able to extract this: (I have highlighted what I believe to be the problem) To this point I have been unable to find any information regarding a file, dll, assembly whatever named "DNEventRegAsm"

 

Created new AppDomain: LabVIEW Domain for Run

'LabVIEW.exe' (Managed): Loaded 'DNEventRegAsm'

'LabVIEW.exe' (Managed): Loaded 'DNEventRegMod'

DNError: Error registering event GetMakerLib.EventMaker.OnEvent (1172). System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

at System.Reflection.EventInfo.AddEventHandler(Object target, Delegate handler)

at NationalInstruments.LabVIEW.DNRuntime.RegisterEvent(Boolean isRegister, Type type, ObjectId objectId, Int32 eType, Int32 eFlags, String eventName, IntPtr viCBRef, IntPtr cookie, IntPtr userParam)

Inner Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.

Server stack trace:

at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)

at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)

at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)

at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)

at System.Runtime.Serialization.ObjectManager.DoFixups()

at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)

at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)

at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at GetMakerLib.EventMaker.add_OnEvent(theEvent value)

Inner Exception: System.IO.FileNotFoundException: Could not load file or assembly 'DNEventRegAsm, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

at System.Reflection.Assembly.Load(String assemblyString)

at System.Reflection.MemberInfoSerializationHolder..ctor(SerializationInfo info, StreamingContext context)

0 Kudos
Message 1 of 8
(4,179 Views)
0 Kudos
Message 2 of 8
(4,158 Views)
No, I had already looked at that thread. All my vi's and dlls are in the same directory. I'm fairly certian that this has nothing to do with the GAC, thanks for your interest muks!
0 Kudos
Message 3 of 8
(4,140 Views)
try this
0 Kudos
Message 4 of 8
(4,138 Views)

Try running debugview when you execute your code. It may provide more details on what is throwing the exception. It has helped me in the past with a C# dll that was driving me nuts.

 

http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
Message 5 of 8
(4,130 Views)
Mathan, Thanks for the suggestion. I'm using LV2009 and I do not see an option to "add a reference to the .NET assembly" under the Tools menu or otherwise. LV does seem to recognize the classes I have defined in the dll. All dll's and VI's are indeed in the same directory.
0 Kudos
Message 6 of 8
(4,117 Views)

I can't see that debugview gave me any more information than VS. Here is the output from debugview:

 

[320] Created new AppDomain: LabVIEW Domain for Run
[320] DNError: Error registering event GetMakerLib.EventMaker.OnEvent (1172). System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
[320]    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
[320]    at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
[320]    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
[320]    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
[320]    at System.Reflection.EventInfo.AddEventHandler(Object target, Delegate handler)
[320]    at NationalInstruments.LabVIEW.DNRuntime.RegisterEvent(Boolean isRegister, Type type, ObjectId objectId, Int32 eType, Int32 eFlags, String eventName, IntPtr viCBRef, IntPtr cookie, IntPtr userParam)
[320]  Inner Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
[320] 
[320] Server stack trace: 
[320]    at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)
[320]    at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)
[320]    at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
[320]    at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
[320]    at System.Runtime.Serialization.ObjectManager.DoFixups()
[320]    at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
[320]    at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
[320]    at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
[320]    at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)
[320] 
[320] Exception rethrown at [0]: 
[320]    at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
[320]    at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
[320]    at GetMakerLib.EventMaker.add_OnEvent(theEvent value)
[320]  Inner Exception: System.IO.FileNotFoundException: Could not load file or assembly 'DNEventRegAsm, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
[320]    at System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
[320]    at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection)
[320]    at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
[320]    at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
[320]    at System.Reflection.Assembly.Load(String assemblyString)
[320]    at System.Reflection.MemberInfoSerializationHolder..ctor(Serialization
[320] Info info, StreamingContext context)

0 Kudos
Message 7 of 8
(4,116 Views)

Not a bad match to VS. Does this dll depend on any other files, perhaps a config file? If so, that (those) files may have to reside in the same folder as the dll.

 

-AK2DM

~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 8 of 8
(4,112 Views)