Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
This repository was archived by the owner on Sep 25, 2026. It is now read-only.

Unhandled exception - System.InvalidOperationException #2971

Closed

Description

@MichaelSimons

Building the runtime repo with a linker from 81ffbb5 fails with the following:

  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/AssemblyGen.cs(68,13): Trim analysis warning IL2121: System.Linq.Expressions.Compiler.AssemblyGen.DefineDelegateType(String): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-iOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(442,13): Trim analysis warning IL2121: System.Linq.Expressions.BinaryExpression.CallGetValueOrDefault(ParameterExpression): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-iOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(450,13): Trim analysis warning IL2121: System.Linq.Expressions.BinaryExpression.GetHasValueProperty(ParameterExpression): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-iOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSite.cs(344,13): Trim analysis warning IL2121: System.Runtime.CompilerServices.CallSite<T>.CreateCustomUpdateDelegate(MethodInfo): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2060'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-iOS]
    Fatal error in IL Linker
    Unhandled exception. System.InvalidOperationException: Sequence contains no elements
       at System.Linq.ThrowHelper.ThrowNoElementsException()
       at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
       at Mono.Linker.MessageOrigin.ToString()
       at Mono.Linker.MessageContainer.ToMSBuildString()
       at Mono.Linker.MessageContainer.ToString()
       at Mono.Linker.ConsoleLogger.LogMessage(MessageContainer message)
       at Mono.Linker.LinkContext.LogMessage(MessageContainer message)
       at Mono.Linker.LinkContext.FlushCachedWarnings()
       at Mono.Linker.Driver.Run(ILogger customLogger)
       at Mono.Linker.Driver.Main(String[] args)
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/eng/illink.targets(300,5): error MSB6006: "dotnet" exited with code 134. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-iOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/AssemblyGen.cs(68,13): Trim analysis warning IL2121: System.Linq.Expressions.Compiler.AssemblyGen.DefineDelegateType(String): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-tvOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(442,13): Trim analysis warning IL2121: System.Linq.Expressions.BinaryExpression.CallGetValueOrDefault(ParameterExpression): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-tvOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(450,13): Trim analysis warning IL2121: System.Linq.Expressions.BinaryExpression.GetHasValueProperty(ParameterExpression): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-tvOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSite.cs(344,13): Trim analysis warning IL2121: System.Runtime.CompilerServices.CallSite<T>.CreateCustomUpdateDelegate(MethodInfo): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2060'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-tvOS]
    Fatal error in IL Linker
    Unhandled exception. System.InvalidOperationException: Sequence contains no elements
       at System.Linq.ThrowHelper.ThrowNoElementsException()
       at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
       at Mono.Linker.MessageOrigin.ToString()
       at Mono.Linker.MessageContainer.ToMSBuildString()
       at Mono.Linker.MessageContainer.ToString()
       at Mono.Linker.ConsoleLogger.LogMessage(MessageContainer message)
       at Mono.Linker.LinkContext.LogMessage(MessageContainer message)
       at Mono.Linker.LinkContext.FlushCachedWarnings()
       at Mono.Linker.Driver.Run(ILogger customLogger)
       at Mono.Linker.Driver.Main(String[] args)
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/eng/illink.targets(300,5): error MSB6006: "dotnet" exited with code 134. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-tvOS]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/AssemblyGen.cs(68,13): Trim analysis warning IL2121: System.Linq.Expressions.Compiler.AssemblyGen.DefineDelegateType(String): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-MacCatalyst]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(442,13): Trim analysis warning IL2121: System.Linq.Expressions.BinaryExpression.CallGetValueOrDefault(ParameterExpression): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-MacCatalyst]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/BinaryExpression.cs(450,13): Trim analysis warning IL2121: System.Linq.Expressions.BinaryExpression.GetHasValueProperty(ParameterExpression): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2026'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-MacCatalyst]
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSite.cs(344,13): Trim analysis warning IL2121: System.Runtime.CompilerServices.CallSite<T>.CreateCustomUpdateDelegate(MethodInfo): Unused 'UnconditionalSuppressMessageAttribute' for warning 'IL2060'. Consider removing the unused warning suppression. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-MacCatalyst]
    Fatal error in IL Linker
    Unhandled exception. System.InvalidOperationException: Sequence contains no elements
       at System.Linq.ThrowHelper.ThrowNoElementsException()
       at System.Linq.Enumerable.Last[TSource](IEnumerable`1 source)
       at Mono.Linker.MessageOrigin.ToString()
       at Mono.Linker.MessageContainer.ToMSBuildString()
       at Mono.Linker.MessageContainer.ToString()
       at Mono.Linker.ConsoleLogger.LogMessage(MessageContainer message)
       at Mono.Linker.LinkContext.LogMessage(MessageContainer message)
       at Mono.Linker.LinkContext.FlushCachedWarnings()
       at Mono.Linker.Driver.Run(ILogger customLogger)
       at Mono.Linker.Driver.Main(String[] args)
  /repos/tarball-linker/src/runtime/artifacts/source-build/self/src/eng/illink.targets(300,5): error MSB6006: "dotnet" exited with code 134. [/repos/tarball-linker/src/runtime/artifacts/source-build/self/src/src/libraries/System.Linq.Expressions/src/System.Linq.Expressions.csproj::TargetFramework=net7.0-MacCatalyst]

This was a recent regression caught by source-build. Here is the failing build (internal Microsoft link)

The previous linker version that was being used and passed was f09bacf.

Inspecting the code, it seems strange that Last is used here but the two places following that reference correspondingSequencePoint check for null. Should Last be changed to LastOrDefault?

This is blocking source-build for RC1.

Related to dotnet/source-build#2984

Activity

  1. MichaelSimons commented on Aug 12, 2022

    @MichaelSimons
    MemberAuthor
  2. vitek-karas commented on Aug 12, 2022

    @vitek-karas
    Member

    Looking into this

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions