如何理解system的根本原因。

发布于 2025-02-06 19:30:51 字数 14347 浏览 2 评论 0原文

我正在处理一个非常复杂的环境:

有两个主要可执行文件:< application_server> .exe and < application> .desktop.exe,服务器应用程序客户端应用程序。这两个应用程序均不修改。

为了添加功能,可以在服务器和客户端运行时目录的模块子目录中添加dll文件。

上周,我启动了一个客户端应用程序,现在这似乎不再起作用了。这将是由于缺乏telerik.openaccess.35.extensions.dll,但这是没有意义的:上周我也没有在运行时目录中没有该文件,而且一切都在工作美好的。

您能找出我应该寻找的地方,以了解为什么我的应用程序现在要求该telerik相关文件?

这是我的nlog基于基于的输出文件:

2022-06-13 09:13:22.0707 | Application_Client.Desktop.App | Uncaught exception in MainWindow. --- System.IO.FileNotFoundException: Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. The system cannot find the file specified.
File name: 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' ---> System.IO.FileNotFoundException: Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. The system cannot find the file specified.
File name: 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.ReflectionOnlyLoad(String assemblyString)
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.OnReflectionOnlyResolve(ResolveEventArgs args, DirectoryInfo directory)
   at System.AppDomain.OnReflectionOnlyAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\<Runtime_Directory>\Application_Desktop.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342
 (Fully-specified)
LOG: Appbase = file:///C:/<Runtime_Directory>/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This is an inspection only bind.
LOG: Using application configuration file: C:\<Runtime_Directory>\Application_Desktop.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.EXE.

   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.<>c__DisplayClass1_0.<GetNotAllreadyLoadedModuleInfos>b__2(FileInfo file)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetModuleInfos(String path)
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetModuleInfos(String path)
   at Prism.Modularity.DirectoryModuleCatalog.InnerLoad()
   at Prism.Modularity.ModuleCatalog.Initialize()
   at Prism.Modularity.ModuleManager.Run()
   at Application_Client.Desktop.Bootstrapper.InitializeModules() in D:\a\1\s\Application_Client.Desktop\Bootstrapper.cs:line 73
   at Prism.Unity.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
   at Application_Client.Desktop.App.StartUp(Object sender, StartupEventArgs e) in D:\a\1\s\Application_Client.Desktop\App.xaml.cs:line 46
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext 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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(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.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at Application_Client.Desktop.App.Main()

编辑:callstack
在此我的问题的呼叫插场:

>   mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly reqAssembly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks) Line 1859  C#
    mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool forIntrospection) Line 1743 C#
    mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, bool forIntrospection) Line 1722    C#
    mscorlib.dll!System.Reflection.Assembly.ReflectionOnlyLoad(string assemblyString) Line 328  C#
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.OnReflectionOnlyResolve(System.ResolveEventArgs args, System.IO.DirectoryInfo directory)    Unknown
    mscorlib.dll!System.AppDomain.OnReflectionOnlyAssemblyResolveEvent(System.Reflection.RuntimeAssembly assembly, string assemblyFullName) Line 3191   C#
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    mscorlib.dll!System.Reflection.RuntimeAssembly.GetExportedTypes() Line 1517 C#
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetNotAllreadyLoadedModuleInfos.AnonymousMethod__2(System.IO.FileInfo file) Unknown
    System.Core.dll!System.Linq.Enumerable.SelectManyIterator<System.IO.FileInfo, Prism.Modularity.ModuleInfo>(System.Collections.Generic.IEnumerable<System.IO.FileInfo> source, System.Func<System.IO.FileInfo, System.Collections.Generic.IEnumerable<Prism.Modularity.ModuleInfo>> selector)    Unknown
    System.Core.dll!System.Linq.Buffer<Prism.Modularity.ModuleInfo>.Buffer(System.Collections.Generic.IEnumerable<Prism.Modularity.ModuleInfo> source)  Unknown
    System.Core.dll!System.Linq.Enumerable.ToArray<Prism.Modularity.ModuleInfo>(System.Collections.Generic.IEnumerable<Prism.Modularity.ModuleInfo> source) Unknown
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetModuleInfos(string path) Unknown
    [AppDomain (Application.Desktop.exe, #1) -> AppDomain (DiscoveryRegion, #2)]    
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerLoad()   Unknown
    Prism.Wpf.dll!Prism.Modularity.ModuleCatalog.Initialize()   Unknown
    Prism.Wpf.dll!Prism.Modularity.ModuleManager.Run()  Unknown
    Application.Desktop.exe!Application.Client.Desktop.Bootstrapper.InitializeModules() Line 73 C#
    Prism.Unity.Wpf.dll!Prism.Unity.UnityBootstrapper.Run(bool runWithDefaultConfiguration) Unknown
    Application.Desktop.exe!Application.Client.Desktop.App.StartUp(object sender, System.Windows.StartupEventArgs e) Line 46    C#
    PresentationFramework.dll!System.Windows.Application.OnStartup(System.Windows.StartupEventArgs e)   Unknown
    PresentationFramework.dll!System.Windows.Application..ctor.AnonymousMethod__1_0(object unused)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()   Unknown
    WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980  C#
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928  C#
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 917    C#
    WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state)  Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()   Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()  Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)  Unknown
    WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)   Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)  Unknown
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)   Unknown
    PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)   Unknown
    PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)  Unknown
    Application.Desktop.exe!Application.Client.Desktop.App.Main()   Unknown

