WPF is a .NET Core UI framework for building Windows desktop applications. wpf-test contains test infrastructure and test collateral for the WPF framework.
MIT License
64
stars
23
forks
source link
Tests are failing even after adding reference to "System.Runtime.Serialization.Formatters" #322
The test which are using BinaryFormatter are failing with an error:
" System.Runtime.Serialization.Formatters not found " or "Data on clipboard is invalid"
This is because the BinaryFormatter is removed from dotnet and is shared as a separate Nuget package. To fix this issue we need to add reference in the csproj.
Even after adding the reference, the tests are still failing with the same error.
This is because in .deps.json file the reference to the nuget package is present but in the target section "runtime" path is missing.
Steps to repro
Consider test DrtSequence, it is failing with an error "Data on clipboard is invalid".
Add reference to System.Runtime.Serialization.Formatters in DrtSequence.csproj and Dependencies.csproj.
Also set <EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization> in DrtSequence.csproj
and build the projects
Expected
The reference of System.Runtime.Serialization.Formatters should be present in DrtSequence.deps.json with the runtime path and test should pass.
Actual
The "runtime" path is missing for System.Runtime.Serialization.Formatters in DrtSequence.deps.json and test is failing with same error.
Workaound
Manually add "runtime" path in DrtSequence.deps.json file.
Add "System.Runtime.Serialization.Formatters.dll" to the same path.
Description
The test which are using BinaryFormatter are failing with an error: " System.Runtime.Serialization.Formatters not found " or "Data on clipboard is invalid"
This is because the BinaryFormatter is removed from dotnet and is shared as a separate Nuget package. To fix this issue we need to add reference in the csproj.
Issue
Even after adding the reference, the tests are still failing with the same error. This is because in .deps.json file the reference to the nuget package is present but in the target section "runtime" path is missing.
Steps to repro
Consider test
DrtSequence
, it is failing with an error "Data on clipboard is invalid". Add reference to System.Runtime.Serialization.Formatters in DrtSequence.csproj and Dependencies.csproj.Also set
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
in DrtSequence.csproj and build the projectsExpected
The reference of
System.Runtime.Serialization.Formatters
should be present in DrtSequence.deps.json with the runtime path and test should pass.Actual
The "runtime" path is missing for System.Runtime.Serialization.Formatters in DrtSequence.deps.json and test is failing with same error.
Workaound
Manually add "runtime" path in DrtSequence.deps.json file. Add "System.Runtime.Serialization.Formatters.dll" to the same path.
Paths: DrtSequence.deps.json "\wpf-test\publish\Debug\x64\Test\DRT"