diff --git a/Directory.Build.targets b/Directory.Build.targets
index 224a9dbc152..5dd163a2e11 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -6,5 +6,5 @@
-
+
diff --git a/README.md b/README.md
index aef55f46d3d..734ee0089ac 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
# Windows Presentation Foundation (WPF)
[](https://www.dotnetfoundation.org/)
[](https://dnceng.visualstudio.com/public/_build/latest?definitionId=270)
+[](https://codecov.io/gh/dotnet/wpf)
[](https://github.com/dotnet/wpf/blob/main/LICENSE.TXT)
Windows Presentation Foundation (WPF) is a UI framework for building Windows desktop applications.
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 00000000000..020ed6acc6e
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,25 @@
+# https://docs.codecov.io/docs/codecov-yaml
+# https://github.com/codecov/support/wiki/Codecov-Yaml
+
+coverage:
+ range: 20..80 # 20 is red, 80 is green
+ round: down # always round down
+ precision: 5 # highest level of decimal precision
+ status:
+ project:
+ default: false
+ patch:
+ default: false
+ fixes:
+ - "eng/::/"
+
+comment:
+ layout: "diff, flags" # coverage difference, flags below
+
+flags: # which files to include in the reporting
+ production:
+ paths:
+ - src/Microsoft.DotNet.Wpf/src
+ test:
+ paths:
+ - src/Microsoft.DotNet.Wpf/tests/
\ No newline at end of file
diff --git a/eng/CodeCoverage.proj b/eng/CodeCoverage.proj
new file mode 100644
index 00000000000..130798aee47
--- /dev/null
+++ b/eng/CodeCoverage.proj
@@ -0,0 +1,40 @@
+
+
+ C#
+
+
+
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+
+
+ <_CodecovPath>$(NuGetPackageRoot)codecov\$(CodecovVersion)\tools\Codecov.exe
+ <_ReportGeneratorPath>$(NuGetPackageRoot)reportgenerator\$(ReportGeneratorVersion)\tools\net47\ReportGenerator.exe
+
+
+
+
+
+
+ <_CodecovArgs Include="-f;$(ArtifactsDir)coverage\Cobertura.xml" />
+
+
+ <_CodecovArgs Include="--required" Condition="'False' == ''" />
+
+ <_CodecovFlags Include="$(Configuration)" Condition="'$(Configuration)' != ''" />
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/eng/CodeCoverage.runsettings b/eng/CodeCoverage.runsettings
new file mode 100644
index 00000000000..7d7693e3d33
--- /dev/null
+++ b/eng/CodeCoverage.runsettings
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ opencover
+
+
+ true
+
+ true
+
+
+ ExcludeFromCodeCoverage
+
+
+
+
+
+
diff --git a/eng/Testing.targets b/eng/Testing.targets
new file mode 100644
index 00000000000..6d4dc32653f
--- /dev/null
+++ b/eng/Testing.targets
@@ -0,0 +1,21 @@
+
+
+
+ $(TargetDir)coverage\$(MSBuildProjectName).coverage
+
+ false
+
+
+
+ $(TestRunnerAdditionalArguments) --blame
+ $(TestRunnerAdditionalArguments) --blame-hang-dump-type full
+ $(TestRunnerAdditionalArguments) --blame-hang-timeout 10min
+ $(TestRunnerAdditionalArguments) --blame-crash-dump-type full
+
+
+
+ $(TestRunnerAdditionalArguments) --collect:"XPlat Code Coverage"
+ $(TestRunnerAdditionalArguments) --test-adapter-path "$(Pkgcoverlet_collector)/build/netstandard1.0"
+ $(TestRunnerAdditionalArguments) --settings "$(RepoRoot)/eng/CodeCoverage.runsettings"
+
+
\ No newline at end of file
diff --git a/eng/Versions.props b/eng/Versions.props
index 54d955f7014..654878cc345 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -7,6 +7,7 @@
preview
3
$(MajorVersion).$(MinorVersion).$(PatchVersion)
+ true
3.1.2
- 1.9.0
+ 1.12.3
+ 3.1.2
4.0.9
diff --git a/eng/pipeline-pr.yml b/eng/pipeline-pr.yml
index fe2fc86d383..0c7818b64fc 100644
--- a/eng/pipeline-pr.yml
+++ b/eng/pipeline-pr.yml
@@ -139,6 +139,7 @@ jobs:
${{ if eq(parameters.runAsPublic, 'true') }}:
Build_Debug_x64:
_BuildConfig: Debug
+ _Coverage: true
# override some variables for debug
# _SignType has to be real for package publishing to succeed - do not override to test.
_Platform: x64
@@ -174,6 +175,7 @@ jobs:
$(_OfficialBuildIdArgs)
$(_PlatformArgs)
$(_InternalRuntimeDownloadArgs)
+ /p:Coverage=$(_Coverage)
displayName: Windows Build / Publish
# This condition should be kept in sync with the condition for 'Run DRTs' step
# When building on a regular pipeline (!_HelixPipeline), build as usual
@@ -191,19 +193,22 @@ jobs:
$(_PlatformArgs)
$(_InternalRuntimeDownloadArgs)
/bl:$(Build.SourcesDirectory)\artifacts\log\$(_BuildConfig)\Test.binlog
+ /p:Coverage=$(_Coverage)
displayName: Run xUnit Tests
- condition: and(or(ne(variables['_HelixPipeline'], 'true'), and(eq(variables['_HelixPipeline'], 'true') ,eq(variables['_BuildConfig'], 'Release'), eq(variables['_PublicBuildPipeline'], 'true'), eq(variables['_ContinuousIntegrationTestsEnabled'], 'true'))), ne(variables['_Platform'], 'arm64'))
+ condition: and(or(ne(variables['_HelixPipeline'], 'true'), and(eq(variables['_HelixPipeline'], 'true'), eq(variables['_PublicBuildPipeline'], 'true'), eq(variables['_ContinuousIntegrationTestsEnabled'], 'true'))), eq(variables['_Platform'], 'x64'))
- task: PublishTestResults@2
displayName: Publish XUnit Test Results
inputs:
- testResultsFormat: 'xUnit'
- testResultsFiles: '*.xml'
- searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)'
+ testRunner: VSTest
+ testResultsFiles: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)/*.trx'
mergeTestResults: true
- continueOnError: true
- condition: and(eq(variables['_BuildConfig'], 'Release'), ne(variables['_Platform'], 'arm64'))
-
+ condition: and(succeededOrFailed(), eq(variables['_BuildConfig'], 'Debug'), eq(variables['_Platform'], 'x64'))
+
+ # Upload code coverage data
+ - script: dotnet msbuild -binaryLogger:artifacts\log\$(_configuration)\uploadCodeCov.binlog;ProjectImports=Embed -restore eng/CodeCoverage.proj
+ displayName: Upload coverage to codecov.io
+ condition: and(succeeded(), eq(variables['_Coverage'], True), eq(variables['_BuildConfig'], 'Debug'), eq(variables['_Platform'], 'x64'))
# - task: PowerShell@2
# displayName: Install .NET Core
# inputs:
@@ -306,4 +311,4 @@ jobs:
# searchFolder: '$(System.DefaultWorkingDirectory)\Results\'
# testRunTitle: 'Test results'
# mergeTestResults: true
- # condition: eq(variables['System.TeamProject'], 'public')
+ # condition: eq(variables['System.TeamProject'], 'public')
\ No newline at end of file
diff --git a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/ContentType.cs b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/ContentType.cs
index d702bd588f1..403804dccba 100644
--- a/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/ContentType.cs
+++ b/src/Microsoft.DotNet.Wpf/src/WindowsBase/MS/Internal/ContentType.cs
@@ -654,13 +654,15 @@ private void EnsureParameterDictionary()
private const char _equalSeparator = '=';
//This array is sorted by the ascii value of these characters.
- private static ReadOnlySpan AllowedCharacters => [
- '!' /*33*/, '#' /*35*/ , '$' /*36*/,
- '%' /*37*/, '&' /*38*/ , '\'' /*39*/,
- '*' /*42*/, '+' /*43*/ , '-' /*45*/,
- '.' /*46*/, '^' /*94*/ , '_' /*95*/,
- '`' /*96*/, '|' /*124*/, '~' /*126*/,
- ];
+ private static readonly char[] s_allowedCharacters = [
+ '!' /*33*/, '#' /*35*/ , '$' /*36*/,
+ '%' /*37*/, '&' /*38*/ , '\'' /*39*/,
+ '*' /*42*/, '+' /*43*/ , '-' /*45*/,
+ '.' /*46*/, '^' /*94*/ , '_' /*95*/,
+ '`' /*96*/, '|' /*124*/, '~' /*126*/,
+ ];
+
+ private static ReadOnlySpan AllowedCharacters => s_allowedCharacters;
//Linear White Space characters
private static readonly char[] _linearWhiteSpaceChars = [
diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/Directory.Build.props b/src/Microsoft.DotNet.Wpf/tests/UnitTests/Directory.Build.props
index 32312b3dd9a..158affec5b0 100644
--- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/Directory.Build.props
+++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/Directory.Build.props
@@ -10,5 +10,7 @@
-
+
+
+
\ No newline at end of file
diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/PresentationCore.Tests.csproj b/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/PresentationCore.Tests.csproj
index 22b66899765..8e587cb354e 100644
--- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/PresentationCore.Tests.csproj
+++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/PresentationCore.Tests/PresentationCore.Tests.csproj
@@ -23,13 +23,12 @@
-
-
+
diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System.Xaml.Tests.csproj b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System.Xaml.Tests.csproj
index 8c737f3e077..bad4550a881 100644
--- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System.Xaml.Tests.csproj
+++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System.Xaml.Tests.csproj
@@ -16,7 +16,6 @@
-
diff --git a/src/Microsoft.DotNet.Wpf/tests/UnitTests/WindowsBase.Tests/WindowsBase.Tests.csproj b/src/Microsoft.DotNet.Wpf/tests/UnitTests/WindowsBase.Tests/WindowsBase.Tests.csproj
index d02d6eb4e1c..a89a29169c4 100644
--- a/src/Microsoft.DotNet.Wpf/tests/UnitTests/WindowsBase.Tests/WindowsBase.Tests.csproj
+++ b/src/Microsoft.DotNet.Wpf/tests/UnitTests/WindowsBase.Tests/WindowsBase.Tests.csproj
@@ -12,7 +12,6 @@
-