dotnet / dotnet/runtime

ImporterTests.Import is too brittle and breaks when runtime patch version grows past 10

Open
#128,990 1 comment 0 reactions 0 assignees View on GitHub
area-Serialization
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

The test System.Runtime.Serialization.Schema.Tests.ImporterTests.Import checks the exact number of characters in the generated C# code. This is a problem, because the generated code on .Net 10.0.9 contains:

```c#
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization.Schema", "10.0.0.9")]
```

While on 10.0.10, it's:

```c#
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization.Schema", "10.0.0.10")]
```

This means the number of characters in the generated code changes whenever the patch version reaches 10. https://github.com/dotnet/runtime/pull/119280, which bumps version to 9.0.10, had to manually fix the test and https://github.com/dotnet/runtime/pull/128941, which bumps version to 10.0.10 will likely have to do the same.

I think the test should be changed, so that it's not sensitive to version changes.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.