Skip to content

Building libs.tests fails in XmlSerializer.Generator.Tests #39227

Closed

Description

@carlossanlop

I have a clean enlistment synced to the latest runtime commit in master.
I ran .\build.cmd clr+libs -rc release without problem.
When I build .\build.cmd libs.tests -rc release, I get this error:

Assembly 'D:\runtime\artifacts\bin\Microsoft.XmlSerializer.Generator.Tests\net5.0-Debug\Microsoft.XmlSerializer.Generator.Tests.dll' does not contain any types that can be serialized using XmlSerializer.
D:\runtime\src\libraries\Microsoft.XmlSerializer.Generator\tests\Microsoft.XmlSerializer.Generator.Tests.csproj(47,5): error : Fail to generate D:\runtime\artifacts\bin\Microsoft.XmlSerializer.Generator.Tests\net5.0-Debug\Microsoft.XmlSerializer.Generator.Tests.XmlSerializers.cs
D:\runtime\src\libraries\Microsoft.XmlSerializer.Generator\tests\Microsoft.XmlSerializer.Generator.Tests.csproj(48,5): error MSB3030: Could not copy the file "D:\runtime\artifacts\bin\Microsoft.XmlSerializer.Generator.Tests\net5.0-Debug\Microsoft.XmlSerializer.Generator.Tests.XmlSerializers.cs" because it was not found.

Let me know if you need more info.

Activity

  1. added
    untriaged
    on Jul 13, 2020
  2. added this to the 5.0.0 milestone on Jul 13, 2020
  3. removed
    untriaged
    on Jul 13, 2020
  4. safern commented on Jul 13, 2020

    @safern
    Member

    cc: @ViktorHofer @ericstj -- maybe a fallout from: 8790ade

    What is weird is that CI is not failing and CI is doing build.cmd libs.tests. @carlossanlop was this in your regular machine or the Surface Pro X?

  5. ericstj commented on Jul 14, 2020

    @ericstj
    Member

    Odd. I'd expect serializable types to come from here

    <Compile Include="$(TestSourceFolder)..\..\System.Runtime.Serialization.Xml\tests\SerializationTypes.cs" />

    One thing that comes to mind would be that this could happen if you were messing with TargetArchitecture. For instance if you set it to arm64 and built the project (meant to skip) then set it to something else like amd64. It's possible compiler wouldn't rebuild due to incremental, but would try to run the generator.

  6. ericstj commented on Jul 14, 2020

    @ericstj
    Member

    Frankly think we shouldn't be conditioning the test this way as it could cause these incremental build issues since the project doesn't represent these as configurations. Instead we should have the condition as attribute on the test.

  7. ViktorHofer commented on Jul 14, 2020

    @ViktorHofer
    Member

    Agreed with using runtime detection over compile time exclusion. Probably via an XUnitExtensions attribute? cc @safern

  8. carlossanlop commented on Jul 15, 2020

    @carlossanlop
    ContributorAuthor

    was this in your regular machine or the Surface Pro X?

    @safern so far I've seen it in my ARM64 surface, but if I see it in my x64 PC I'll let you know.

  9. safern commented on Jul 15, 2020

    @safern
    Member

    Then I think that confirms @ericstj statement.

  10. carlossanlop commented on Jul 15, 2020

    @carlossanlop
    ContributorAuthor

    @safern @ericstj I built my x64 PC and I also saw the failure there:

    Build FAILED.
    
    D:\runtime\src\libraries\Microsoft.XmlSerializer.Generator\tests\Microsoft.XmlSerializer.Generator.Tests.csproj(47,5): error : Fail to generate D:\runtime\artifacts\bin\Microsoft.XmlSerializer.Generator.Tests\net5.0-Release\Microsoft.XmlSerializer.Generator.Tests.XmlSerializers.cs
    D:\runtime\src\libraries\Microsoft.XmlSerializer.Generator\tests\Microsoft.XmlSerializer.Generator.Tests.csproj(48,5): error MSB3030: Could not copy the file "D:\runtime\artifacts\bin\Microsoft.XmlSerializer.Generator.Tests\net5.0-Release\Microsoft.XmlSerializer.Generator.Tests.XmlSerializers.cs" because it was not found.
        0 Warning(s)
        2 Error(s)
    
    Time Elapsed 00:10:11.61
    Build failed.
    Some builds failed:
            Configuration: release, Architecture: x64
    

    This is the command I used:
    .\build.cmd clr+libs+libs.tests -c release -arch x64

  11. ericstj commented on Jul 15, 2020

    @ericstj
    Member

    I looked at Carlos's machine. The assembly had the types present. The problem is that the tool was running on an old shared framework.

    1. Carlos had the verison of dotnet required by the repo installed machine-wide, so build didn't acquire a local copy.
    2. Carlos had a 2.x shared framework installed machine-wide.
    3. The tool preferred the 2.0.0 machine-wide framework, which couldn't analyze the net5.0 test assembly.

    Ultimately the bug here is that this tool is doing runtime-reflection on build assets:

    assembly = Assembly.LoadFile(path);

    This is an age-old problem where a build tool conflates build-framework with target-framework. Instead of doing runtime-reflection, this tool should be changed to read metadata. That should be much easier now with MetadataLoadContext. I suspect that's the root cause of #1390.

    The reason this regressed was because we stopped using the test-framework to execute the tool. The reason it's only happening for Carlos is the set of things I called out above. Perhaps a workaround would be to change

    to

      "rollForward": "LatestMajor"

    cc @HongGit @StephenBonikowsky @StephenMolloy

  12. ghost locked as resolved and limited conversation to collaborators on Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-Serializationtest-bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions