79483624

Date: 2025-03-04 12:04:02
Score: 1.5
Natty:
Report link

Without using @namespace in any .razor files, I got past this by modifying my MainPage.xaml code (in project with name "test_only") to include an extra namespace declaration "componentsNamespace".

It would appear that the x:Type Markup Extension syntax

<object property="{x:Type prefix:typeNameValue}" .../>

(as per this) doesn't like dot notation in the "typeNameValue". Also successfully tested with a project that has a dot-delimited longer name.

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
         xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
         xmlns:local="clr-namespace:test_only"
         xmlns:componentsNamespace="clr-namespace:test_only.Components"
         x:Class="test_only.MainPage">

<BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
    <BlazorWebView.RootComponents>
        <RootComponent Selector="#app" ComponentType="{x:Type componentsNamespace:Routes}" />
    </BlazorWebView.RootComponents>
</BlazorWebView>
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • User mentioned (1): @namespace
  • Low reputation (1):
Posted by: f_r