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

[Xamarin.Android.Tools.Bytecode] Allow null enclosing method - #479

Merged
jonpryor merged 1 commit into
dotnet:masterfrom
jonpryor:jonp-relax-enclosing-method-info
Aug 18, 2019
Merged

[Xamarin.Android.Tools.Bytecode] Allow null enclosing method#479
jonpryor merged 1 commit into
dotnet:masterfrom
jonpryor:jonp-relax-enclosing-method-info

Conversation

@jonpryor

Copy link
Copy Markdown
Contributor

Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2951424&view=ms.vss-test-web.build-test-results-tab&runId=7990780&resultId=100107&paneView=attachments

The attempt to bump the Java.Interop submodule within xamarin-android
hit a snag, as unit tests failed:

The "ClassParse" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Android.Tools.Bytecode.ClassFile.TryGetEnclosingMethodInfo (System.String& declaringClass, System.String& declaringMethod, System.String& declaringDescriptor)
at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.GetEnclosingMethod ()
at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.ToXElement ()
at Xamarin.Android.Tools.Bytecode.ClassPath+<>c.<ToXElement>b__36_3 (Xamarin.Android.Tools.Bytecode.ClassFile c)
at System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].MoveNext ()
at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)
at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)

The cause? The material-menu library has .class files which
have an EnclosingMethod attribute blob, but doesn't mention method
name information, only an enclosing type:

$ mono class-parse.exe com/balysv/material/drawable/menu/MaterialMenuDrawable\$5.class --dump
...
1: EnclosingMethod(Class(nameIndex=58 Name="com/balysv/material/drawable/menu/MaterialMenuDrawable"), )
# Behold! No method information!

Support generating an XML description of this type by adding
appropriate null checks around EnclosingMethodAttribute.

Context: dotnet/android#3504
Context: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=2951424&view=ms.vss-test-web.build-test-results-tab&runId=7990780&resultId=100107&paneView=attachments
The attempt to bump the Java.Interop submodule within xamarin-android
hit a snag, as unit tests failed:
The "ClassParse" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object
at Xamarin.Android.Tools.Bytecode.ClassFile.TryGetEnclosingMethodInfo (System.String& declaringClass, System.String& declaringMethod, System.String& declaringDescriptor)
at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.GetEnclosingMethod ()
at Xamarin.Android.Tools.Bytecode.XmlClassDeclarationBuilder.ToXElement ()
at Xamarin.Android.Tools.Bytecode.ClassPath+<>c.<ToXElement>b__36_3 (Xamarin.Android.Tools.Bytecode.ClassFile c)
at System.Linq.Enumerable+SelectIPartitionIterator`2[TSource,TResult].MoveNext ()
at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)
at System.Xml.Linq.XContainer.AddContentSkipNotify (System.Object content)
The cause? The [`material-menu`][0] library has `.class` files which
have an `EnclosingMethod` attribute blob, but doesn't mention method
name information, only an enclosing type:
$ mono class-parse.exe com/balysv/material/drawable/menu/MaterialMenuDrawable\$5.class --dump
...
1: EnclosingMethod(Class(nameIndex=58 Name="com/balysv/material/drawable/menu/MaterialMenuDrawable"), )
# Behold! No method information!
Support generating an XML description of this type by adding
appropriate `null` checks around `EnclosingMethodAttribute`.
[0]: https://repo.jfrog.org/artifactory/libs-release-bintray/com/balysv/material-menu/1.1.0/material-menu-1.1.0.aar
@jonpryor
jonpryor merged commit 7228af0 into dotnet:masterAug 18, 2019
@jonpryor
jonpryor deleted the jonp-relax-enclosing-method-info branch August 18, 2019 01:37
@github-actionsgithub-actionsBot locked and limited conversation to collaborators Apr 13, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@jonpryor