roslyn-sdk icon indicating copy to clipboard operation
roslyn-sdk copied to clipboard

RoslynDebugComponent fails for project folder paths with space in the name

Open MDerrickGlass opened this issue 3 years ago • 2 comments

At least, that's what appears to happen. I followed the instructions at https://github.com/JoanComasFdz/dotnet-how-to-debug-source-generator-vs2022, and it seems to mostly do the trick. A command window pops up running the C# compiler; however, it quickly lists a set of errors and exits.

I'm debugging a source generator that is working correctly, fully functional, against the target project. That legacy project has a folder named Custom Code where the interesting source files are. In the command window that appears, these errors are output: Screenshot 2022-10-11 202559

Please note the error is: `error CS2001: Source file '...\Server.Business\Code\...' could not be found.

And that is correct, there is no such file at that path. The correct path should be ...\Generated Code\... - with a space - instead of ...\Code\....

MDerrickGlass avatar Oct 12 '22 00:10 MDerrickGlass

This issue also exists with code files that have spaces in the name, like this:

error CS2001: Source file '<project>\App_Code\GridViewTemplateExternal' could not be found.
error CS2001: Source file '<project>\.cs' could not be found.
error CS2001: Source file '<project>\App_Code\BaseMaster' could not be found.

OronDF343 avatar May 18 '23 14:05 OronDF343

I'm guessing the command line arguments need to be quoted here when they contain a space: https://github.com/dotnet/roslyn-sdk/blob/35d5e46fd5c403194692c645d912a17d36ed74f5/src/VisualStudio.Roslyn.SDK/ComponentDebugger/DebugProfileProvider.cs#L75-L77

sharwell avatar May 30 '23 14:05 sharwell