gpt4 book ai didi

c# - 仅在 VS 2010 上运行时 : COMException: Catastrophic Failure: Error Code: -2147418113

转载 作者:太空宇宙 更新时间:2023-11-03 14:22:35 29 4
gpt4 key购买 nike

我遇到了这个错误:在 .Net Framework 4.0 中尝试使用旧 DLL
如果我将项目目标类型更改为 3.5,则不会出现错误。
奇怪的是,所有这一切只发生在 VS 2010 中运行时。如果我从 Windows 资源管理器运行可执行文件,则在 3.5 和 4.0 中没有出现问题。似乎是 vshost 中的一些错误? VS 2010 Express 还是 .net 框架?

更新:这个 BUG 只发生在 WPF 独立应用程序上,如果将其更改为 XBAP WPF,我可以使用 dll 而不会出现更大的问题,只有一条消息告诉它无法停止调试。

我将在此处保留此问题,等待查看 connect.microsoft.com 上是否有关于此票证的一些进展。

有什么方法可以让我的 .net4 app.config 使用 .net 3.5 加载这个特定的 dll(CobreBemX.dll)?

我认为这是一些错误,然后我将其提交给 https://connect.microsoft.com/VisualStudio/feedback/details/636697/comexception-was-unhandled-catastrophic-failure

这是抛出 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

这是堆栈跟踪:

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: 

最佳答案

如果您检查堆栈的顶部,该方法表明库正在执行一些软件许可处理。我的猜测(一个猜测)是库正在使用可执行文件的名称和路径来定位许可证,并且因为应用程序通过 VSHost 运行,所以失败导致错误,如下所示作为 COM 异常。

它在 VSHost 之外运行良好的事实会增加这一点。您可以使用诸如 FileMon 之类的工具可能会看到它在哪里绊倒。

关于c# - 仅在 VS 2010 上运行时 : COMException: Catastrophic Failure: Error Code: -2147418113,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4893048/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com