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

Debug launch profiles UI - Roslyn Component - crashes if there is a space in the output directory path.

Open sjb-sjb opened this issue 9 months ago • 1 comments

Visual Studio Version

17.12.4

Summary

If there is a space in the BaseOutputPath and BaseIntermediateOutputPath then creating a Roslyn Component launch profile using "Open debug launch profiles UI" causes a crash.

Steps to Reproduce

  1. Create a .NET standard 2.0 class library with the following .csproj:
    <Project Sdk="Microsoft.NET.Sdk">
	<PropertyGroup>
		<TargetFramework>netstandard2.0</TargetFramework>
		<IsRoslynComponent>true</IsRoslynComponent>
		<IncludeBuildOutput>true</IncludeBuildOutput>
		<Nullable>enable</Nullable>
		<LangVersion>latest</LangVersion>
		<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
		<RootNamespace>Q5.Framework.Generator</RootNamespace>
	</PropertyGroup>

	<ItemGroup>
		<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4">
			<PrivateAssets>all</PrivateAssets>
			<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
		</PackageReference>
		<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
	</ItemGroup>
    </Project>
  1. Add the following Directory.Build.props and change xxxx to your user name and yyyy to your project name (with no blanks):
    <Project>
	<PropertyGroup>
		<BaseOutputPath>C:\Users\xxxx\Documents\VS-Output\yyyy</BaseOutputPath>
		<BaseIntermediateOutputPath>C:\Users\xxxx\Documents\VS-Output\yyyy</BaseIntermediateOutputPath>
		<EnforceExtendedAnalyserRules>true</EnforceExtendedAnalyserRules>
		<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
		<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\Generated</CompilerGeneratedFilesOutputPath>
		
		<Nullable>enable</Nullable>

		<CsWinRTAotOptimizerEnabled>false</CsWinRTAotOptimizerEnabled>
		<CsWinRTRcwFactoryFallbackGeneratorForceOptOut>true</CsWinRTRcwFactoryFallbackGeneratorForceOptOut>
	</PropertyGroup>
    </Project>
 
  1. Right-click on the project, select Properties > General > Open debug launch profiles UI. It works. Now go back and remove the "-" in "VS-Output" and do it again. Create a Roslyn Component profile. It crashes.

Expected Behavior

Should be able to create a Roslyn Component profile when there is a space in the path.

Actual Behavior

It crashes with an exception saying invalid character.

User Impact

Lost a lot of time figuring this one out!!

sjb-sjb avatar Jan 19 '25 23:01 sjb-sjb