提前感谢

I'm working with quite a complicated environment:

There are two main executables: <Application_Server>.exe and <Application>.Desktop.exe, a server application and a client application. Both applications are not to be modified.

In order to add functionality, DLL files can be added in the Modules subdirectory of both server and client runtime directories.

Last week, I had started up a client application, and now this seems not to work anymore. This would be due to the lack of the Telerik.OpenAccess.35.Extensions.dll, but this makes not sense: last week I also did not have that file in my runtime directory and still everything was working fine.

Can you find out where I should look in order to understand why my application now is asking to that Telerik related file?

This is my NLog-based output file:

2022-06-13 09:13:22.0707 | Application_Client.Desktop.App | Uncaught exception in MainWindow. --- System.IO.FileNotFoundException: Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. The system cannot find the file specified.
File name: 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' ---> System.IO.FileNotFoundException: Could not load file or assembly 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342' or one of its dependencies. The system cannot find the file specified.
File name: 'Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342'
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
   at System.Reflection.Assembly.ReflectionOnlyLoad(String assemblyString)
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.OnReflectionOnlyResolve(ResolveEventArgs args, DirectoryInfo directory)
   at System.AppDomain.OnReflectionOnlyAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll
Running under executable  C:\<Runtime_Directory>\Application_Desktop.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = Telerik.OpenAccess.35.Extensions, Version=2016.2.822.1, Culture=neutral, PublicKeyToken=7ce17eeaf1d59342
 (Fully-specified)
