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

dotnet test html logger throws execption when using special characters in DataRow attributes. #38983

Closed
crone66 opened this issue Feb 23, 2024 · 1 comment
Labels
Area-DotNet Test untriaged Request triage from a team member

Comments

@crone66
Copy link

crone66 commented Feb 23, 2024

Describe the bug

When using DataRow attribute in a unit-test such as [DataRow((char)8)] causes an exception in the dotnet test logger when using html logs. It is a pain to figure out what the actual root cause is in bigger projects :).

I configured the test logger by using Directory.Build.props file. But I guess the same issue should occur when using dotnet test --logger html

<?xml version="1.0" encoding="utf-8"?>
<Project>
    <PropertyGroup>
        <SignAssembly>false</SignAssembly>
    </PropertyGroup>
    <PropertyGroup>
        <VSTestLogger>html%3BLogFileName=$(MSBuildProjectName).html</VSTestLogger>
    </PropertyGroup>
</Project>
    [TestClass]
    public class MyTestClass
    {
        [DataRow((char)8)] //html logger prints an error and the test result file is empty.
        [DataRow((char)122)]
        [TestMethod]
        public void UselessTestMethod(char key)
        {
            Assert.IsTrue(key > 0);
        }
    }

To Reproduce

The output of the last executed github action run shows the error in the Test step
https://github.com/crone66/bug-dotnet-test/tree/main

Exceptions (if any)

Html Logger Error : '�', hexadecimal value 0x08, is an invalid character.

Further technical details

  • Error can be seen when using github actions
@nohwnd
Copy link
Member

nohwnd commented Nov 13, 2024

Moved to vstest, Will see how we can escape it better.

@nohwnd nohwnd closed this as completed Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-DotNet Test untriaged Request triage from a team member
Projects
None yet
Development

No branches or pull requests

2 participants