Skip to content

chore: use Mono.Cecil 0.11.6 (backport #24050) - #25627

Merged
agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24050
Oct 30, 2026
Merged

agneszitte merged 1 commit into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-24050

Conversation

@mergify

@mergify mergify Bot commented Oct 21, 2026

Copy link
Copy Markdown
Contributor

Context: #23966
Context: dotnet/macios#26428
Context: #24036
Context: dotnet/cecil#504
Context: jbevain/cecil#982
Context: jbevain/cecil@0.11.4...0.11.6
Context: jbevain/cecil@0.10.1...0.11.6

In The Beginning™ was a simple idea: why don't we have an iOS+Native AOT test stage? Thus began #23966, which promptly fell over, caught on fire, and sank into the swamp.

There are two issues with #23966:

  1. CI was unhappy; it errors out with

    …/Xamarin.Shared.targets(2073,3): error : No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com.
    

    Not sure what's happening there. It doesn't happen locally…

  2. It couldn't build locally either!

The initial attempt to build locally would fail in ilc:

# note: using changes from #23966
% TFM=net11.0-ios \
  NAOT=1 \
  BUILD_SOURCESDIRECTORY=`pwd` \
  BUILD_ARTIFACTSTAGINGDIRECTORY=`pwd`/artifacts \
  sh build/test-scripts/skia-ios-uitest-build.sh
…
    …/unoplatform/uno/src/SourceGenerators/Uno.UI.Tasks/Content/Uno.UI.Tasks.targets(487,3): warning Failed to resolve assembly `JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325`: Failed to resolve assembly: 'JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325'
    EXEC : error Sequence point value is out of range.
    $HOME/.nuget/packages/microsoft.dotnet.ilcompiler/11.0.0-preview.6.26359.118/build/Microsoft.NETCore.Native.targets(359,5): error MSB3073: The command ""$HOME/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/11.0.0-preview.6.26359.118/tools/ilc" @"obj/Release/net11.0-ios/ios-arm64/native/SamplesApp.ilc.rsp"" exited with code 1.

Thus began a fair bit of investigation, some of which is mentioned in #24036 and dotnet/cecil#504.

What happened was a "failure cascade":

  1. The <Csc/> task produced a .pdb file.

  2. Uno's <EmbeddedResourceInjectorTask_v0/> task would use Cecil to process the assembly and .pdb file from (1). Uno was using, at most, Mono.Cecil 0.11.4, which had a bug around the encoding of "compressed" integers within .pdb files.

    (This is later fixed in Add additional ByteBufferTest tests jbevain/cecil#982, and released as part of Mono.Cecil 0.11.6.)

    The updated .pdb file would contain "Invalid compressed integer" values.

  3. Later, illink would run, which has it's own separate copy of Mono.Cecil -- from dotnet/cecil -- which would also update the .pdb files from (2). When illink ran, any "Invalid compressed integer" values would be further corrupted.

  4. Later still, when ilc runs, it would process the .pdb files produced by (3), and at this point instead of "silently corrupting" data, it would error out entirely:

    Error: Sequence point value is out of range.
    System.BadImageFormatException: Sequence point value is out of range.
       at System.Reflection.Throw.SequencePointValueOutOfRange() in /_/src/runtime/src/libraries/System.Reflection.Metadata/src/System/Reflection/Throw.cs:line 239
       at System.Reflection.Metadata.SequencePointCollection.Enumerator.MoveNext() in /_/src/runtime/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/SequencePointCollection.cs:line 86
       at Internal.TypeSystem.Ecma.PortablePdbSymbolReader.<GetSequencePointsForMethod>d__10.MoveNext() in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs:line 147
       at ILCompiler.Logging.MessageOrigin..ctor(MethodIL, Int32) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageOrigin.cs:line 65
    

(Failure cascades are fun!)

Part of the fix here is to update Uno to use Mono.Cecil 0.11.6, which contains the fix for reading and writing "compressed" integers in .pdb files. That is done here.

Additionally, I found it incredibly helpful in debugging all of this to have "before" and "after" versions of the files processed by <EmbeddedResourceInjectorTask_v0/>. (For too long, I thought that (3) was caused by a Roslyn bug, as I didn't see (2)!)

Update the <EmbeddedResourceInjectorTask_v0/> task so that it preseves the original assembly and .pdb files to have a .bk-EmbeddedResourceInjector extension, e.g.
SamplesApp.dll.bk-EmbeddedResourceInjector and
SamplesApp.pdb.bk-EmbeddedResourceInjector.

All of this will not fix #23966, but is a partial prerequisite. A full fix will require dotnet/cecil#504 to be merged and released, illink updated to use dotnet/cecil#504, and then there's dotnet/macios#26428, in which clang++ crashes when trying to link everything even if we get past the whole .pdb mess.

(Aside: the .pdb mess can be avoided by NOT USING .pdb FILES, e.g. buil with -p:DebugType=none. However, who wants to do that?)

…which still leaves the original "how do we get this building on CI" question…

Baby steps!

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

PR Checklist ✅


This is an automatic backport of pull request #24050 done by [Mergify](https://mergify.com).

Fixes: #24036

Context: #23966
Context: dotnet/macios#26428
Context: dotnet/cecil#504
Context: jbevain/cecil#982
Context: jbevain/cecil@0.11.4...0.11.6
Context: jbevain/cecil@0.10.1...0.11.6

In The Beginning™ was a simple idea: why don't we have an
iOS+Native AOT test stage?  Thus began #23966, which promptly fell
over, caught on fire, and sank into the swamp.

There are two issues with #23966:

 1. CI was unhappy; it errors out with

        …/Xamarin.Shared.targets(2073,3): error : No valid iOS code signing keys found in keychain. You need to request a codesigning certificate from https://developer.apple.com.

    Not sure what's happening there.  It doesn't happen locally…

 2. It couldn't build locally either!

The initial attempt to build locally would fail in `ilc`:

	# note: using changes from #23966
	% TFM=net11.0-ios \
	  NAOT=1 \
	  BUILD_SOURCESDIRECTORY=`pwd` \
	  BUILD_ARTIFACTSTAGINGDIRECTORY=`pwd`/artifacts \
	  sh build/test-scripts/skia-ios-uitest-build.sh
	…
	    …/unoplatform/uno/src/SourceGenerators/Uno.UI.Tasks/Content/Uno.UI.Tasks.targets(487,3): warning Failed to resolve assembly `JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325`: Failed to resolve assembly: 'JetBrains.Annotations, Version=4242.42.42.42, Culture=neutral, PublicKeyToken=1010a0d8d6380325'
	    EXEC : error Sequence point value is out of range.
	    $HOME/.nuget/packages/microsoft.dotnet.ilcompiler/11.0.0-preview.6.26359.118/build/Microsoft.NETCore.Native.targets(359,5): error MSB3073: The command ""$HOME/.nuget/packages/runtime.osx-arm64.microsoft.dotnet.ilcompiler/11.0.0-preview.6.26359.118/tools/ilc" @"obj/Release/net11.0-ios/ios-arm64/native/SamplesApp.ilc.rsp"" exited with code 1.

Thus began a fair bit of investigation, some of which is mentioned
in #24036 and dotnet/cecil#504.

What happened was a "failure cascade":

 1. The `<Csc/>` task produced a `.pdb` file.

 2. Uno's `<EmbeddedResourceInjectorTask_v0/>` task would use Cecil
    to process the assembly and `.pdb` file from (1).
    Uno was using, at most, Mono.Cecil 0.11.4, which had a bug around
    the encoding of "compressed" integers within `.pdb` files.

    (This is later fixed in jbevain/cecil#982, and released as part
    of Mono.Cecil 0.11.6.)

    The updated `.pdb` file would contain "Invalid compressed integer"
    values.

 3. Later, `illink` would run, which has it's own separate copy of
    Mono.Cecil -- from dotnet/cecil -- which would *also* update the
    `.pdb` files from (2).  When `illink` ran, any "Invalid compressed
    integer" values would be further corrupted.

 4. Later still, when `ilc` runs, it would process the `.pdb` files
    produced by (3), and at this point instead of "silently corrupting"
    data, it would error out entirely:

        Error: Sequence point value is out of range.
        System.BadImageFormatException: Sequence point value is out of range.
           at System.Reflection.Throw.SequencePointValueOutOfRange() in /_/src/runtime/src/libraries/System.Reflection.Metadata/src/System/Reflection/Throw.cs:line 239
           at System.Reflection.Metadata.SequencePointCollection.Enumerator.MoveNext() in /_/src/runtime/src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/PortablePdb/SequencePointCollection.cs:line 86
           at Internal.TypeSystem.Ecma.PortablePdbSymbolReader.<GetSequencePointsForMethod>d__10.MoveNext() in /_/src/runtime/src/coreclr/tools/Common/TypeSystem/Ecma/SymbolReader/PortablePdbSymbolReader.cs:line 147
           at ILCompiler.Logging.MessageOrigin..ctor(MethodIL, Int32) in /_/src/runtime/src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/Logging/MessageOrigin.cs:line 65

(Failure cascades are fun!)

*Part* of the fix here is to update Uno to use Mono.Cecil 0.11.6,
which contains the fix for reading and writing "compressed" integers
in `.pdb` files.  That is done here.

Updating Cecil will *not* fix #23966, but is a partial prerequisite.
A full fix will require dotnet/cecil#504 to be merged and released,
(currently merged), `illink` updated to use dotnet/cecil#504, and
*then* there's dotnet/macios#26428, in which `clang++` crashes when
trying to link everything even if we get past the whole `.pdb` mess
(which reportedly is fixed in the not-yet-released .NET 11 RC1).

(Aside: the `.pdb` mess can be avoided by NOT USING `.pdb` FILES,
e.g. buil with `-p:DebugType=none`.  However, who wants to do that?)

…which still leaves the original "how do we get this building on CI"
question…

Baby steps!

(cherry picked from commit 947bda0)
@github-actions github-actions Bot added the area/code-generation Categorizes an issue or PR as relevant to code generation label Oct 21, 2026
@mergify mergify Bot mentioned this pull request Oct 21, 2026
5 tasks
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@unodevops

Copy link
Copy Markdown
Contributor

⚠️⚠️ The build 240683 has failed on Uno.UI - CI.

@agneszitte
agneszitte merged commit 00f4ae2 into release/stable/6.7 Oct 30, 2026
62 of 65 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-24050 branch October 30, 2026 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/code-generation Categorizes an issue or PR as relevant to code generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6.7 desktop apps break under the debugger: "The field is invalid for initializing array or span"

4 participants