11-18-2009 11:21 AM
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)
11-18-2009 11:50 PM
11-19-2009 10:36 AM
11-19-2009 10:45 AM
11-19-2009 11:15 AM
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
11-19-2009 03:20 PM
11-19-2009 03:24 PM
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)
11-19-2009 03:39 PM
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