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

Roslynator CLI Reports CS0121 on a .NET 9 Project (Visual Studio & dotnet build OK) #1612

Open
fgimian opened this issue Jan 30, 2025 · 0 comments

Comments

@fgimian
Copy link

fgimian commented Jan 30, 2025

Hey there, there's a very unusual issue with the Roslynator CLI whereby it reports CS0121 on valid .NET 9 code.

Simply create a new C# console application and replace the main program code with the following:

namespace Example;

internal class Program
{
    static void Main()
    {
        var text = string.Join(',', ["a", "b", "c"]);
        Console.WriteLine(text);
    }
}

Visual Studio shows no warnings:

Image

The application builds:

~\source\Example via .NET v9.0.102 🎯 net9.0 took 4s
🕙 [ 04:03:53 PM ] ❯ dotnet build
Restore complete (0.5s)
  Example succeeded (2.8s) → bin\Debug\net9.0\Example.dll

Build succeeded in 3.6s

But the Roslynator CLI reports CS0121:

~\source\Example via .NET v9.0.102 🎯 net9.0
🕙 [ 04:03:40 PM ] ❯ roslynator.exe analyze .\Example.sln
Loading solution 'C:\Users\Fots\source\Example\Example.sln'...
Analyze solution 'C:\Users\Fots\source\Example\Example.sln'
Analyze 'Example' 1/1
  Program.cs(7,27): error CS0121: The call is ambiguous between the following methods or properties: 'string.Join(char, params ReadOnlySpan<object?>)' and 'string.Join(char, params ReadOnlySpan<string?>)'
Analyzed solution 'C:\Users\Fots\source\Example\Example.sln' (in 2.7 s)

1 CS0121

1 diagnostic found

Thanks heaps in advance!
Fotis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant