You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From @MDThomsen on Wednesday, December 18, 2024 2:24:48 PM
I am working with a maui app that in some instances relies on getting values through reflection.
There is a specific case where a base class has a virtual property, which is then overridden in a parent class.
In the reproduction project there is a base page with: public virtual bool IsVisible => true;
and then a page that inherits from that base page, which then overrides the property as such: public override bool IsVisible => true;
When creating an instance of PropertyInfo on the overriden property with var visibleBindingPropertyInfo = GetType().GetTypeInfo().GetRuntimeProperty(nameof(IsVisible));
and then calling GetValue by if (visibleBindingPropertyInfo != null) isVisible = (bool)visibleBindingPropertyInfo.GetValue(this);
causes the iOS app to crash.
The crash occurs when the interpreter is disabled like so; <MtouchInterpreter>-all</MtouchInterpreter>
If the Interpreter is enabled, then it will not crash. However using the Interpreter is not an option in my case, as it downgrades the performance too much for a production build.
The crash started occurring after updating to VS 2022 with the following workload list:
Installed Workload Id Manifest Version Installation Source
---------------------------------------------------------------------
aspire 8.2.2/8.0.100 VS 17.11.35431.28
maui-windows 8.0.82/8.0.100 VS 17.11.35431.28
maccatalyst 18.0.8303/8.0.100 VS 17.11.35431.28
ios 18.0.8303/8.0.100 VS 17.11.35431.28
android 34.0.113/8.0.100 VS 17.11.35431.28
However on the previous installation of visual studio with the following workload list, it is working without crashing:
Installed Workload Id Manifest Version Installation Source
---------------------------------------------------------------------
maui-windows 8.0.40/8.0.100 VS 17.10.35013.160
maccatalyst 17.2.8053/8.0.100 VS 17.10.35013.160
ios 17.2.8053/8.0.100 VS 17.10.35013.160
android 34.0.95/8.0.100 VS 17.10.35013.160
I also noticed this ticket dotnet/runtime#96611 which mentions something similar, however that is older than the release of 8.0.40 in which it was working.
Steps to Reproduce
Run the reproduction project on a real iOS device (not simulator).
Issue moved from dotnet/maui#26707
From @MDThomsen on Wednesday, December 18, 2024 2:24:48 PM
I am working with a maui app that in some instances relies on getting values through reflection.
There is a specific case where a base class has a virtual property, which is then overridden in a parent class.
In the reproduction project there is a base page with:
public virtual bool IsVisible => true;
and then a page that inherits from that base page, which then overrides the property as such:
public override bool IsVisible => true;
When creating an instance of PropertyInfo on the overriden property with
var visibleBindingPropertyInfo = GetType().GetTypeInfo().GetRuntimeProperty(nameof(IsVisible));
and then calling
GetValue
byif (visibleBindingPropertyInfo != null) isVisible = (bool)visibleBindingPropertyInfo.GetValue(this);
causes the iOS app to crash.
The crash occurs when the interpreter is disabled like so;
<MtouchInterpreter>-all</MtouchInterpreter>
If the Interpreter is enabled, then it will not crash. However using the Interpreter is not an option in my case, as it downgrades the performance too much for a production build.
The crash started occurring after updating to VS 2022 with the following workload list:
However on the previous installation of visual studio with the following workload list, it is working without crashing:
I also noticed this ticket dotnet/runtime#96611 which mentions something similar, however that is older than the release of 8.0.40 in which it was working.
Steps to Reproduce
Link to public reproduction project repository
https://github.com/MDThomsen/BindingCrash.git
Version with bug
8.0.82 SR8.2
Is this a regression from previous behavior?
Yes, this used to work in .NET MAUI
Last version that worked well
8.0.40 SR5
Affected platforms
iOS
Affected platform versions
18.0.8303/8.0.100
Did you find any workaround?
No response
Relevant log output
The text was updated successfully, but these errors were encountered: