Skip to content

.NET10-rc1 The type or namespace name 'XamlProcessingAttribute' could not be found #31550

@bcaceiro

Description

@bcaceiro

Description

After upgrading to RC1 - now it's not possible to try out the Xaml source gen:

Adding this: [assembly: XamlProcessing(XamlInflator.SourceGen)] - from the docs https://learn.microsoft.com/en-us/dotnet/maui/whats-new/dotnet-10?view=net-maui-9.0#xaml

On the top of the app.xaml.cs

[assembly: XamlProcessing(XamlInflator.SourceGen)]
namespace Maui10Preview7
{
    public partial class App : Application
    {
        public App()
        {
            InitializeComponent();
        }

        protected override Window CreateWindow(IActivationState? activationState)
        {
            return new Window(new AppShell());
        }
    }
}
'XamlInflator' is inaccessible due to its protection level
The type or namespace name 'XamlProcessing' could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name 'XamlProcessingAttribute' could not be found (are you missing a using directive or an assembly reference?)

Also I am using visual Studio insiders , and my workloads are:

Workload version: 10.0.100-manifests.a6e8bec0

Installed Workload Id      Manifest Version                         Installation Source
---------------------------------------------------------------------------------------------------------------------------
android                    36.0.0-rc.1.285/10.0.100-rc.1            VS 17.14.36429.23, VS 17.14.36429.23, VS 18.0.11005.162
ios                        18.5.10727-net10-rc.1/10.0.100-rc.1      VS 17.14.36429.23, VS 17.14.36429.23, VS 18.0.11005.162
maccatalyst                18.5.10727-net10-rc.1/10.0.100-rc.1      VS 17.14.36429.23, VS 17.14.36429.23, VS 18.0.11005.162
maui-windows               10.0.0-rc.1.25452.6/10.0.100-rc.1        VS 17.14.36429.23, VS 17.14.36429.23, VS 18.0.11005.162

Steps to Reproduce

  1. Create a new .net maui app with rc1

  2. add [assembly: XamlProcessing(XamlInflator.SourceGen)]

  3. Build -> see error

Link to public reproduction project repository

https://github.com/bcaceiro/net9-repros/tree/main/Maui10Preview7

Version with bug

10.0.0-rc.1

Is this a regression from previous behavior?

Yes, this used to work in .NET MAUI

Last version that worked well

10.0.0-preview.7

Affected platforms

Android

Affected platform versions

No response

Did you find any workaround?

Just disabling the feature

Relevant log output

1>------ Build started: Project: Maui10Preview7, Configuration: Debug Any CPU ------
1>C:\Program Files\dotnet\sdk\10.0.100-rc.1.25451.107\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets(345,5): message NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
1>Skipping analyzers to speed up the build. You can execute 'Build' or 'Rebuild' command to run analyzers.
1>Including assemblies for Hot Reload support
1>C:\P\net9-repros\Maui10Preview7\App.xaml.cs(1,12,1,26): error CS0246: The type or namespace name 'XamlProcessingAttribute' could not be found (are you missing a using directive or an assembly reference?)
1>C:\P\net9-repros\Maui10Preview7\App.xaml.cs(1,12,1,26): error CS0246: The type or namespace name 'XamlProcessing' could not be found (are you missing a using directive or an assembly reference?)
1>C:\P\net9-repros\Maui10Preview7\App.xaml.cs(1,27,1,39): error CS0122: 'XamlInflator' is inaccessible due to its protection level
1>Done building project "Maui10Preview7.csproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Build completed at 08:43 and took 03,991 seconds ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========
========== Deploy completed at 08:43 and took 03,991 seconds ==========

Metadata

Metadata

Assignees

No one assigned

    Labels

    t/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions