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

.NET 8.0.203 Doesnt compile non .xaml files to the xml namespace "clr-namespace" #21299

Closed
mrajkovicpta opened this issue Mar 19, 2024 · 4 comments
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 s/needs-info Issue needs more info from the author t/bug Something isn't working

Comments

@mrajkovicpta
Copy link

Description

When compiling any project in blazor hybrid with the default setup will fail with the error:

1>MainPage.xaml(11,84): XamlC error XFC0000: Cannot resolve type "[ProjectNamespace]:Routes".

The file will look like the following

<?xml version="1.0" encoding="utf-8"?>

<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             xmlns:local="clr-namespace:[ProjectNamespace]"
             x:Class="IFI.QRScanner.MainPage"
             BackgroundColor="{DynamicResource PageBackgroundColor}">

        <BlazorWebView x:Name="blazorWebView" HostPage="wwwroot/index.html">
            <BlazorWebView.RootComponents>
			<RootComponent Selector="#app" ComponentType="{x:Type local:Routes}" />
            </BlazorWebView.RootComponents>
        </BlazorWebView>    
</ContentPage>

despite the code completion finding all symbols in the [ProjectNamespace] namespace, when compiling these wont be included for some reason.
Changing local:Routes to any xaml file will allow it to compile but as the type isnt a blazor page inside a blazor web view the app will load with nothing displayed and an exception.

Compiling with the new sdk also gives this warning which is not displayed when compiling with earlier versions but it could just be compiler noise

1>CSC : warning CS9057: The analyzer assembly 'C:\Program Files\dotnet\sdk\8.0.203\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.CodeAnalysis.Razor.Compiler.SourceGenerators.dll' references version '4.9.0.0' of the compiler, which is newer than the currently running version '4.8.0.0'.

Last working version to my knowledge

  • .Net 8.0.101 sdk
  • .net 8.0.1 runtime
  • Visual studio version is irrelevant

Steps to Reproduce

1, Create new blazor hybrid app via dotnet new maui-blazor
2. Attempt to run

Link to public reproduction project repository

No response

Version with bug

8.0.3 GA

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

Unknown/Other

Affected platforms

Windows

Affected platform versions

Not applicable

Did you find any workaround?

Reverting sdk to 8.101 (a later one might work but I have not tried)

Relevant log output

No response

@mrajkovicpta mrajkovicpta added the t/bug Something isn't working label Mar 19, 2024
@PureWeen
Copy link
Member

Can you test with the latest nightly build?
https://github.com/dotnet/maui/wiki/Nightly-Builds

@PureWeen PureWeen added area-xaml XAML, CSS, Triggers, Behaviors s/needs-info Issue needs more info from the author labels Mar 19, 2024
Copy link
Contributor

Hi @mrajkovicpta. We have added the "s/needs-info" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

@PureWeen
Copy link
Member

Duplicate of #21170

@PureWeen PureWeen marked this as a duplicate of #21170 Mar 19, 2024
@mrajkovicpta
Copy link
Author

Issue was not resolved with nightly build, instead it was solved by updating visual studio (Im guessing this was because it forced a workload update)

@github-actions github-actions bot locked and limited conversation to collaborators Apr 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-xaml XAML, CSS, Triggers, Behaviors platform/windows 🪟 s/needs-info Issue needs more info from the author t/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants