Skip to content

Don't overwrite LangVersion if set and check raise diagnostic error if level not high enough#2437

Merged
thomhurst merged 2 commits intomainfrom
bug/2426
May 22, 2025
Merged

Don't overwrite LangVersion if set and check raise diagnostic error if level not high enough#2437
thomhurst merged 2 commits intomainfrom
bug/2426

Conversation

@thomhurst
Copy link
Owner

Fixes #2426

[Generator]
public class LanguageVersionCheckGenerator : IIncrementalGenerator
{
public void Initialize(IncrementalGeneratorInitializationContext context)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks to me like this shouldn't be a source generator at all. It should instead be a diagnostic analyzer.

<TestingPlatformShowTestsFailure>true</TestingPlatformShowTestsFailure>
<TestingPlatformCaptureOutput>false</TestingPlatformCaptureOutput>
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated to your PR. But setting OutputType in NuGet props/targets is very bad and should NOT be done. It should be on the user to set this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TUnit.Engine sets LangVersion=latest, overridding my repo policy

2 participants