I have a simple C#/MAUI app – all classes in the same namespace. Getting this weird error XAGAP7000 all of a sudden, and Googling doesn’t seem to help. I tried repairing the Visual Studio installation as well. Double-checked the XAML (see below). Totally flummoxed!
<code>Severity Code Description Project File Line Suppression State
Error (active) XAGAP7000 System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name. Line 2, position 26.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlReader.MoveToContent()
at Xamarin.Android.Tasks.GetAndroidPackageName.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 Calculator2 (net8.0-android) C:Program FilesdotnetpacksMicrosoft.Android.Sdk.Windows34.0.95toolsXamarin.Android.Common.targets 618
<code>Severity Code Description Project File Line Suppression State
Error (active) XAGAP7000 System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name. Line 2, position 26.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlReader.MoveToContent()
at Xamarin.Android.Tasks.GetAndroidPackageName.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 Calculator2 (net8.0-android) C:Program FilesdotnetpacksMicrosoft.Android.Sdk.Windows34.0.95toolsXamarin.Android.Common.targets 618
</code>
Severity Code Description Project File Line Suppression State
Error (active) XAGAP7000 System.Xml.XmlException: The ':' character, hexadecimal value 0x3A, cannot be included in a name. Line 2, position 26.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
at System.Xml.XmlReader.MoveToContent()
at Xamarin.Android.Tasks.GetAndroidPackageName.RunTask()
at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25 Calculator2 (net8.0-android) C:Program FilesdotnetpacksMicrosoft.Android.Sdk.Windows34.0.95toolsXamarin.Android.Common.targets 618
But when you double-click on this error, it takes you to the first line of the snippet below in Xamarin.Android.Common.targets
, where there’s no ‘:’ at all:
<code> <GetAndroidPackageName
ManifestFile="$(_AndroidManifestAbs)"
AssemblyName="$(AssemblyName)"
ManifestPlaceholders="$(AndroidManifestPlaceholders)"
PackageName="$(_AndroidPackage)">
<Output TaskParameter="PackageName" PropertyName="_AndroidPackage" />
<code> <GetAndroidPackageName
ManifestFile="$(_AndroidManifestAbs)"
AssemblyName="$(AssemblyName)"
ManifestPlaceholders="$(AndroidManifestPlaceholders)"
PackageName="$(_AndroidPackage)">
<Output TaskParameter="PackageName" PropertyName="_AndroidPackage" />
</GetAndroidPackageName>
</Target>
</code>
<GetAndroidPackageName
ManifestFile="$(_AndroidManifestAbs)"
AssemblyName="$(AssemblyName)"
ManifestPlaceholders="$(AndroidManifestPlaceholders)"
PackageName="$(_AndroidPackage)">
<Output TaskParameter="PackageName" PropertyName="_AndroidPackage" />
</GetAndroidPackageName>
</Target>
Here’s the top of my XAML:
<code><ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Adam"
<ContentPage.BindingContext>
</ContentPage.BindingContext>
<code><ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Adam"
x:Class="Adam.MainPage"
BackgroundColor="Black">
<ContentPage.BindingContext>
<local:AdamViewModel />
</ContentPage.BindingContext>
</code>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:Adam"
x:Class="Adam.MainPage"
BackgroundColor="Black">
<ContentPage.BindingContext>
<local:AdamViewModel />
</ContentPage.BindingContext>
Other than that, I’m styling my custom buttons:
<code> <Style TargetType="{x:Type local:Button2}">
<code> <Style TargetType="{x:Type local:Button2}">
</code>
<Style TargetType="{x:Type local:Button2}">
And doing some commanding:
<code><local:Button2 (blah blah) Command="{Binding ButtonClick}" CommandParameter="A0" />
<code><local:Button2 (blah blah) Command="{Binding ButtonClick}" CommandParameter="A0" />
</code>
<local:Button2 (blah blah) Command="{Binding ButtonClick}" CommandParameter="A0" />
And that bound function is sitting in my ViewModel class.
Appreciate any thoughts on why Visual Studio 2022 hates me today.