8000 Payments link fails due to unregistered service · Issue #47 · ardalis/modulith · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Payments link fails due to unregistered service #47

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

Closed
ardalis opened this issue Sep 12, 2024 · 1 comment · Fixed by #50
Closed

Payments link fails due to unregistered service #47

ardalis opened this issue Sep 12, 2024 · 1 comment · Fixed by #50
Assignees

Comments

@ardalis
Copy link
Owner
ardalis commented Sep 12, 2024

Running through this script to set things up:
https://github.com/ardalis/modulith/blob/main/Test-UiWithDotnetCli.ps1

After launching the web app and navigating around, the Payments link fails and the console shows:

warn: Microsoft.AspNetCore.Components.Server.Circuits.RemoteRenderer[100]
      Unhandled exception rendering component: Cannot provide a value for property 'WeatherForecastService' on type 'eShop.Payments.UI.PaymentsComponent'. There is no registered service of type 'eShop.Payments.HttpModels.IWeatherForecastService'.
      System.InvalidOperationException: Cannot provide a value for property 'WeatherForecastService' on type 'eShop.Payments.UI.PaymentsComponent'. There is no registered service of type 'eShop.Payments.HttpModels.IWeatherForecastService'.
         at Microsoft.AspNetCore.Components.ComponentFactory.<>c__DisplayClass9_0.<CreatePropertyInjector>g__Initialize|1(IServiceProvider serviceProvider, IComponent component)
         at Microsoft.AspNetCore.Components.ComponentFactory.InstantiateComponent(IServiceProvider serviceProvider, Type componentType, IComponentRenderMode callerSpecifiedRenderMode, Nullable`1 parentComponentId)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.InstantiateChildComponentOnFrame(RenderTreeFrame[] frames, Int32 frameIndex, Int32 parentComponentId)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewComponentFrame(DiffContext& diffContext, Int32 frameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InitializeNewSubtree(DiffContext& diffContext, Int32 frameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.InsertNewFrame(DiffContext& diffContext, Int32 newFrameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForFramesWithSameSequence(DiffContext& diffContext, Int32 oldFrameIndex, Int32 newFrameIndex)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.AppendDiffEntriesForRange(DiffContext& diffContext, Int32 oldStartIndex, Int32 oldEndIndexExcl, Int32 newStartIndex, Int32 newEndIndexExcl)
         at Microsoft.AspNetCore.Components.RenderTree.RenderTreeDiffBuilder.ComputeDiff(Renderer renderer, RenderBatchBuilder batchBuilder, Int32 componentId, ArrayRange`1 oldTree, ArrayRange`1 newTree)
         at Microsoft.AspNetCore.Components.Rendering.ComponentState.RenderIntoBatch(RenderBatchBuilder batchBuilder, RenderFragment renderFragment, Exception& renderFragmentException)
         at Microsoft.AspNetCore.Components.RenderTree.Renderer.ProcessRenderQueue()
fail: Microsoft.AspNetCore.Components.Server.Circuits.CircuitHost[111]
      Unhandled exception in circuit 'dHHud4fE2MKuZoWjWf6uUBolpGzMCKPeGFBrN1wz5Nc'.
      System.InvalidOperationException: Cannot provide a value for property 'WeatherForecastService' on type 'eShop.Payments.UI.PaymentsComponent'. There is no registered service of type 'eShop.Payments.HttpModels.IWeatherForecastService'.
@david-acm david-acm self-assigned this Sep 18, 2024
david-acm added a commit that referenced this issue Sep 19, 2024
Exclude IWeatherForecastService from the internal project when the UI projects are present
@david-acm david-acm linked a pull request Sep 19, 2024 that will close this issue
@david-acm
Copy link
Collaborator
david-acm commented Sep 19, 2024

The issue was caused by a duplicated IWeatherForecast interface. The client-side service was mistakenly registered to the second, incorrect interface. As a result, at runtime, the correct interface lacked any registered implementations.

This led to an odd behavior: initially, the page appeared fine because the server-side rendering was correctly implemented. However, upon reload, the client-side rendering would fail due to the missing service registration for the correct interface.

I added an exclusion to the solution template to remove the duplicated interface.

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

Successfully merging a pull request may close this issue.

2 participants
0