LOG: Appbase = file:///C:/<Runtime_Directory>/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This is an inspection only bind.
LOG: Using application configuration file: C:\<Runtime_Directory>\Application_Desktop.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.DLL.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions.EXE.
LOG: Attempting download of new URL file:///C:/<Runtime_Directory>/Modules/Telerik.OpenAccess.35.Extensions/Telerik.OpenAccess.35.Extensions.EXE.

   at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
   at System.Reflection.RuntimeAssembly.GetExportedTypes()
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.<>c__DisplayClass1_0.<GetNotAllreadyLoadedModuleInfos>b__2(FileInfo file)
   at System.Linq.Enumerable.<SelectManyIterator>d__17`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetModuleInfos(String path)
   at Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetModuleInfos(String path)
   at Prism.Modularity.DirectoryModuleCatalog.InnerLoad()
   at Prism.Modularity.ModuleCatalog.Initialize()
   at Prism.Modularity.ModuleManager.Run()
   at Application_Client.Desktop.Bootstrapper.InitializeModules() in D:\a\1\s\Application_Client.Desktop\Bootstrapper.cs:line 73
   at Prism.Unity.UnityBootstrapper.Run(Boolean runWithDefaultConfiguration)
   at Application_Client.Desktop.App.StartUp(Object sender, StartupEventArgs e) in D:\a\1\s\Application_Client.Desktop\App.xaml.cs:line 46
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()
   at MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(Object obj)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at MS.Internal.CulturePreservingExecutionContext.Run(CulturePreservingExecutionContext 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 System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(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.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at Application_Client.Desktop.App.Main()

Edit: callstack
Hereby the callstack of my problem:

>   mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly reqAssembly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks) Line 1859  C#
    mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool forIntrospection) Line 1743 C#
    mscorlib.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, bool forIntrospection) Line 1722    C#
    mscorlib.dll!System.Reflection.Assembly.ReflectionOnlyLoad(string assemblyString) Line 328  C#
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.OnReflectionOnlyResolve(System.ResolveEventArgs args, System.IO.DirectoryInfo directory)    Unknown
    mscorlib.dll!System.AppDomain.OnReflectionOnlyAssemblyResolveEvent(System.Reflection.RuntimeAssembly assembly, string assemblyFullName) Line 3191   C#
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    mscorlib.dll!System.Reflection.RuntimeAssembly.GetExportedTypes() Line 1517 C#
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetNotAllreadyLoadedModuleInfos.AnonymousMethod__2(System.IO.FileInfo file) Unknown
    System.Core.dll!System.Linq.Enumerable.SelectManyIterator<System.IO.FileInfo, Prism.Modularity.ModuleInfo>(System.Collections.Generic.IEnumerable<System.IO.FileInfo> source, System.Func<System.IO.FileInfo, System.Collections.Generic.IEnumerable<Prism.Modularity.ModuleInfo>> selector)    Unknown
    System.Core.dll!System.Linq.Buffer<Prism.Modularity.ModuleInfo>.Buffer(System.Collections.Generic.IEnumerable<Prism.Modularity.ModuleInfo> source)  Unknown
    System.Core.dll!System.Linq.Enumerable.ToArray<Prism.Modularity.ModuleInfo>(System.Collections.Generic.IEnumerable<Prism.Modularity.ModuleInfo> source) Unknown
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerModuleInfoLoader.GetModuleInfos(string path) Unknown
    [AppDomain (Application.Desktop.exe, #1) -> AppDomain (DiscoveryRegion, #2)]    
    Prism.Wpf.dll!Prism.Modularity.DirectoryModuleCatalog.InnerLoad()   Unknown
    Prism.Wpf.dll!Prism.Modularity.ModuleCatalog.Initialize()   Unknown
    Prism.Wpf.dll!Prism.Modularity.ModuleManager.Run()  Unknown
    Application.Desktop.exe!Application.Client.Desktop.Bootstrapper.InitializeModules() Line 73 C#
    Prism.Unity.Wpf.dll!Prism.Unity.UnityBootstrapper.Run(bool runWithDefaultConfiguration) Unknown
    Application.Desktop.exe!Application.Client.Desktop.App.StartUp(object sender, System.Windows.StartupEventArgs e) Line 46    C#
    PresentationFramework.dll!System.Windows.Application.OnStartup(System.Windows.StartupEventArgs e)   Unknown
    PresentationFramework.dll!System.Windows.Application..ctor.AnonymousMethod__1_0(object unused)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl()   Unknown
    WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.CallbackWrapper(object obj)   Unknown
    mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980  C#
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928  C#
    mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) Line 917    C#
    WindowsBase.dll!MS.Internal.CulturePreservingExecutionContext.Run(MS.Internal.CulturePreservingExecutionContext executionContext, System.Threading.ContextCallback callback, object state)  Unknown
    WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke()   Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue()  Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled)  Unknown
    WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs)  Unknown
    WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
    WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs)   Unknown
    WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam)  Unknown
    [Native to Managed Transition]  
    [Managed to Native Transition]  
    WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame)   Unknown
    PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore)   Unknown
    PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window)  Unknown
    Application.Desktop.exe!Application.Client.Desktop.App.Main()   Unknown

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

窗影残 2025-02-13 19:30:51

听起来您正在与 plugin建筑正在经历一些dll地狱。

在不知道应用程序的深度或您正在工作的运行时(我认为是.NET框架),很难确切地说出问题所在,但关键的是:运行时正在寻找依赖性,而不是找到它。

看看。从本质上讲,当框架要求依赖性时,该处理程序会发射。返回null是一个“找不到”,然后该框架将在“通常的位置”中寻找依赖项。 位置

  • 与执行组件相同的目录之类的
  • 插件文件夹
  • 全局汇编缓存(GAC)

插件的主要挑战(根据我的经验)包括依赖关系,并使主机加载这些依赖关系。看看如何确定您的这些模块的位置以及如何/是否包括依赖关系。

更改您的文件系统或环境可能会产生此类问题。也许您的应用程序正在起作用,而Git Clean则在程序目录中删除了DLL。也许DLL已加载到GAC中,但是该应用程序现在期望有不同的版本。

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
    }

    private Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
    {
        var filePath = GetPathFromName(args.Name);
        if(System.IO.File.Exists(filePath))
            return Assembly.Load(filePath);
        else
            return null;
    }

    private string GetPathFromName(string name) => "my logic here";


}

It sounds like you are working with plugin architecture and are experiencing a bit of dll hell.

Without knowing the depths of the app or what runtime you're working (I assume it's .NET Framework), it's difficult to say exactly where the problem is but the crux of it is this: The runtime is looking for a dependency and it's not finding it.

Take a look at the AssemblyResolve event. Essentially, when the framework is asking for a dependency, this handler fires. Returning null is a "not found" and then the framework will look for the dependency in the "usual places". Places like

  • the same directory as executing assembly
  • the plugins folder
  • the Global Assembly Cache (GAC)

The main challenge with plugins (in my experience) is including dependencies and getting those dependencies loaded by the host. Take a look at how the locations of these modules of yours are identified and how/whether dependencies are included.

Changes to your filesystem or environment can produce these kinds of problems. Maybe your app was working and a Git Clean took out the DLL in the program directory. Maybe the dll is loaded into the GAC but the app is now expecting a different version.

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
    }

    private Assembly? CurrentDomain_AssemblyResolve(object? sender, ResolveEventArgs args)
    {
        var filePath = GetPathFromName(args.Name);
        if(System.IO.File.Exists(filePath))
            return Assembly.Load(filePath);
        else
            return null;
    }

    private string GetPathFromName(string name) => "my logic here";


}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文