Skip to content

System.Resources.Extensions.Tests resource re-generation is broken after BinaryFormatter extrication #104216

Open
@stephentoub

Description

@stephentoub

Trying these instructions:

<!-- Use the following target to regenerate the test resources file.
This is done from a test application and checked in so that we don't run
product code during the build.
Important:
When invoking this target, pass the target framework in as well, substituting
the X with the current major version:
dotnet build -f netX.0-windows && cd outputdir && dotnet build -f netX.0-windows /t:GenerateTestResourcesFile. -->
<Target Name="GenerateTestResourcesFile">
<PropertyGroup>
<_executor>Microsoft.DotNet.RemoteExecutor.dll</_executor>
</PropertyGroup>
<ItemGroup>
<ExecuteMethod Class="System.Resources.Extensions.Tests.TestData" Include="WriteResources" Parameters="$(MSBuildProjectDirectory)\TestData.resources" />
<ExecuteMethod>
<ExceptionFile>$(TargetDir)%(Class)%(Identity).exception.txt</ExceptionFile>
</ExecuteMethod>
<ExecuteMethod>
<Command>$(NetCoreAppCurrentTestHostPath)dotnet exec --runtimeconfig $(TargetDir)$(TargetName).runtimeconfig.json $(_executor) $(AssemblyName) %(Class) %(Identity) %(ExceptionFile) %(Parameters)</Command>
</ExecuteMethod>
</ItemGroup>
<Exec Command="%(ExecuteMethod.Command)" WorkingDirectory="$(TargetDir)" />
</Target>

Results in:

  Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
  File name: 'System.Runtime.Serialization.Formatters, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
     at System.Resources.Extensions.Tests.TestData.WriteResourcesStream(Stream stream)
     at System.Resources.Extensions.Tests.TestData.WriteResources(String file) in D:\repos\runtime\src\libraries\System.Resources.Extensions\tests\TestData.cs:line 228
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
     at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args) in D:\repos\runtime\src\coreclr\System.Private.CoreLib\src\System\Reflection\MethodBaseInvoker.CoreCLR.cs:line 36
     at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr) in D:\repos\runtime\src\libraries\System.Private.CoreLib\src\System\Reflection\MethodBaseInvoker.cs:line 178
  --- End of stack trace from previous location ---
     at Microsoft.DotNet.RemoteExecutor.Program.Main(String[] args) in /_/src/Microsoft.DotNet.RemoteExecutor/src/Program.cs:line 97

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Resourcesbinaryformatter-migrationIssues related to the removal of BinaryFormatter and migrations away from ittest-bugProblem in test source code (most likely)

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions