只有当在VS 2010中运行:收到COMException:灾难性故障错误:code:-2147418113灾难性、故障、错误、VS

2023-09-08 09:42:00 作者:心鸢

我坚持这个错误:试图用一个旧的DLL:在.NET框架4.0 如果我改变项目的目标类型3.5将不会出现任何错误。 奇怪的是,这一切只发生里VS 2010中运行,如果我从Windows资源管理器中运行可执行文件时,发生在3.5和4.0没有问题。 好像在vshost一些bug? VS 2010例preSS,或.net框架?

更新:此错误仅发生在WPF独立应用程序,如果更改XBAP WPF,我可以使用该dll不会有更大的问题,只有一条信息,告诉它可能不停止调试

我将离开这个问题公开在这里,等着看是否有对这个票connect.microsoft.com取得了一些进展。

有没有一些方法,使我的.NET4的app.config负载这一特定DLL(CobreBemX.dll)使用.NET 3.5?

我想这是一些bug,然后我提交给https://connect.microsoft.com/VisualStudio/feedback/details/636697/comexception-was-unhandled-catastrophic-failure

下面是code其中它抛出了收到COMException:

  // CRIAinstância做objeto CobreBemX
CobreBemX.ContaCorrente _CobreBemX =新CobreBemX.ContaCorrenteClass();
//蒙塔arquivo日授权许可去睾丸对银行001 carteira 18
_CobreBemX.ArquivoLicenca = @C:\ CobreBemX \ Exemplos \ Licencas \ 237-09.conf; //这段台词引起该问题对.NET 4.0如果我改变目标框架到3.5 NO的问题发生
 

这是堆栈跟踪:

System.Runtime.InteropServices.COMException是未处理
  消息= Falhacatastrófica
  来源= CobreBemX.ContaCorrente
  错误code = -2147418113
  堆栈跟踪:
       在CobreBemX.ContaCorrenteClass.set_ArquivoLicenca(字符串值)
       在EmissorBoletosWindows.MainWindow.button1_Click(对象发件人,RoutedEventArgs e)在C:\的Inetpub \ wwwroot的\ CRM \ Cobranca \ EmissorBoletosWindows \ EmissorBoletosWindows \ MainWindow.xaml.cs:行90
       在EmissorBoletosWindows.MainWindow.Window_Loaded(对象发件人,RoutedEventArgs e)在C:\的Inetpub \ wwwroot的\ CRM \ Cobranca \ EmissorBoletosWindows \ EmissorBoletosWindows \ MainWindow.xaml.cs:行39
       在System.Windows.RoutedEventHandlerInfo.InvokeHandler(对象的目标,RoutedEventArgs routedEventArgs)
       在System.Windows.EventRoute.InvokeHandlersImpl(对象源,RoutedEventArgs指定参数时,布尔再加注)
       在System.Windows.UIElement.RaiseEventImpl(DependencyObject的发件人,RoutedEventArgs参数)
       在System.Windows.UIElement.RaiseEvent(RoutedEventArgs E)
       在System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject的根,RoutedEvent routedEvent)
       在System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(对象根)
       在MS.Internal.LoadedOrUnloadedOperation.DoWork()
       在System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
       在System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       在System.Windows.Media.MediaContext.RenderMessageHandlerCore(对象resizedCompositionTarget)
       在System.Windows.Media.MediaContext.RenderMessageHandler(对象resizedCompositionTarget)
       在System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
       在System.Windows.Interop.HwndTarget.OnResize()
       在System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage味精,IntPtr的WPARAM,IntPtr的LPARAM)
       在System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的,布尔逻辑处理)
       在MS.Win32.HwndWrapper.WndProc(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的,布尔逻辑处理)
       在MS.Win32.HwndSubclass.DispatcherCallbackOperation(对象o)
       在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托的回调,对象的args,的Int32 numArgs)
       在MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象的args,的Int32 numArgs,代表catchHandler)
       在System.Windows.Threading.Dispatcher.InvokeImpl(的DispatcherPriority优先,时间跨度超时,代表法,对象指定参数时,的Int32 numArgs)
       在MS.Win32.HwndSubclass.SubclassWndProc(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的)
       在MS.Win32.UnsafeNativeMethods.ShowWindow(HandleRef的hWnd,的Int32的nCmdShow)
       在System.Windows.Window.ShowHelper(对象booleanBox)
       在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托的回调,对象的args,的Int32 numArgs)
       在MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象的args,的Int32 numArgs,代表catchHandler)
       在System.Windows.Threading.DispatcherOperation.InvokeImpl()
       在System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(对象状态)
       在System.Threading.ExecutionContext.runTry code(对象USERDATA)
       在System.Runtime.CompilerServices.RuntimeHelpers.Execute codeWithGuaranteedCleanup(试行code code,清理code撤销code,对象USERDATA)
       在System.Threading.ExecutionContext.RunInternal(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态)
       在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态,布尔ignoreSyncCtx)
       在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态)
       在System.Windows.Threading.DispatcherOperation.Invoke()
       在System.Windows.Threading.Dispatcher.ProcessQueue()
       在System.Windows.Threading.Dispatcher.WndProcHook(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的,布尔逻辑处理)
       在MS.Win32.HwndWrapper.WndProc(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的,布尔逻辑处理)
       在MS.Win32.HwndSubclass.DispatcherCallbackOperation(对象o)
       在System.Windows.Threading.ExceptionWrapper.InternalRealCall(委托的回调,对象的args,的Int32 numArgs)
       在MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(对象源,委托方法,对象的args,的Int32 numArgs,代表catchHandler)
       在System.Windows.Threading.Dispatcher.InvokeImpl(的DispatcherPriority优先,时间跨度超时,代表法,对象指定参数时,的Int32 numArgs)
       在MS.Win32.HwndSubclass.SubclassWndProc(IntPtr的HWND,味精的Int32,IntPtr的wParam中,IntPtr的lParam的)
       在MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG和MSG)
       在System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame帧)
       在System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame帧)
       在System.Windows.Threading.Dispatcher.Run()
       在System.Windows.Application.RunDispatcher(对象忽略)
       在System.Windows.Application.RunInternal(窗窗)
       在System.Windows.Application.Run(窗窗)
       在System.Windows.Application.Run()
       在EmissorBoletosWindows.App.Main()的C:\inetpub\wwwroot\CRM\Cobranca\EmissorBoletosWindows\EmissorBoletosWindows\obj\x86\Debug\App.g.cs:line 0
       在System.AppDomain._nExecuteAssembly(RuntimeAssembly组装,字串[] args)
       在System.AppDomain.ExecuteAssembly(字符串assemblyFile,证据assemblySecurity,字串[] args)
       在Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       在System.Threading.ThreadHelper.ThreadStart_Context(对象状态)
       在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态,布尔ignoreSyncCtx)
       在System.Threading.ExecutionContext.Run(ExecutionContext中的ExecutionContext,ContextCallback回调,对象的状态)
       在System.Threading.ThreadHelper.ThreadStart()
  的InnerException:
