When I run .NET Core Web API Application on VS 2017,
In Output's Debug panel, keep showing me Exception throw:
'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
However, application runs well without stoping or malfunctioning.
I know Exception always means somthing needs to be cared.
So, how can I search what File is Not Found when run CoreCLR?
------------- more -------------------
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\2.0.0\System.Private.Xml.Linq.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\2.0.0\System.Private.Xml.dll'. Symbols loaded.
'dotnet.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\2.0.0\System.Resources.ResourceManager.dll'. Symbols loaded.
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.CoreLib.dll
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
What is C? C is a general-purpose programming language created by Dennis Ritchie at the Bell Laboratories in 1972. It is a very popular language, despite being old. C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.
C is a general-purpose language that most programmers learn before moving on to more complex languages. From Unix and Windows to Tic Tac Toe and Photoshop, several of the most commonly used applications today have been built on C. It is easy to learn because: A simple syntax with only 32 keywords.
Go to Debug/Windows/Exception Settings and check FileNotFoundException under Common Language Runtime Exceptions. The debugger will stop when the exception is thrown and you will be able to see what is going on.
Note that it is not unusual for exceptions to be expected and handled in some cases. You may find that the exception is expected and handled, and nothing needs to be done to fix it.
The above answer helped me pin point my issue in my Test project.
My case: I was using a .netcore csproj targeting net45 and was missing the MSTest adapter reference.
Once I added these all was good.
<ItemGroup>
<PackageReference Include="MSTest.TestAdapter" Version="2.2.7" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.7" />
</ItemGroup>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With