Chapter: 4
Page Number: 171
Section Title: Hot reloading during development
Step Number: 3
Problem to fix: The example code on p.171 raises an exception if the C# file does not use top-level statements:
while (true) {
WriteLine("Hello, Hot Reload!");
await Task.Delay(2000);
}
When running the code, the compiler returns: "There were build errors. Would you like to continue and run the last successful build?". Additionally, VS produces the following CS5001 error message: "Program does not contain a static 'Main' method suitable for an entry point".
Suggested solution: If we want not to use top-level statements, we need to modify the Main() method:
static async Task Main(string[] args)
Other useful information e.g. OS, coding tools, and so on: Windows 10, VS 2022, VSC 1.77.3
Thank you 😉
Chapter: 4 Page Number: 171 Section Title: Hot reloading during development Step Number: 3 Problem to fix: The example code on p.171 raises an exception if the C# file does not use top-level statements:
When running the code, the compiler returns: "There were build errors. Would you like to continue and run the last successful build?". Additionally, VS produces the following CS5001 error message: "Program does not contain a static 'Main' method suitable for an entry point". Suggested solution: If we want not to use top-level statements, we need to modify the
Main()
method:Other useful information e.g. OS, coding tools, and so on: Windows 10, VS 2022, VSC 1.77.3 Thank you 😉