-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Bug]: WireUpControls throws exception in net8.0-android #3714
Comments
can you try
if it works then you're correct it's a resource issue with the new build chain. |
@dpvreony Thanks! Sorry for the late reply. I added
To use this setting, does ReactiveUI also need to have the same setting?
Or is there any other way? |
I am having the same issue with ReactiveUI version |
Hi, I will try to take a look at this at the weekend, I will be travelling back to the UK from Brazil tomorrow if I have any chance during the flight I will take a look then. |
So after some investigations it looks like there is a more widespread issue with this, for some reason the Resource returns no elements for net 8.0. I am trying to see if there is a different method of obtaining Resources with net 8. I will update on my findings and create a fix unless its a core bug with net 8 |
https://devblogs.microsoft.com/dotnet/android-resource-designer-dotnet-8/
|
<!-- Please be sure to read the [Contribute](https://github.com/reactiveui/reactiveui#contribute) section of the README --> **What kind of change does this PR introduce?** <!-- Bug fix, feature, docs update, ... --> Fix for #3714 **What is the current behavior?** <!-- You can also link to an open issue here. --> WireUpControls throws exception with .Net 8.0 Android **What is the new behavior?** <!-- If this is a feature change --> WireUpControls works with .Net 8.0 Android **What might this PR break?** none expected **Please check if the PR fulfills these requirements** - [ ] Tests for the changes have been added (for bug fixes / features) - [ ] Docs have been added / updated (for bug fixes / features) **Other information**:
This will be resolved in the release in the next hour, thank you for raising this issue and sorry we took so long to resolve it. |
@ChrisPulman Amazing!! |
@ChrisPulman Thank you for resolving this issue! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Describe the bug 🐞
When calling
ReactiveUI.ControlFetcherMixin.WireUpControls()
in a .NET 8 Android app (net8.0-android
), even though the correct resource ID is specified, aMissingFieldException
is thrown.Stacktrace:
Step to reproduce
8.0.100
)net8.0-android
project usingdotnet new android
command.ReactiveUI
version19.5.39
MainActivity.cs
and change it so that MainActivity inheritsReactiveUI.ReactiveActivity
.android:id
) to theTextView
inactivity_main.xml
and add a member toMainActivity.cs
to wire it up.WireUpControls()
afterSetContentView()
inOnCreate()
.MissingFieldException
is thrown fromWireUpControls()
.Reproduction repository
https://github.com/tommy10344/ReactiveUI-WireUpControls-Issue
Expected behavior
After launching the application, the TextView should be wired up correctly, and the initial screen should be displayed.
Build the same code with .NET 7 (
net7.0-android
), it works as expected. (Confirmed in thedotnet7
branch of the reproduction repository)Screenshots 🖼️
IDE
Visual Studio Code
Operating system
Android
Version
13
Device
Emulator
ReactiveUI Version
19.5.39
Additional information ℹ️
.NET 8 seems to have changed access to Android resources, is this issue related to this?
https://devblogs.microsoft.com/dotnet/android-resource-designer-dotnet-8/
Reading the implementation of
WireUpControls()
, it looks like it uses reflection to reference theResource.Id
class in the assembly of the application itself.https://github.com/reactiveui/ReactiveUI/blob/main/src/ReactiveUI/Platforms/android/ControlFetcherMixin.cs#L230
However, in .NET8, it seems that a new assembly called
_Microsoft.Android.Resource.Designer
is created and theResource.Id
class is generated there.I am guessing that this may be related to the problem.
(I'm not very familiar with .NET, so sorry if I'm wrong)
The text was updated successfully, but these errors were encountered: