Skip to content

Roslyn Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.WarningsParse testcase is failing on power and x64 with mono. #78095

@ashutoshjadhav9

Description

@ashutoshjadhav9

Roslyn Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.WarningsParse testcase is failing on power and x64 with mono.
We tried it on x86 with dotnet mono, we encountered the same error as on power.
Also we debugged the issue and found out that if we use Xunit version v2-2.5.3 or below then this testcase is passing but with version v2-2.6.0 or above testcases is failing.
The expectedOptions value from test case is not getting calculated properly. It supposed to give string type value but it is returning int type value due to that testcase is failing

Steps to Reproduce:

  1. Build and test Roslyn repo
  2. cd src/Compilers/CSharp/Test/CommandLine
  3. dotnet test --filter FullyQualifiedName~Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.WarningsParse /p:UseAppHost=false

Expected Behavior:
The test should pass without any errors.

Actual Behavior:

[xUnit.net 00:00:00.56]   Discovering: Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
[xUnit.net 00:00:00.80]   Discovered:  Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
[xUnit.net 00:00:00.81]   Starting:    Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
[xUnit.net 00:00:01.07]     Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.WarningsParse [FAIL]
[xUnit.net 00:00:01.07]       Assert.Equal() Failure: Collections differ
[xUnit.net 00:00:01.07]                                                                                                   ↓ (pos 0, type System.Int32)
[xUnit.net 00:00:01.07]       Expected: ReportDiagnostic[]                                                               [1, 1, 1]
[xUnit.net 00:00:01.07]       Actual:   IteratorSelectIterator<KeyValuePair<string, ReportDiagnostic>, ReportDiagnostic> [Error, Error, Error]
[xUnit.net 00:00:01.07]                                                                                                   ↑ (pos 0, type Microsoft.CodeAnalysis.ReportDiagnostic)
[xUnit.net 00:00:01.07]       Stack Trace:
[xUnit.net 00:00:01.07]         /home/ubuntu/ashutosh/roslyn/src/Compilers/Test/Core/Assert/AssertEx.cs(1048,0): at Roslyn.Test.Utilities.AssertEx.Equal[IEnumerable`1](IEnumerable`1 expected, IEnumerable`1 actual)
[xUnit.net 00:00:01.07]         /home/ubuntu/ashutosh/roslyn/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs(5454,0): at Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.AssertSpecificDiagnostics(Int32[] expectedCodes, ReportDiagnostic[] expectedOptions, CSharpCommandLineArguments args)
[xUnit.net 00:00:01.07]         /home/ubuntu/ashutosh/roslyn/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs(5470,0): at Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.WarningsParse()
[xUnit.net 00:00:01.07]            at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
[xUnit.net 00:00:01.07]            at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
[xUnit.net 00:00:01.08]   Finished:    Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests test net9.0 failed with 1 error(s) (3.1s)
  /home/ubuntu/ashutosh/roslyn/src/Compilers/Test/Core/Assert/AssertEx.cs(1048): error TESTERROR:
    Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.WarningsParse (179ms): Error Message: Assert.Equal() Failure: Collections differ
                                                                                                ↓ (pos 0, type System.Int32)
    Expected: ReportDiagnostic[]                                                               [1, 1, 1]
    Actual:   IteratorSelectIterator<KeyValuePair<string, ReportDiagnostic>, ReportDiagnostic> [Error, Error, Error]
                                                                                                ↑ (pos 0, type Microsoft.CodeAnalysis.ReportDiagnostic)
    Stack Trace:
       at Roslyn.Test.Utilities.AssertEx.Equal[IEnumerable`1](IEnumerable`1 expected, IEnumerable`1 actual) in /home/ubuntu/ashutosh/roslyn/src/Compilers/T
    est/Core/Assert/AssertEx.cs:line 1048
       at Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.AssertSpecificDiagnostics(Int32[] expectedCodes, ReportDiagnostic[] expected
    Options, CSharpCommandLineArguments args) in /home/ubuntu/ashutosh/roslyn/src/Compilers/CSharp/Test/CommandLine/CommandLineTests.cs:line 5454
       at Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests.CommandLineTests.WarningsParse() in /home/ubuntu/ashutosh/roslyn/src/Compilers/CSharp/Test/Co
    mmandLine/CommandLineTests.cs:line 5470
       at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
       at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

Test summary: total: 1, failed: 1, succeeded: 0, skipped: 0, duration: 3.1s
Build failed with 2 error(s) in 21.9s

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-CompilersTestTest failures in roslyn-CIhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions