Skip to content

Regression with console logger in .NET 9 #4852

@rolfbjarne

Description

@rolfbjarne

Description

It seems the output from the console logger is parsed, and may cause tests to fail.

Steps to reproduce

Project file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>net9.0</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="nunit" Version="3.12.0" />
    <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
  </ItemGroup>
</Project>

Test file:

using System;
using NUnit.Framework;

namespace MyTests {
	[TestFixture ()]
	public class TestSuite {
		[Test]
		public void Something ()
		{
			Console.Error.WriteLine ("error BI1117: bgen: The member 'SomeMethod' is decorated");
		}
	}
}

Running just dotnet test works fine:

$ dotnet test
Restore complete (0.2s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  testcase succeeded (0.1s) → bin/Debug/net9.0/testcase.dll

Build succeeded in 1.0s

Making the console logger's verbosity detailed does not:

$ dotnet test '--logger:console;verbosity=detailed'
Restore complete (0.2s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  testcase succeeded (0.1s) → bin/Debug/net9.0/testcase.dll
  testcase failed with errors (0.0s)
    VSTESTTASK2 : error BI1117: bgen: The member 'SomeMethod' is decorated
    VSTESTTASK2 : Standard error Messages: 
    VSTESTTASK2 : error BI1117: bgen: The member 'SomeMethod' is decorated

Build failed with errors in 1.0s

Expected behavior

Enabling detailed verbosity shouldn't affect test results.

Actual behavior

Enabling detailed verbosity makes tests fail.

Environment

This is with .NET 9.0.100-preview.2.24074.1.

In particular this regressed in this range: 1c68c24...53df73d

So I'm guessing this is the culprit: 6d400ab

CC @nohwnd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions