Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NRE in SubStepsDispatcher #1458

Closed
rolfbjarne opened this issue Aug 28, 2020 · 0 comments · Fixed by #1855
Closed

NRE in SubStepsDispatcher #1458

rolfbjarne opened this issue Aug 28, 2020 · 0 comments · Fixed by #1855

Comments

@rolfbjarne
Copy link
Member

Test case: linkercustomsteptestcase-eb50a89.zip

Run the test.sh script to repro:

./test.sh
+ rm -Rf CustomStep/bin Executable/bin CustomStep/obj Executable/obj
+ dotnet build CustomStep/dotnet-linker.csproj
Microsoft (R) Build Engine version 16.8.0-preview-20425-03+384d02a5f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  Restored /Users/rolf/test/linkercustomsteptestcase/CustomStep/dotnet-linker.csproj (in 96 ms).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  dotnet-linker -> /Users/rolf/test/linkercustomsteptestcase/CustomStep/bin/Debug/net5.0/dotnet-linker.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.11
+ dotnet publish -r osx-x64 --self-contained true -p:MonoAOT=true -p:VM=mono -p:PublishTrimmed=true -p:TrimMode=link Executable/Executable.csproj /bl:x.binlog
Microsoft (R) Build Engine version 16.8.0-preview-20425-03+384d02a5f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

/usr/local/share/dotnet/sdk/5.0.100-rc.1.20426.3/MSBuild.dll -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/local/share/dotnet/sdk/5.0.100-rc.1.20426.3/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/local/share/dotnet/sdk/5.0.100-rc.1.20426.3/dotnet.dll -maxcpucount -property:RuntimeIdentifier=osx-x64 -property:SelfContained=true -p:MonoAOT=true -p:VM=mono -p:PublishTrimmed=true -p:TrimMode=link -restore -target:Publish -verbosity:m /bl:x.binlog Executable/Executable.csproj
  Determining projects to restore...
  Restored /Users/rolf/test/linkercustomsteptestcase/Executable/Executable.csproj (in 87 ms).
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
  Executable -> /Users/rolf/test/linkercustomsteptestcase/Executable/bin/Debug/net5.0/osx-x64/Executable.dll
ILLink : error IL1012: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues [/Users/rolf/test/linkercustomsteptestcase/Executable/Executable.csproj]
  Fatal error in IL Linker
  Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
     at Mono.Linker.Steps.SubStepsDispatcher.DispatchType(TypeDefinition type)
     at Mono.Linker.Steps.SubStepsDispatcher.BrowseTypes(Collection`1 types)
     at Mono.Linker.Steps.SubStepsDispatcher.BrowseAssemblies(IEnumerable`1 assemblies)
     at Mono.Linker.Steps.SubStepsDispatcher.Mono.Linker.Steps.IStep.Process(LinkContext context)
     at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
     at Mono.Linker.Pipeline.Process(LinkContext context)
     at Mono.Linker.Driver.Run(ILogger customLogger)
     at Mono.Linker.Driver.Main(String[] args)
  Optimizing assemblies for size, which may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
/usr/local/share/dotnet/sdk/5.0.100-rc.1.20426.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.ILLink.targets(41,5): error NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. [/Users/rolf/test/linkercustomsteptestcase/Executable/Executable.csproj]
$ dotnet --version
5.0.100-rc.1.20426.3

This seems to be when there's one substep that includes types, another that doesn't and they're active for different assemblies.

rolfbjarne added a commit to rolfbjarne/xamarin-macios that referenced this issue Aug 28, 2020
… as well to work around a linker bug.

Fixes this linker crash when building the link sdk test:

    ILLink : error IL1012: IL Linker has encountered an unexpected error. Please report the issue at https://github.com/mono/linker/issues [/Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/xharness/tmp-test-dir/link sdk33/link sdk.csproj]
     Fatal error in IL Linker (TaskId:212)
     Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.DispatchType(TypeDefinition type) (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.BrowseTypes(Collection`1 types) (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.BrowseAssemblies(IEnumerable`1 assemblies) (TaskId:212)
        at Mono.Linker.Steps.SubStepsDispatcher.Mono.Linker.Steps.IStep.Process(LinkContext context) (TaskId:212)
        at Mono.Linker.Pipeline.Process(LinkContext context) (TaskId:212)
        at Mono.Linker.Driver.Run(ILogger customLogger) (TaskId:212)
        at Mono.Linker.Driver.Main(String[] args) (TaskId:212)
     The command exited with code 134. (TaskId:212)

Ref: dotnet/linker#1458
@marek-safar marek-safar added this to the .NET 6.0 milestone Nov 13, 2020
marek-safar added a commit to marek-safar/linker that referenced this issue Feb 26, 2021
marek-safar added a commit that referenced this issue Mar 8, 2021
spouliot pushed a commit to spouliot/xamarin-macios that referenced this issue Apr 1, 2021
…for type as well to work around a linker bug."

This reverts commit 482151e.

This issue dotnet/linker#1458 has been fixed a while ago.
dalexsoto pushed a commit to xamarin/xamarin-macios that referenced this issue Apr 2, 2021
…for type as well to work around a linker bug." (#11064)

This reverts commit 482151e.

This issue dotnet/linker#1458 has been fixed a while ago.

Co-authored-by: Sebastien Pouliot <[email protected]>
tj-devel709 pushed a commit to xamarin/xamarin-macios that referenced this issue Apr 7, 2021
…for type as well to work around a linker bug." (#11064)

This reverts commit 482151e.

This issue dotnet/linker#1458 has been fixed a while ago.

Co-authored-by: Sebastien Pouliot <[email protected]>
agocke pushed a commit to dotnet/runtime that referenced this issue Nov 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants