Open emanuelpaul opened 1 year ago
This error is quite strange... as it seems its the Blazor framework itself that has no access to these Parameters... kinda like if they were trimmed... (We had a similar problem recently)
I can notice that both properties you're mentioning happen to be virtual.
Now I'm pretty sure a whole lot more should be breaking as there's nothing special about Mode
in relation to other existing Parameter
and other enums except that this one is Virtual.
@stsrki maybe we can try a different approach other then virtual? An internal getter/setter that we override ourselves?
Oh and as a reminder they're virtual because of a specific override for AntDesign
it seems.
Could we do a test run with a test release with @emanuelpaul where we make these regular instead?
And any of you think we should report this somewhere? I'm not even sure where... Xamarin.iOS
?
Another thing, if you would be some kind @emanuelpaul
If you had the time, you could test making a TestComponent
with virtual Parameters, see if it also breaks?
A long time ago, sometime in 2019, I reported an issue to the .NET team regarding the virtual parameter properties. If I remember correctly, the problem should be long fixed by now. Maybe something is different for MAUI runtimes.
@David-Moreira We could try to add an internal, eg. virtual bool VisibleInternal
that would be used instead. It's an option. But I would rather not if possible.
Alright, Let's wait and see if @emanuelpaul can do us the favor of testing virtual
on his end.
Because on ios native AOT is required, when publishing in release mode a maui project trimming is used. This cannot be turned off for release builds in maui for ios at least.
Trimming has limitations especially when reflection is used. This might cause the issue.
There are several was mitigate this problem described here
Sorry for late response.
Because on ios native AOT is required, when publishing in release mode a maui project trimming is used. This cannot be turned off for release builds in maui for ios at least.
Trimming has limitations especially when reflection is used. This might cause the issue.
There are several was mitigate this problem described here
Sorry for late response.
Right we know as much... But we are not using reflection ourselves. Blazor might use it to set parameters but there might be something specific to virtual that we are missing.
Can you run the test we ask on your ios, pls?
Is there a package preview version that I can use ?
@emanuelpaul I mean this:
Since we suspect it might just be virtual Parameters that are being trimmed or there's something off about them.
Just did the test. I updated the counter component to use a virtual parameter and used it. The same error seems to occur. Source code
Unable to set property 'StartCount' on object of type 'BlazoriseMaui.Pages.Counter'. The error was: Attempting to JIT compile method '(wrapper delegate-invoke) void <Module>:invoke_callvirt_void_Counter_int (BlazoriseMaui.Pages.Counter,int)' 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 , PropertySetter , String , Object )
at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& , Object )
at Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView parameters)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView )
Right and maybe it should work. We should report this. Would you like to report @emanuelpaul ? Maybe you can do it over here : https://github.com/dotnet/aspnetcore/issues and then they redirect if its in the wrong repo.
Can you try this as a workaround on your Counter
? This might be enough to circumvent the problem.
public override Task SetParametersAsync( ParameterView parameters )
{
foreach ( var parameter in parameters )
{
switch ( parameter.Name )
{
case nameof( StartCount ):
StartCount = (int)parameter.Value;
break;
default:
throw new ArgumentException( $"Unknown parameter: {parameter.Name}" );
}
}
return base.SetParametersAsync( ParameterView.Empty );
}
This is an automated message reminding that this issue is expecting the author's answer.
Reminder to retest with dotnet 8 preview as requested by dotnet team.
Hello @emanuelpaul can you retry this with dotnet 8? We've released v1.3 with dotnet 8 support (preview). The dotnet team asked if we could test this.
Hello @emanuelpaul can you retry this with dotnet 8? We've released v1.3 with dotnet 8 support (preview). The dotnet team asked if we could test this.
I'll try to do it this weekend
Hello @emanuelpaul can you retry this with dotnet 8? We've released v1.3 with dotnet 8 support (preview). The dotnet team asked if we could test this.
I'll try to do it this weekend
Appreciated.
Hello @emanuelpaul Sorry to keep bothering you with this. :) Friendly reminder, If you could please do us the favor of testing this, it would very much be appreciated.
Hello, sorry for late response. It doesn't seems to work and now I'm unable to see the error using safari dev tools.
I used sdk 8.0.100-preview.7.23376.3. Code is on branch bar-bug-net8
Hello @emanuelpaul Thanks for the help. Just to be sure, this is tested with a real IPhone device as you've told us in the bug report?
This does not happen on the emulator. Right?
It doesn't ssems to work on simulator or on the iphone.
I created another branch button-bug-net8-android
where I just added a button to see if it works. I tested it using an android emulator.
It doesn't work.
I just upgraded the .net version to 8 and updated the packages to the latest version, Maybe I need to do something else I haven't had the time use use .net 8 preview until now.
When I click on the button I can see the following error is generated:
[chromium] [INFO:CONSOLE(1)] "Uncaught Error: No interop methods are registered for renderer 0", source: https://0.0.0.0/_framework/blazor.webview.js (1)```
It doesn't ssems to work on simulator or on the iphone. I created another branch
button-bug-net8-android
where I just added a button to see if it works. I tested it using an android emulator. It doesn't work. I just upgraded the .net version to 8 and updated the packages to the latest version, Maybe I need to do something else I haven't had the time use use .net 8 preview until now. When I click on the button I can see the following error is generated:[chromium] [INFO:CONSOLE(1)] "Uncaught Error: No interop methods are registered for renderer 0", source: https://0.0.0.0/_framework/blazor.webview.js (1)```
That does not seem like the same error though
It doesn't ssems to work on simulator or on the iphone. I created another branch
button-bug-net8-android
where I just added a button to see if it works. I tested it using an android emulator. It doesn't work. I just upgraded the .net version to 8 and updated the packages to the latest version, Maybe I need to do something else I haven't had the time use use .net 8 preview until now. When I click on the button I can see the following error is generated:[chromium] [INFO:CONSOLE(1)] "Uncaught Error: No interop methods are registered for renderer 0", source: https://0.0.0.0/_framework/blazor.webview.js (1)```
That does not seem like the same error though
yeah it might be something related to .net 8. The code from the android branch can be tested easier, the only thing needed is visual studio with the maui workload.
What is the status of this error? Is it safe to close the ticket?
I have no idea, since we are not capable of testing under the same conditions. @emanuelpaul do you still find difficulties with this?
If I may give some guidance, since Trimming / AOT isn't always 100% compatible, you could try disabling these features when compiling for release: Here's a snippet for Android release, modify it accordingly for iOS
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-android|AnyCPU'">
<AndroidPackageFormat>apk</AndroidPackageFormat>
<RunAOTCompilation>false</RunAOTCompilation>
<EnableLLVM>false</EnableLLVM>
<PublishTrimmed>false</PublishTrimmed>
</PropertyGroup>
Describe the bug Bar component doesn't work on dotnet maui blazor on iPhones in release configuration when using
Mode
compoenent parameter, but it works on iOS simulators and on iPhones using Debug configuration. Tested ondotnet workloads: Installed Workload Ids Manifest Version Installation Source
wasm-tools 6.0.9/6.0.400 SDK 6.0.400 macos 12.3.454/6.0.400 SDK 6.0.400 maui-maccatalyst 6.0.540/6.0.400 SDK 6.0.400 maui-ios 6.0.540/6.0.400 SDK 6.0.400 maui-android 6.0.540/6.0.400 SDK 6.0.400
It works fine on simulators:
It doesn't work on real iphone devices. I tested on:
Exception that occurs:
To Reproduce Steps to reproduce the behavior: Steps to reproduce the behavior:
bar-bug
dotnet build -t:Run -f net6.0-ios -p:_DeviceName={replace_with_your_iphone_identifier} -r ios-arm64 -c Release
Expected behavior Bar shouldn't trigger an exception when setting the
Mode
parameter.Screenshots
Additional context Exception details: Unable to set property 'Mode' on object of type 'Blazorise.Bar'. The error was: Attempting to JIT compile method '(wrapper delegate-invoke) void:invoke_callvirt_void_Bar_BarMode (Blazorise.Bar,Blazorise.BarMode)' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.g__SetProperty|3_0(Object , PropertySetter , String , Object )
at Microsoft.AspNetCore.Components.Reflection.ComponentProperties.SetProperties(ParameterView& , Object )
at Microsoft.AspNetCore.Components.ComponentBase.SetParametersAsync(ParameterView parameters)
at Blazorise.BaseComponent.SetParametersAsync(ParameterView parameters)
at Microsoft.AspNetCore.Components.Rendering.ComponentState.SupplyCombinedParameters(ParameterView )
Is there any workaround for setting
Mode=BarMode.VerticalInline
andVisible=false
? Maybe using attributes ?