-
Notifications
You must be signed in to change notification settings - Fork 533
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
[net7] System.NotSupportedException: no Java peer type found #7736
Comments
@jonathanpeppers I did not validate that at runtime #7473 would not cause issues, but it definitely does... It's a blocker, and if someone knows of a workaround, I'm interested :) |
@jeromelaban have you looked into removing |
@jonathanpeppers Thanks! I've tried adding a |
Can you share an example of how you set |
Sure, it's: <ItemGroup>
<TrimmerRootDescriptor Include="Android\LinkerConfig.xml" />
</ItemGroup> then: <?xml version="1.0" encoding="utf-8" ?>
<linker>
<assembly fullname="Uno.UI"/>
<assembly fullname="Uno"/>
<assembly fullname="Uno.UI.Toolkit"/>
</linker> The file is properly used during the build:
The assemblies really are not linked as all types are preserved, but maybe the linker still does some modifications that are impacting the android tooling? |
Yes, many others could, though linking out Uno.UI is a canary for all the others ( |
Ok, I think I have narrowed it down to this line: The linker is inlining And so you get a different
I suspect a workaround might be to only target 64-bit via: I will play with linker settings and see if I can get it to not inline We also should look into the actual bug here, it seems like we could replicate this issue in a smaller test case. |
Thanks for the detailed analysis! I can confirm that |
I think we have seen this kind of issue before where using IntPtr.Size results in different assemblies. |
Trying to repro it here: main...jonathanpeppers:ArchitectureSpecificActivity I should be able to get further tomorrow. I think you need a |
I seem to remember a library which have a #if for different 32 vs 64 bit behaviour. Not sure if that was Uno or not... |
@jonathanpeppers yes it was uno its that |
This particular code in Uno is an extract of the Dictionary class, but we cannot have bitness variations at compile time like the runtime is able to do. Now, I could try working around this issue by using |
I think it just defines I don't think |
Indeed, it's forcefully defined at the top, the idea was to not diverge too much from the original implementation and use a runtime check to enable 64bits code paths. |
|
Good news, avoiding |
Great! I would still like to figure out what is going wrong here... It seems like there is a problem with typemaps and assemblies that are architecture-specific, but they seem to work fine in the simple case. |
I went further this morning, and tried two tests cases based on our .NET 7 branch: release/7.0.1xx...jonathanpeppers:Test7736 These still pass. So, I think we are back to inspecting the Uno template and see why it's going wrong there. |
For what it's worth I have tried this for my issue here: dotnet/android-libraries#686 (comment) and I no longer have the Mapsui crash. I don't use the UNO libraries. |
hmmm, it seems to be ok now... I ran a dotnet workload install maui and deleted obj and bin folders and rebuilt the release build. Not sure which had an effect. |
This should be fixed via 929e701 (main), c5a84b8 (net7), and the most recent comment. Closing. |
Android application type
Android for .NET (net6.0-android, etc.)
Affected platform version
7.0.102
Description
After the fix in #7473, while the build now passes, I'm getting this runtime exception:
Steps to Reproduce
dotnet new install Uno.ProjectTemplates.Dotnet
dotnet new unoapp -o testapp -f net7.0
cd testapp\testapp.Mobile
dotnet build -f net7.0-android -c Release
Did you find any workaround?
Setting the RuntimeIdentifier to a single architecture works around the issue:
But it is not a viable workaround as it does not allow for creating valid store packages.
Relevant log output
The text was updated successfully, but these errors were encountered: