-
Notifications
You must be signed in to change notification settings - Fork 57
Unable to parse generic types with generic type arguments #728
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
Comments
It looks like we are throwing the exception trying to parse generic types with generic types:
I will work on fixing our parser to support this. The only workaround I can think of is to remove the methods that are trying to use this type:
|
@jpobst Thank you very much for the fast analysis! Can you already provide a rough estimate when this issue is going to be fixed? |
jonpryor
pushed a commit
that referenced
this issue
Sep 25, 2020
Fixes: #728 Context: https://xamarin.github.io/bugzilla-archives/12/12468/bug.html#c1 In order to avoid CS0234 errors, we always write non-intrinsic types prefixed with `global::`. For example, instead of System.Collections.Generic.List<Java.Lang.Object> `generator` emits global::System.Collections.Generic.List<global::Java.Lang.Object> To do this, we have to parse a type into its component types so we can add `global::` to each part. However, our parsing algorithm struggles with generic types with multiple type arguments. Thus, this: System.Collections.Generic.IDictionary<System.Collections.Generic.IList<string>, Kotlin.Pair> loses the second template parameter, becoming: global::System.Collections.Generic.IDictionary<global::System.Collections.Generic.IList<string>> while this: System.Collections.Generic.IDictionary<System.Collections.Generic.IList<string>, System.Collections.Generic.IList<Kotlin.Pair>> throws an `ArgumentOutOfRangeException`, which is the cause of #728. Fix the `ArgumentOutOfRangeException` by introducing a new recursive parser that better understands generic types.
jonpryor
pushed a commit
to dotnet/android
that referenced
this issue
Oct 20, 2020
Fixes: dotnet/java-interop#461 Fixes: dotnet/java-interop#682 Fixes: dotnet/java-interop#717 Fixes: dotnet/java-interop#719 Fixes: dotnet/java-interop#728 Changes: dotnet/java-interop@ac914ce...b991bb8 * dotnet/java-interop@b991bb86: [generator] Revert change to use auto-properties in EventArgs classes (#736) * dotnet/java-interop@ee50d89b: Bump to xamarin/xamarin-android-tools/master@f2af06f2 (#733) * dotnet/java-interop@a0b895c1: [build] Suppress NuGet warnings (#730) * dotnet/java-interop@8b1b0507: [generator] Fix parsing of complex generic types (#729) * dotnet/java-interop@ee7afeed: [generator] Prevent generating duplicate EventArgs classes (#726) * dotnet/java-interop@1f21f38c: [generator] Use GC.KeepAlive for reference type method parameters. (#725) * dotnet/java-interop@5136ef98: [Xamarin.Android.Tools.Bytecode] Hide Kotlin nested types inside (#723) * dotnet/java-interop@53d60513: [jnimarshalmethod-gen] Fix registration on Windows (#721) * dotnet/java-interop@5a834d42: [jnimarshalmethod-gen] Avoid creating AppDomains (#720) * dotnet/java-interop@a76edb8c: [Xamarin.Android.Tools.ApiXmlAdjuster] Find app.android.IntentService (#718) * dotnet/java-interop@6cde0877: [Java.Interop] Emit a reference assembly for Java.Interop.dll (#716) * dotnet/java-interop@b858dc59: [generator] Provide line/col numbers for api.xml warnings (#715) * dotnet/java-interop@9be92a04: [ci] Don't kick off CI for documentation only changes. (#712) * dotnet/java-interop@03c22722: [jnimarshalmethod-gen] Fix type resolution crash (#706)
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Reproduction hosted at https://github.com/thisisthekap/repro-ArgumentOutOfRangeException.
I am not entirely sure if this is the right project to post this issue. Please just tell me if this one should be posted elsewhere (e.g. at https://github.com/xamarin/xamarin-android).
Repro steps:
The build fails, now search the build output for
System.ArgumentOutOfRangeException
.Exception shown in build output:
The text was updated successfully, but these errors were encountered: