Skip to content
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

Help with issue on iOS #332

Open
e808080 opened this issue Jul 26, 2024 · 5 comments
Open

Help with issue on iOS #332

e808080 opened this issue Jul 26, 2024 · 5 comments

Comments

@e808080
Copy link

e808080 commented Jul 26, 2024

We are using this library and it works great but now suddenly on iOS we get the following error:

TypeInitialization_Type, DefaultProxyCache`1
   at ProtoBuf.Grpc.Configuration.ClientFactory.DefaultClientFactory.CreateClient[IReceiversService](CallInvoker channel)
   at MyApp.App.MauiProgram.<>c__DisplayClass0_0.<CreateMauiApp>b__7(IServiceProvider services)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite , RuntimeResolverContext )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite , RuntimeResolverContext )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite , RuntimeResolverContext )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=8.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument)
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite , ServiceProviderEngineScope )
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(ServiceIdentifier serviceIdentifier)
   at System.Collections.Concurrent.ConcurrentDictionary`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceIdentifier, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[Microsoft.Extensions.DependencyInjection.ServiceProvider.ServiceAccessor, Microsoft.Extensions.DependencyInjection, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60]].GetOrAdd(ServiceIdentifier , Func`2 )
   at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(ServiceIdentifier , ServiceProviderEngineScope )
   at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope.GetService(Type )
   at Microsoft.AspNetCore.Components.ComponentFactory.<>c__DisplayClass9_0.<CreatePropertyInjector>g__Initialize|1(IServiceProvider serviceProvider, IComponent component)
   at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider , Type , IComponentRenderMode , Nullable`1 )
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame[] , Int32 , Int32 )
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& , Int32 )
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& , Int32 )
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& , Int32 )
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& , Int32 )
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& , Int32 )
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& , Int32 , Int32 , Int32 , Int32 )
   at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer , RenderBatchBuilder , Int32 , ArrayRange`1 , ArrayRange`1 )
   at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder , RenderFragment , Exception& )
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.RenderInExistingBatch(RenderQueueEntry )
   at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()

Anyone has any idea on what this means and how I can fix it? Really appreciate any help. This worked previously and the same code works great on Android and Windows so only on iOS we get this error. We are using .NET 8.0.303 and AOT.

@mgravell
Copy link
Member

Does "suddenly" here correspond to any update? Framework? Build tools? Library?

@e808080
Copy link
Author

e808080 commented Jul 26, 2024

Hi @mgravell thank you so much for the reply, really appreciate it because I'm totally stuck and been going crazy over this issue because I just cannot narrow down to what is wrong. I do not see that we introduced anything new rather than some .NET nuget packages updates from 8.0.6 to 8.0.7 and Microsoft.AspNetCore.Components.WebView.Maui and Microsoft.Maui.Controls to 8.0.70 instead of 8.0.40 but I have tried reverting those upgrades as well and still getting the error above. I have been removing chunks of code step-by-step to narrow down what is wrong and so far only found that yeah if I essentially remove my gRPC services then it works but nothing else. I also don't understand what the error message actually mean. I tried removing that particular service but then it complains on my other gRPC service instead.

And worse is that it works perfect in the Browser, Android and Windows, the gRPC code is unchanged so I do not see that we made some conceptual mistake in the code. But rather some iOS issue because its only in iOS we get this error.

@mgravell
Copy link
Member

is it possible to catch the exception at all, and access the .InnerExcception, which is going to hold the real problem? I don't have any iOS tools / hardware here, so very hard for me to try to debug

@e808080
Copy link
Author

e808080 commented Jul 26, 2024

Where would I introduce the try-catch though? In .razor somewhere I suppose? The error log above I have extracted from the web console. Not entirely sure how it works but I suppose this error gets thrown in the "at" inject statement of the .razor page. It seems like if I load any other page that doesn't have the gRPC service injected it does work to load that page.

@e808080
Copy link
Author

e808080 commented Jul 27, 2024

After many hours of trying out different things and looking through the logs I noticed that the MAUI package microsoft.net.sdk.ios had been updated some weeks ago. There seems to be a bug in it (version 17.2.8078) that causes this issue. Related issue here: xamarin/xamarin-macios#20910

When I specified exact version the same way they did it now works again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants