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
Html Logger Error when running System.Text.RegularExpressions.Tests #3136
Comments
I can still reproduce the issue on latest TP. |
it forms this invalid XML <TestRunDetails xmlns="http://schemas.datacontract.org/2004/07/Microsoft.VisualStudio.TestPlatform.Extensions.HtmlLogger.ObjectModel" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ResultCollectionList>
<TestResultCollection>
<FailedResultList/>
<Id>641133380</Id>
<ResultList>
<TestResult>
<DisplayName>MyTest.UnitTest1.AllMatches(pattern: "(\\uFFFE\\uFFFF)+", options: None, input: "=====\xfffe\xffff\xfffe\xffff\xfffe====", matches: [(5, 4, )])</DisplayName>
<Duration>1ms</Duration>
<ErrorMessage i:nil="true"/>
<ErrorStackTrace i:nil="true"/>
<FullyQualifiedName>MyTest.UnitTest1.AllMatches</FullyQualifiedName>
<InnerTestResults i:nil="true"/>
<ResultOutcome>Passed</ResultOutcome>
<TestResultId>3b55767a-cbec-2d65-7b69-2ece9a0cff45</TestResultId>
</TestResult>
</ResultList>
<Source>C:\repro\1\bin\Debug\net6.0\proj.dll</Source>
</TestResultCollection>
</ResultCollectionList>
<RunLevelMessageErrorAndWarning i:nil="true" xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
<RunLevelMessageInformational xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<a:string>[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.3+1b45f5407b (64-bit .NET 6.0.18)</a:string>
<a:string>[xUnit.net 00:00:01.27] Discovering: proj</a:string>
<a:string>[xUnit.net 00:00:07.78] Discovered: proj</a:string>
<a:string>[xUnit.net 00:00:07.78] Starting: proj</a:string>
<a:string>[xUnit.net 00:00:07.88] Finished: proj</a:string>
</RunLevelMessageInformational>
<Summary>
<FailedTests>0</FailedTests>
<PassPercentage>100</PassPercentage>
<PassedTests>1</PassedTests>
<SkippedTests>0</SkippedTests>
<TotalRunTime>2m 2s</TotalRunTime>
<TotalTests>1</TotalTests>
</Summary>
</TestRunDetails> these are invalid character references:
|
It is running the XSL transform over an XML file created by DCS. DCS is tolerant of these invalid characters -- it will serialize as eg In default configuration XmlTextWriter will happily serialize the same way. But in default configuration XmlReader will not read it, and that is what is throwing here. It is necessary to set XmlWriterSettings.CheckCharacters to false. The fix should be to provide XslCompiledTransform with an XmlReader (rather than a path) with that flag set. |
@nohwnd I believe https://github.com/microsoft/vstest/compare/main...danmoseley:vstest:fix.invalid.char?expand=1 is the likely fix, but the mocking is troublesome and I don't have more time to spend on it. Is this a test you can finish (as you are familiar with how testing is done) so we can put up a PR? edit: I do not think this is mockable. I put up a PR without a test, validated locally. |
Description
When running the System.Text.RegularExpressions.Tests tests in dotnet/runtime, we are seeing an Html Logger error at the end of the test run. I was able to isolate this into a simple repo.
Steps to reproduce
dotnet test
the following project:UnitTest1.cs
MyTest.csproj
.runsettings
Expected behavior
No errors should be logged
Actual behavior
Diagnostic logs
It looks like the exception is coming from around here
vstest/src/Microsoft.TestPlatform.Extensions.HtmlLogger/HtmlLogger.cs
Lines 331 to 338 in ad32654
Attaching a debugger I see the following stack trace:
I assume we need to be escaping some data into the xml file that is getting passed into the XslTransform.
AB#1582509
The text was updated successfully, but these errors were encountered: