-
Notifications
You must be signed in to change notification settings - Fork 564
[msbuild] cleanup intermediate API dump for post-metadata-fixup state. #91
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Should this also have an |
Contributor
Author
|
I thought about that too but so far it can be bumped next time when something really needs it (this change itself should be optional). |
radekdoulik
added a commit
to radekdoulik/xamarin-android
that referenced
this pull request
Sep 29, 2016
- so that following tasks will not run into stream sharing
(violation) issues as in #44529
- bump Java.Interop to get:
commit 40b75e9
Author: Radek Doulik <radekdoulik@users.noreply.github.com>
Date: Wed Sep 28 21:25:26 2016 +0200
[Java.Interop.Tools.JavaCallableWrappers] Add TypeNameMapGenerator.Dispose() (dotnet#91)
jonpryor
pushed a commit
that referenced
this pull request
Sep 29, 2016
…242) - so that following tasks will not run into stream sharing (violation) issues as in #44529 - bump Java.Interop to get: commit 40b75e9 Author: Radek Doulik <radekdoulik@users.noreply.github.com> Date: Wed Sep 28 21:25:26 2016 +0200 [Java.Interop.Tools.JavaCallableWrappers] Add TypeNameMapGenerator.Dispose() (#91)
radical
pushed a commit
that referenced
this pull request
May 8, 2018
…spose() (#91) When the [`<GenerateJavaStubs/>` task in `xamarin-android`][0] uses `Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator` and calls `TypeNameMapGenerator.WriteJavaToManaged()`, a `NullReferenceException` is thrown: Error executing task GenerateJavaStubs: System.NullReferenceException: Object reference not set to an instance of an object at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference, Mono.Cecil.ReaderParameters parameters) [0x00028] in <3f2ebd7ea1fd47bd954f448c66f03323>:0 at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference reference) [0x00001] in <3f2ebd7ea1fd47bd954f448c66f03323>:0 at Mono.Cecil.MetadataResolver.Resolve (Mono.Cecil.TypeReference type) [0x0004e] in <4f9b8c8361824d0ca9025449919e12be>:0 at Mono.Cecil.ModuleDefinition.Resolve (Mono.Cecil.TypeReference type) [0x00007] in <4f9b8c8361824d0ca9025449919e12be>:0 at Mono.Cecil.TypeReference.Resolve () [0x00014] in <4f9b8c8361824d0ca9025449919e12be>:0 at Java.Interop.Tools.Cecil.TypeDefinitionRocks.GetBaseType (Mono.Cecil.TypeDefinition type) [0x00014] in <3f2ebd7ea1fd47bd954f448c66f03323>:0 at Java.Interop.Tools.Cecil.TypeDefinitionRocks+<GetTypeAndBaseTypes>c__Iterator0.MoveNext () [0x00048] in <3f2ebd7ea1fd47bd954f448c66f03323>:0 at System.Linq.Enumerable.Any[TSource] (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] predicate) [0x00048] in <51a1d86c1edf494cacaba8bbf8d1334e>:0 at Java.Interop.Tools.Cecil.TypeDefinitionRocks.ImplementsInterface (Mono.Cecil.TypeDefinition type, System.String interfaceName) [0x00014] in <3f2ebd7ea1fd47bd954f448c66f03323>:0 at Java.Interop.Tools.TypeNameMappings.JniType.ToJniName (Mono.Cecil.TypeDefinition type, Java.Interop.ExportParameterKind exportKind) [0x00049] in <3076bd81225243d6b1a7e6e2e66cb5f7>:0 at Java.Interop.Tools.TypeNameMappings.JniType.ToJniName (Mono.Cecil.TypeDefinition type) [0x00001] in <3076bd81225243d6b1a7e6e2e66cb5f7>:0 at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.GetTypeMapping (System.Func`2[T,TResult] skipType, System.Func`2[T,TResult] key, System.Func`2[T,TResult] value) [0x00047] in <3076bd81225243d6b1a7e6e2e66cb5f7>:0 at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator.WriteJavaToManaged (System.IO.Stream output) [0x00012] in <3076bd81225243d6b1a7e6e2e66cb5f7>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.UpdateWhenChanged (System.String path, System.Action`1[T] generator) [0x00014] in <d1b286cda0c74ed8bdaf1b21993bd410>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings (System.Collections.Generic.List`1[T] types) [0x00078] in <d1b286cda0c74ed8bdaf1b21993bd410>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.Run (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x00153] in <d1b286cda0c74ed8bdaf1b21993bd410>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.Execute () [0x001f2] in <d1b286cda0c74ed8bdaf1b21993bd410>:0 The underlying problem is that because the `TypeNameMapGenerator(IEnumerable<string>, Action<string, string>)` constructor disposes of the intermediate `DirectoryAssemblyResolver` isntance [^1], when e.g. `TypeNameMapGenerator.WriteJavaToManaged()` is later called, `DirectoryAssemblyResolver.Resolve()` will implicitly be called (because `DirectoryAssemblyResolver.Load()` sets `ReaderParameters.AssemblyResolver` to `this`), which attempts to access `DirectoryAssemblyResolver.cache`, which is `null`, resulting in the aforementioned `NullReferenceException`. To fix this, update `TypeNameMapGenerator` to: 1. Hold the `DirectoryAssemblyResolver` as a member, instead of retaining it as a local variable 2. Implement `IDisposable` 3. Have `TypeNameMapGenerator.Dispose()` dispose of the `DirectoryAssemblyResolver` instance, if present. [0]: https://github.com/xamarin/xamarin-android/blob/16d65fa/src/Xamarin.Android.Build.Tasks/Tasks/GenerateJavaStubs.cs#L267-L274 [^1]: `Dispose()` location: at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Dispose (System.Boolean disposing) [0x00000] in <3f2ebd7ea1fd47bd954f448c66f03323>:0 at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Dispose () [0x00000] in <3f2ebd7ea1fd47bd954f448c66f03323>:0 at Java.Interop.Tools.JavaCallableWrappers.TypeNameMapGenerator..ctor (System.Collections.Generic.IEnumerable`1[T] assemblies, System.Action`2[T1,T2] logMessage) [0x00000] in <3076bd81225243d6b1a7e6e2e66cb5f7>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.WriteTypeMappings (System.Collections.Generic.List`1[T] types) [0x00000] in <d1b286cda0c74ed8bdaf1b21993bd410>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.Run (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x00000] in <d1b286cda0c74ed8bdaf1b21993bd410>:0 at Xamarin.Android.Tasks.GenerateJavaStubs.Execute () [0x00000] in <d1b286cda0c74ed8bdaf1b21993bd410>:0
jonpryor
added a commit
to jonpryor/xamarin-android
that referenced
this pull request
Oct 8, 2020
Changes: dotnet/android-tools@a6a23bb...1878e43 * dotnet/android-tools@1878e43: [Xamarin.Android.Tools.AndroidSdk] Error & Warning Localization (dotnet#96) * dotnet/android-tools@f2af06f: [Xamarin.Android.Tools.AndroidSdk] Fix a few nullability warnings (dotnet#97) * dotnet/android-tools@5718cd2: Fix sort ordering for ndk-bundle, add macOS support (dotnet#91) * dotnet/android-tools@8e63795: [Xamarin.Android.Tools.AndroidSdk] Add API-29, API-30 to KnownVersions (dotnet#89)
jonpryor
added a commit
that referenced
this pull request
Oct 12, 2020
Changes: dotnet/android-tools@a6a23bb...1878e43 * dotnet/android-tools@1878e43: [Xamarin.Android.Tools.AndroidSdk] Error & Warning Localization (#96) * dotnet/android-tools@f2af06f: [Xamarin.Android.Tools.AndroidSdk] Fix a few nullability warnings (#97) * dotnet/android-tools@5718cd2: Fix sort ordering for ndk-bundle, add macOS support (#91) * dotnet/android-tools@8e63795: [Xamarin.Android.Tools.AndroidSdk] Add API-29, API-30 to KnownVersions (#89)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Seealso dotnet/java-interop#51