Closed drewnoakes closed 2 years ago
Yeah, feel free to ping us for reviews or questions. Any issues you encounter are likely to affect others as well so we want to know about them.
Since this is going to be the only way to view Launch Profiles in VS 2022 we will need to make a change here to fix this this month.
@jmarolf @chsienki a ping on this, as it will be a regression in 17.0 if omitted.
Do we have a tutorial about this somewhere ?
@ignatandrei I record a video:
If this option doesn't show up for you in VS2022, make sure you have the .NET Compiler Platform SDK
Component installed. I somehow missed that and wondered why it didn't show up.
Can these new instructions be added to the "official" documentation for Source/Incremental Generators?
I tried following the video and it is still not working for me.
Can these new instructions be added to the "official" documentation for Source/Incremental Generators?
I tried following the video and it is still not working for me.
Does the dropdown menu doesn't show the option?
Did you add <IsRoslynComponent>true</IsRoslynComponent>
to the source code generator csproj PropertyGroup (Shown in the first few seconds of the video)?
Did you open the menu on the source code generator csproj?
If you can't select the target project, then check whether you have the source code generator referenced in the target project like so <ProjectReference Include="..\YourSourceCodeGeneratorName\YourSourceCodeGeneratorName.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
That's all that should be needed, including the .NET Compiler Platform SDK
, but I imagine you have this installed
If all that doesn't help, you can still create the launchSettings.json by yourself:
{
"profiles": {
"Your.SourceCode.Generator.Name": {
"commandName": "DebugRoslynComponent",
"targetProject": "..\\TargetProject\\TargetProject.csproj"
}
}
}
Can these new instructions be added to the "official" documentation for Source/Incremental Generators? I tried following the video and it is still not working for me.
Does the dropdown menu doesn't show the option? Did you add
<IsRoslynComponent>true</IsRoslynComponent>
to the source code generator csproj PropertyGroup (Shown in the first few seconds of the video)? Did you open the menu on the source code generator csproj?If you can't select the target project, then check whether you have the source code generator referenced in the target project like so
<ProjectReference Include="..\YourSourceCodeGeneratorName\YourSourceCodeGeneratorName.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
That's all that should be needed, including the
.NET Compiler Platform SDK
, but I imagine you have this installedIf all that doesn't help, you can still create the launchSettings.json by yourself:
{ "profiles": { "Your.SourceCode.Generator.Name": { "commandName": "DebugRoslynComponent", "targetProject": "..\\TargetProject\\TargetProject.csproj" } } }
ClassLibrary3 is a .netstandard 2.0 class library that holds an IIncrementalGenerator instance. BlazorApp1 is the sandbox project that will consume that code generated by ClassLibrary3.
Source generation works. Debugging as described here does not, and debugger.launch() is a pain.
@TorreyGarland This problem is known and tracked here: https://github.com/dotnet/roslyn/issues/55802
So one or multiple of your dependencies is the problem, so either remove one after another, until it works, create a new generator and add them until it doesn't work or wait for a fix.
strange... works now perfectly with all previous dependencies on both SourceGenerators and IncrementalGenerators.
I didn't update the sdk.
Maybe good old fashioned restart computer worked.
Thanks for quickly looking into this.
I spoke too soon... it works perfectly for a console app.
it failed with the "filename or extension is too long" message for a Blazor Server App project.
That's the same error message discussed in https://github.com/dotnet/roslyn/issues/55802.
That's the same error message discussed in dotnet/roslyn#55802.
I'm sorry, I didn't see anything specific to blazor apps in that discussion.
This has worked for me. I have tried to streamline the instructions here:
https://github.com/JoanComasFdz/dotnet-how-to-debug-source-generator-vs2022
This has worked for me. I have tried to streamline the instructions here:
https://github.com/JoanComasFdz/dotnet-how-to-debug-source-generator-vs2022
try it with blank blazor server app. does it work for you?
This has worked for me. I have tried to streamline the instructions here: https://github.com/JoanComasFdz/dotnet-how-to-debug-source-generator-vs2022
try it with blank blazor server app. does it work for you?
I just followed my own instructions and yes it works: https://github.com/JoanComasFdz/BlazorApp1
Make sure tu put the breakpoints in the SourceGenerator Initialize and Execute methods to see it working.
Also for reference: I am using VS 2022 17.1.0
This has worked for me. I have tried to streamline the instructions here: https://github.com/JoanComasFdz/dotnet-how-to-debug-source-generator-vs2022
try it with blank blazor server app. does it work for you?
I just followed my own instructions and yes it works: https://github.com/JoanComasFdz/BlazorApp1
Make sure tu put the breakpoints in the SourceGenerator Initialize and Execute methods to see it working.
Also for reference: I am using VS 2022 17.1.0
thank you for looking into to this
Still does not work for me. I am using VS2022 vs 17.1.1 The "Roslyn" menu does not appear , even if I have downloaded https://github.com/JoanComasFdz/BlazorApp1
Any idea why?
.NET Compiler Platform SDK
Solved with https://github.com/dotnet/roslyn-sdk/issues/850#issuecomment-1041839050 . THanks. !
.NET Compiler Platform SDK
Solved with #850 (comment) . THanks. !
this worked with a Blazor Server app? I have the most recent SDK and it still failed.
I've tried this way for debugging, but got this on terminal, related to target project:
But the target project compiles well on Visual Studio, and I can debug it without throubles.
The files listed on Errors CS2001 really don't exist. I really don't know why it's happening.
Generator launchSettings.json:
{
"profiles": {
"Debug Generators": {
"commandName": "DebugRoslynComponent",
"targetProject": "..\\..\\Desktop\\EficazFramework.WPF\\EficazFramework.WPF.csproj"
}
}
}
Target project's csproj file:
<ItemGroup>
<ProjectReference Include="..\..\CodeGenerators\EficazFramework.Generators\EficazFramework.Generators.csproj"
ReferenceOutputAssembly="false"
OutputItemType="Analyzer" />
</ItemGroup>
I've figured that it maybe related to spaces on project folder's name. After renaming "DataGrid Columns" to "DataGridColumns" the number of errors reduced:
UPDATE
After moving to another folder, without any spaces on full path, everything goes fine.
In Dev17 we have a new UI for launch profiles, which replaces the legacy
ILaunchSettingsUIProvider
interface. Rather than having each provider specify it's own UI components, we now expect data about properties in order to present a unified experience.The source generator debugger support in this repo should be extended to provide the relevant data for that experience, for launch profiles with command name
DebugRoslynComponent
.Without support, editing of source generator debugging profiles is not available for C# projects in Dev17.
Docs exist to walk through this process here: https://github.com/dotnet/project-system/tree/main/docs/repo/property-pages
In particular the doc on adding a new launch profile kind, and on property specification.
Ping @drewnoakes or @tmeschter for help if anything is unclear.