首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >引发的异常:“System.IO.FileNotFoundException”在mscorlib.dll中

引发的异常:“System.IO.FileNotFoundException”在mscorlib.dll中
EN

Stack Overflow用户
提问于 2022-06-29 20:20:33
回答 1查看 918关注 0票数 0

我正在开发一个大型应用程序,在这个应用程序中,我需要一些内部包来获取数据。

它构建得很好,但是在调试我添加的代码部分时,我得到了以下错误。

抛出的异常:“System.AggregateException”在mscorlib.dll中--“System.AggregateException”类型的异常发生在mscorlib.dll中,但在用户代码中没有处理,发生了一个或多个错误。

下面的是从Debug输出的

代码语言:javascript
运行
复制
'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'

通过运行测试来自测试资源管理器的消息

代码语言:javascript
运行
复制
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.

不能共享很多细节,因为它是一个内部库。

我的项目

代码语言:javascript
运行
复制
 <TargetFramework>net472</TargetFramework>

内部图书馆

代码语言:javascript
运行
复制
<TargetFrameworks>netstandard2.0; net472</TargetFrameworks>

任何可能的原因和解决方案的建议。

EN

Stack Overflow用户

回答已采纳

发布于 2022-07-01 19:08:54

在我的例子中,问题在于我的应用程序需要azure身份验证,这是在我直接调试应用程序时它无法获得的,并且在执行这一行代码时会抛出错误。通过在主项目中使用我的应用程序dll文件并通过身份验证从那里执行它,我能够运行我的代码。

我还是不知道为什么我会收到上面的错误信息。

票数 0
EN
查看全部 1 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72807378

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档