簡體   English   中英

拋出異常:mscorlib.dll 中的“System.IO.FileNotFoundException”

[英]Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll

我正在開發一個大型應用程序,我需要一些內部包來獲取數據。

它構建得很好,但是在調試我添加的代碼部分時,出現以下錯誤。

引發的異常:mscorlib.dll 中的“System.AggregateException”在 mscorlib.dll 中發生了“System.AggregateException”類型的異常,但未在用戶代碼中處理一個或多個錯誤。

下面是調試中的 output

'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>

任何建議可能的原因和解決方案可能是什么。

在我的情況下,問題是我的應用程序需要 azure 身份驗證,當我直接調試我的應用程序時它無法獲得,並且在執行該行代碼時拋出錯誤。 通過在主項目中使用我的應用程序 dll 文件並通過身份驗證從那里執行它,我能夠運行我的代碼。

仍然不知道為什么我收到上述錯誤消息。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM