Add additional ByteBufferTest tests #982

Open
jonpryor wants to merge 1 commit from jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests into master
jonpryor commented 2026-08-11 13:22:26 -05:00 (Migrated from github.com)

Context: https://github.com/dotnet/maui/issues/37782
Context: https://github.com/unoplatform/uno/issues/24036
Context: 608fac6f22 / dotnet/roslyn#958

I've been trying to get a project building for iOS+Native AOT, which invariably would error out in ilc:

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

After quite a bit of investigation, determined that Cecil was apparent cause of the crash, because multiple "involved parties" did not have the fix present in commit 608fac6f, resulting in a "failure cascade":

  1. <Csc/> task produces .pdb file

  2. Uno <EmbeddedResourceInjectorTask_v0/> task uses Cecil to update (1), introduces "Invalid compressed integer".

  3. illink -- which has its own copy of Cecil, from the dotnet/cecil fork -- consumes (2), turning "Invalid compressed integer" values into different values.

  4. ilc processes pdb produced from (3), fails with BadImageFormatException: Sequence point value is out of range.

A "full stack" fix involves updating Uno to use Mono.Cecil 0.11.6, which contains 608fac6f, and also updating illink to also contain the fix from 608fac6f. (PR does not yet exist.)

However, as part of this investigation, Claude cooked up a patch to dotnet/cecil along with unit test updates to ByteBufferTests. Of interest is that the suggested Claude fix for dotnet/cecil also causes the original ByteBufferTests test from 608fac6f to pass (yay), but not all of the new tests. Meanwhile, jbevain/cecil does pass all of the suggested new tests.

Record the new tests for posterity, and to reduce future drift between jbevain/cecil and dotnet/cecil.

Context: https://github.com/dotnet/maui/issues/37782 Context: https://github.com/unoplatform/uno/issues/24036 Context: 608fac6f22814e3eeb4609c80c0b5f08205e24ed / dotnet/roslyn#958 I've been trying to get a project building for iOS+Native AOT, which invariably would error out in `ilc`: 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 After quite a bit of investigation, determined that Cecil was apparent cause of the crash, because multiple "involved parties" did *not* have the fix present in commit 608fac6f, resulting in a "failure cascade": 1. `<Csc/>` task produces `.pdb` file 2. Uno `<EmbeddedResourceInjectorTask_v0/>` task uses Cecil to update (1), introduces "Invalid compressed integer". 3. `illink` -- which has its own copy of Cecil, from the dotnet/cecil fork -- consumes (2), turning "Invalid compressed integer" values into *different* values. 4. `ilc` processes `pdb` produced from (3), fails with `BadImageFormatException: Sequence point value is out of range`. A "full stack" fix involves updating Uno to use Mono.Cecil 0.11.6, which contains 608fac6f, *and also* updating `illink` to also contain the fix from 608fac6f. (PR does not yet exist.) However, as part of this investigation, Claude cooked up a patch to dotnet/cecil along with unit test updates to ByteBufferTests. Of interest is that the suggested Claude fix for dotnet/cecil also causes the original ByteBufferTests test from 608fac6f to pass (yay), but not all of the new tests. Meanwhile, jbevain/cecil *does* pass all of the suggested new tests. Record the new tests for posterity, and to reduce future drift between jbevain/cecil and dotnet/cecil.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests:jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git switch 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'master'
git merge --no-ff 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git switch 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git rebase 'master'
git switch 'master'
git merge --ff-only 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git switch 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git rebase 'master'
git switch 'master'
git merge --no-ff 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git switch 'master'
git merge --squash 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git switch 'master'
git merge --ff-only 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git switch 'master'
git merge 'jonpryor/dev/jonpryor/jonp-more-ByteBuffer-tests'
git push origin 'master'
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-jbevain/cecil!982
No description provided.