maui
                                
                                 maui copied to clipboard
                                
                                    maui copied to clipboard
                            
                            
                            
                        Maui Blazor Publish Issue
Description
When using mudblazor in a .NET 7 Maui Blazor iOS app, the app does not work when published to .ipa for use in App Store or Ad Hoc. App runs fine when run in Debug or Release mode on Device. This only seems to occur when trying to run the published version. BlazorWebview control shows the standard "An unhandled error has occurred"
Steps to Reproduce
- Create New Maui Blazor App
- Add MudBalzor
- Add Controls to index.html
- Publish ios and sign Ad Hoc / App Store
- Install app
- Launch
Link to public reproduction project repository
https://github.com/QwertyMC/MauiBlazorTest
Version with bug
7.0 (current)
Last version that worked well
Unknown/Other
Affected platforms
iOS
Affected platform versions
iOS 16
Did you find any workaround?
No response
Relevant log output
Unable to set property 'Required' on object of type 'MudBlazor.MudTextField`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]'. 
The error was: Attempting to JIT compile method '(wrapper delegate-invoke) void <Module>:invoke_callvirt_void_MudTextField`1<string>_bool (MudBlazor.MudTextField`1<string>,bool)' while running in aot-only mode. 
See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
:    at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.<SetProperties>g__SetProperty|3_0(Object target, PropertySetter writer, String parameterName, Object value)
   at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& parameters, Object target)
   at Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView parameters)
   at MudBlazor.MudBaseInput`1[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].<>n__1(ParameterView parameters)
   at MudBlazor.MudBaseInput`1.<SetParametersAsync>d__177[[System.String, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].MoveNext()

I have the exact same issue, also with MudTextField and I don't have any clue on how to solve this.
It only fails when deployed through an .ipa file (but I don't seem to be able to catch the exception)
Any thoughts on this? I've spent quite a bit of time designing this app and not cannot seem to publish it to App Store. Any help would be appreciated! Thank You.
Thanks for contacting us. Can you try the suggestion here and see if that helps: https://github.com/dotnet/maui/issues/12537#issuecomment-1379131686?
@lambdageek what should customers do in these situations?
/cc @dalexsoto
@vargaz Is this related to https://github.com/dotnet/runtime/issues/83003 - from the error it sounds like this is also something about delegate invoke wrappers and callvirt.
On second thought, this might be due to PropertySetter not being AOT friendly https://github.com/dotnet/aspnetcore/blob/7c931425134d8cf54c82b29baba7ff277849f6bf/src/Components/Components/src/Reflection/PropertySetter.cs#L31-L36
I don't think creating delegates like this will work with AOT - is that right, @vargaz ?
Same issue as: https://github.com/dotnet/runtime/issues/78889
@vargaz How come it only happens in the app store? shouldn't Release builds deployed on device produce the same problem?
@mkArtakMSFTusing UseInterpreter True` does not help the situation.
@vargaz How come it only happens in the app store? shouldn't Release builds deployed on device produce the same problem?
No idea, but the underlying problem appears the same.
Closing as a dupe of dotnet/runtime#78889
@vargaz do you plan to patch this fix?
Its in our queue to fix.
@mkArtakMSFT What does not planned mean? There is no effort to resolve this issue?
Its a duplicate, the issue will be tracked in:
https://github.com/dotnet/runtime/issues/78889