Open davkean opened 7 years ago
Is this not the issue where building in VS doesn't stop when it hits an error? Thus leading to much cascading of errors? If so, who is the best team to address this? AFAIK, Roslyn doesn't control that behavior, it's something baked into VS.
Apart from the last error (which is occurring because the XAML page is open) the other errors are all because of Roslyn.
But the last errors are happening because we're being asked to compile projects whose dependencies did not build. If you tried to compile the projects form the command line, but didn't include those dependencies, wouldn't you get the same errors? You just don't normally get this from the command line because the compiling of a dependency chain stops when one of hte dependent projects fails to build.
Here's a simple example. I made a basic solution with a console app and a class library. I made the console app reference the class library. I then added an error to the class library. when i try to build from VS i get:
1>------ Build started: Project: CSharpClassLibrary5, Configuration: Debug Any CPU ------
1>c:\users\cyrusn\documents\visual studio 2017\Projects\CSharpClassLibrary5\CSharpClassLibrary5\Class1.cs(13,13,13,19): error CS0127: Since 'Class1.Foo()' returns void, a return keyword must not be followed by an object expression
2>------ Build started: Project: CSharpConsoleApp1, Configuration: Debug Any CPU ------
2>CSC : error CS0006: Metadata file 'c:\users\cyrusn\documents\visual studio 2017\Projects\CSharpClassLibrary5\CSharpClassLibrary5\bin\Debug\CSharpClassLibrary5.dll' could not be found
========== Build: 0 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
Note how VS decided to build the console app, even though the dependencies didn't build.
However, when i do this from the command line, i only get:
Class1.cs(13,13): error CS0127: Since 'Class1.Foo()' returns void, a return keyword must not be followed by an object expression [c:\Users\cyrusn\Documents\Visual Studio 2017\Projects\CSharpClassLibrary5\CSharpClassLibrary5\CSharpClassLibrary5.csproj]
Done Building Project "c:\Users\cyrusn\Documents\Visual Studio 2017\Projects\CSharpClassLibrary5\CSharpClassLibrary5\CSharpClassLibrary5.csproj" (default targets) -- FAILED.
Done Building Project "c:\Users\cyrusn\Documents\Visual Studio 2017\Projects\CSharpClassLibrary5\CSharpClassLibrary5.sln" (default targets) -- FAILED.
msbuild knows to not even bother with the dependent projects.
I don't know why we even get to:
2>------ Build started: Project: CSharpConsoleApp1, Configuration: Debug Any CPU ------
If the prereqs failed, then it feels like we shouldn't even bother calling to the compiler to try to build this project. If we do, we'll of course get an error, just like
Note: there's an extension to help out here: https://marketplace.visualstudio.com/items?itemName=EinarEgilsson.StopOnFirstBuildError
But it seems like it would be good if VS's build system just behaved the same way as MSBuild.
From @eyalsk on February 25, 2017 22:53
Version Used: Microsoft Visual Studio Community 2017 RC (15.0.26206.0 D15REL)
When I compile through the command-line I get the expected errors:
But when I compile through Visual Studio I get loads of additional errors that are unrelated to the problems I need to fix in the code, here are few examples of the errors I got:
Related PR.
Just a note, I've already fixed the compilation errors but this can get really frustrating because when it happens, the error list window doesn't show the actual errors and you get no squiggles so you don't even know what to fix unless you compile it through the command-line.
Copied from original issue: dotnet/roslyn-project-system#1625