我正在开发一个大型应用程序,在这个应用程序中,我需要一些内部包来获取数据。
它构建得很好,但是在调试我添加的代码部分时,我得到了以下错误。
抛出的异常:“System.AggregateException”在mscorlib.dll中--“System.AggregateException”类型的异常发生在mscorlib.dll中,但在用户代码中没有处理,发生了一个或多个错误。
下面的是从Debug输出的
'testhost.net472.x86.exe' (CLR v4.0.30319: Domain 3): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'testhost.net472.x86.exe' (CLR v4.0.30319: TestSourceHost: Enumerating source (C:\MyProJ\ProjectTests\bin\Debug\.netframework,version=v4.7.2\ProjectTests.dll)): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Extensions\TestPlatform\.... .dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
....
....
Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll
Exception thrown: 'System.AggregateException' in mscorlib.dll
An exception of type 'System.AggregateException' occurred in mscorlib.dll but was not handled in user code
One or more errors occurred.
...
...
'testhost.net472.x86.exe' (CLR v4.0.30319: TestSourceHost: Enumerating source (C:\MyProJ\ProjectTests\bin\Debug\.netframework,version=v4.7.2\ProjectTests.dll)): Loaded 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\Remote Debugger\x86\Runtime\Microsoft.VisualStudio.Debugger.Runtime.Desktop.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'testhost.net472.x86.exe' (CLR v4.0.30319: Domain 3): Unloaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll'
通过运行测试来自测试资源管理器的消息
System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Net.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
不能共享很多细节,因为它是一个内部库。
我的项目
<TargetFramework>net472</TargetFramework>
内部图书馆
<TargetFrameworks>netstandard2.0; net472</TargetFrameworks>
任何可能的原因和解决方案的建议。
发布于 2022-07-01 19:08:54
在我的例子中,问题在于我的应用程序需要azure身份验证,这是在我直接调试应用程序时它无法获得的,并且在执行这一行代码时会抛出错误。通过在主项目中使用我的应用程序dll文件并通过身份验证从那里执行它,我能够运行我的代码。
我还是不知道为什么我会收到上面的错误信息。
https://stackoverflow.com/questions/72807378
复制相似问题