question

Eddie0428-6994 avatar image
0 Votes"
Eddie0428-6994 asked Eddie0428-6994 edited

Build Error (Cannot read ntdll.pdb and FileNotFoundException is not handled)

I'm a beginner as C# programmer and I've just started studying Visual Studio.
I'm programming with console application to read file and display the content on MS console. I was expected to program exception of FileNotFound, but complier said FileNotFoundException is not handled. Could your please give me advice on how to fix this error? Thank you very much!126182-samplecode.png126155-ntdll.png


dotnet-csharp
samplecode.png (107.2 KiB)
ntdll.png (143.1 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@Eddie0428-6994
This is a coincidence. This exception is not because your readme.txt was not found, but because your project lacks System.Runtime.
There may be many reasons for this problem. Have you added some nuget packages? Did you modify the configuration file?
If possible, please describe your steps in detail so that we can reproduce your problem.

1 Vote 1 ·

Probably this issue is not caused by your code. Did you check if the simplest program (which prints "Hello, World!") works?

1 Vote 1 ·

1 Answer

Eddie0428-6994 avatar image
0 Votes"
Eddie0428-6994 answered Eddie0428-6994 edited

@TimonYang-MSFT ,@Viorel-1 , Thanks for your comments! As for @Viorel-1 's question, nothing is changed after my code was simplified such as "Hello World!"

I found one issue: I created this project which was not for .NET framework. What I created was for running .NET Core on Windows, Linux, macOS. After creating a console project for .NET Framework, my code works. It seems like creating the wrong project caused this issue even though it is not straightforward solution.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.