如何在VS2010中运行编译C和C

解决方案

对于现在这个有没有解决方案比其他使用XBAP

I am stuck with this error: while trying to use an old DLL in .Net Framework 4.0 If I change project target type to 3.5 then no error appears. The strange is that all this happen Only while running inside VS 2010. If I run the executable from Windows Explorer, no problem occurs in 3.5 and 4.0. Seems like some bug in vshost? VS 2010 Express, or .net framework?

UPDATE: This BUG only happen on WPF Standalone Application, if a change it to XBAP WPF I can use the dll without bigger problems, only a message telling it could no stop debugging.

I will leave this question open here, waiting to see if there is some progress on the connect.microsoft.com about this ticket.

Is there some way to make my .net4 app.config load this specific dll(CobreBemX.dll) using the .net 3.5 ?

I think this is some bug then i submitted it to https://connect.microsoft.com/VisualStudio/feedback/details/636697/comexception-was-unhandled-catastrophic-failure

Here is the code where it throws that COMException:

//Cria instância do objeto CobreBemX
CobreBemX.ContaCorrente _CobreBemX = new CobreBemX.ContaCorrenteClass();
//Monta arquivo de licença de teste para banco 001 carteira 18
_CobreBemX.ArquivoLicenca = @"C:\CobreBemX\Exemplos\Licencas\237-09.conf"; // THIS LINES CAUSES THE PROBLEM ON .NET 4.0    IF I CHANGE TARGET FRAMEWORK TO 3.5  NO PROBLEM HAPPENS

This is the stack trace:

System.Runtime.InteropServices.COMException was unhandled
  Message=Falha catastrófica
  Source=CobreBemX.ContaCorrente
  ErrorCode=-2147418113
  StackTrace:
       at CobreBemX.ContaCorrenteClass.set_ArquivoLicenca(String Value)
       at EmissorBoletosWindows.MainWindow.button1_Click(Object sender, RoutedEventArgs e) in C:\inetpub\wwwroot\CRM\Cobranca\EmissorBoletosWindows\EmissorBoletosWindows\MainWindow.xaml.cs:line 90
       at EmissorBoletosWindows.MainWindow.Window_Loaded(Object sender, RoutedEventArgs e) in C:\inetpub\wwwroot\CRM\Cobranca\EmissorBoletosWindows\EmissorBoletosWindows\MainWindow.xaml.cs:line 39
       at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
       at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
       at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
       at System.Windows.UIElement.RaiseEvent(RoutedEventArgs e)
       at System.Windows.BroadcastEventHelper.BroadcastEvent(DependencyObject root, RoutedEvent routedEvent)
       at System.Windows.BroadcastEventHelper.BroadcastLoadedEvent(Object root)
       at MS.Internal.LoadedOrUnloadedOperation.DoWork()
       at System.Windows.Media.MediaContext.FireLoadedPendingCallbacks()
       at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
       at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
       at System.Windows.Media.MediaContext.Resize(ICompositionTarget resizedCompositionTarget)
       at System.Windows.Interop.HwndTarget.OnResize()
       at System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
       at System.Windows.Window.ShowHelper(Object booleanBox)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.DispatcherOperation.InvokeImpl()
       at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
       at System.Threading.ExecutionContext.runTryCode(Object userData)
       at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
       at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Windows.Threading.DispatcherOperation.Invoke()
       at System.Windows.Threading.Dispatcher.ProcessQueue()
       at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
       at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
       at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
       at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
       at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
       at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
       at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
       at System.Windows.Threading.Dispatcher.Run()
       at System.Windows.Application.RunDispatcher(Object ignore)
       at System.Windows.Application.RunInternal(Window window)
       at System.Windows.Application.Run(Window window)
       at System.Windows.Application.Run()
       at EmissorBoletosWindows.App.Main() in C:\inetpub\wwwroot\CRM\Cobranca\EmissorBoletosWindows\EmissorBoletosWindows\obj\x86\Debug\App.g.cs:line 0
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

解决方案

For now this has no solution other than use XBAP