Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Source Generator results in an empty RS1042 #77988

Open
vsfeedback opened this issue Apr 3, 2025 · 0 comments
Open

Creating a Source Generator results in an empty RS1042 #77988

vsfeedback opened this issue Apr 3, 2025 · 0 comments
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead

Comments

@vsfeedback
Copy link

vsfeedback commented Apr 3, 2025

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version] [regression] [worked-in:17.14.0 preview 2]
With a project file

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
	  <LangVersion>preview</LangVersion>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
	  <EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
  </PropertyGroup>

<ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.13.0" />
  </ItemGroup>

</Project>

and content of

[Generator]
    internal class SourceGenerator : ISourceGenerator

It results in an empty error message:

C:\Dev\RPWSourceGenerator\SourceGenerator.cs(13,20,13,35): error RS1042:


Original Comments

Peter Smulovics on 29/3/2025, 09:51 PM:

Yes - I am aware what the error supposed to say; my report is that visual studio do not fill out the error, it actually says just:

C:\Dev\RPWSourceGenerator\SourceGenerator.cs(13,20,13,35): error RS1042:

Eg no actual error message.

Feedback Bot on 31/3/2025, 01:30 PM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.


Original Solutions

Patrick Lacasse solved on 29/3/2025, 06:53 PM, undefined votes:

Hi Peter,
RS1042 means ISourceGenerator is now obsolete.
There is this new feature instead https://github.com/dotnet/roslyn/blob/main/docs/features/incremental-generators.md
I’m now reading this article https://www.thinktecture.com/en/net-core/roslyn-source-generators-high-level-api-forattributewithmetadataname/

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Analyzers untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

No branches or pull requests

2 participants