Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

[Bug] XAML compiler broke with 4.7.0 #11101

Closed
Dids opened this issue Jun 18, 2020 · 57 comments
Closed

[Bug] XAML compiler broke with 4.7.0 #11101

Dids opened this issue Jun 18, 2020 · 57 comments
Assignees
Labels
4.7.0 regression on 4.7.0 a/Xaml </> blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. i/regression t/bug 🐛
Milestone

Comments

@Dids
Copy link

Dids commented Jun 18, 2020

Description

Updating to Xamarin.Forms 4.7.0 broke something in the XAML compilation, where every XAML file change fails to save.

Downgrading to the latest 4.6.x release fixes it, while restarting the IDE and/or deleting bin/obj directories does not.

Additionally, the application still compiles and runs fine without any errors or warnings, but any changes made to the XAML do not persist to the application itself.

Example errors from "Tool Output":

App.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "Application".
AppShell.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "Shell".
Views/AboutPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".
Views/ItemDetailPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".
Views/ItemsPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".
Views/NewItemPage.xaml : error :  : XamlC error XFC0000 : Cannot resolve type "ContentPage".

Steps to Reproduce

  1. Create a new Xamarin.Forms Shell application
  2. Update the dependencies (specifically Xamarin.Forms to 4.7.0)
  3. Edit AppShell.xaml in any way and hit Save

Expected Behavior

XAML should successfully save after any edits.

Actual Behavior

XAML fails to generate files when saving changes.

Basic Information

  • Version with issue: 4.7.0
  • Last known good version: 4.6.0.967
  • IDE: Visual Studio for Mac (latest stable branch versions of everything)
  • Platform Target Frameworks:
    • iOS: 13.5
  • Nuget Packages: Xamarin.Forms. Xamarin.Essentials

Reproduction Link

https://github.com/Dids/XAMLCompilationBug

Workaround

Downgrade to Xamarin.Forms 4.6.0.967 or older.

@Dids Dids added s/unverified New report that has yet to be verified t/bug 🐛 labels Jun 18, 2020
@jsuarezruiz
Copy link
Contributor

@StephaneDelcroix Could be related with #11021?

@eddie010
Copy link

I'm currently running into this as well... Every page now generates the error above... I'm downgrading in the meantime :)

@StephaneDelcroix
Copy link
Member

it is definitely related to the changes done on #11042

Those errors happen on "UpdateDesignTimeXaml" the first time the IDE tries to update the files. But it doesn't affect the compilation of the project at all.

@Dids by

Additionally, the application still compiles and runs fine without any errors or warnings, but any changes made to the XAML do not persist to the application itself.

you mean HotReload ?

@StephaneDelcroix StephaneDelcroix added blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. i/regression labels Jun 18, 2020
@StephaneDelcroix StephaneDelcroix self-assigned this Jun 18, 2020
@StephaneDelcroix StephaneDelcroix removed the s/unverified New report that has yet to be verified label Jun 18, 2020
@samhouts samhouts added the 4.7.0 regression on 4.7.0 label Jun 18, 2020
@samhouts samhouts added this to the 4.7.0 milestone Jun 18, 2020
@kaniosm
Copy link

kaniosm commented Jun 18, 2020

@StephaneDelcroix, it doesn't affect the compilation but it does affect the functionality...
In my case any shell uri's registered in code (i.e. Routing.RegisterRoute("SchedulerSettings", typeof(SchedulerSettingsPage)) will not work (routing doesn't work).

This is frustrating guys...
I removed a proxy project that was offering access to IMultibing since Multibinding is now part of 4.7, simplified all my grid rowdefinitions and columndefinitions and now I have to revert back to and switch to 4.6!

@StephaneDelcroix
Copy link
Member

@kaniosm I'm not trying to produce bad excuses by saying it still builds. This issue, like any regression, is top priority for us. We're on this, we hope to get a fix really soon, and that'll be followed by a service release for 4.7.0.

can you explain a bit more about Registered routes no longer working ?

@kaniosm
Copy link

kaniosm commented Jun 18, 2020

Hi @StephaneDelcroix, I’m not implying you are giving bad excuses. Sorry if it seemed so! I was just trying to clarify that even if it builds there are still issues that might be related to this.
I have a few routes that are registered in code during startup and some routes defined in xaml within the shell page. All routes registered in code do not work anymore. No error is produced during runtime, but the UI will not redirect to the route/page.

@StephaneDelcroix
Copy link
Member

@kaniosm that shell routes looks something different. could you please open a new issue, ideally with a small repro for it ?

/cc @PureWeen

@jwoeste
Copy link

jwoeste commented Jun 18, 2020

Hi - just to follow up:

Sample errors that arise from this issue:
/Users/jenswoeste/Projects/lukka/curo/FrontEnd/Curo/Pages/StockPage.xaml: Error: The 'MSBuild:UpdateDesignTimeXaml' code generator crashed: A task was canceled. at MonoDevelop.Ide.CustomTools.MSBuildCustomTool.Generate (MonoDevelop.Core.ProgressMonitor monitor, MonoDevelop.Projects.Project project, MonoDevelop.Projects.ProjectFile file, MonoDevelop.Ide.CustomTools.SingleFileCustomToolResult result) [0x00046] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/MSBuildCustomTool.cs:53 at MonoDevelop.Ide.CustomTools.CustomToolService.UpdateAsync (MonoDevelop.Projects.ProjectFile file, MonoDevelop.Projects.Project project, System.Boolean force) [0x002ba] in /Users/builder/azdo/_work/1/s/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CustomTools/CustomToolService.cs:376 /Users/jenswoeste/Projects/lukka/curo/FrontEnd/Curo/Pages/PortfolioDetailPage.xaml: Error: : XamlC error XFC0000 : Cannot resolve type "Application". (Curo) /Users/jenswoeste/Projects/lukka/curo/FrontEnd/Curo/Pages/PortfolioDetailPage.xaml: Error: : XamlC error XFC0000 : Cannot resolve type "Shell". (Curo)

It builds but MSBuild:UpdateDesignTimeXaml code generator crashes. This initially only affects hot reloads (and annoys my OCD as errors are show plenty). You can still pull off a bit of debugging. After a while the IDE gets quite flakey and triggers random freezes which is probably more an issue for the VS Mac team than the Xamarin forms team. At this point code behind is not compiled (which is what @kaniosm is experiencing!) and you have to clean project and restart IDE.

@kaniosm
Copy link

kaniosm commented Jun 18, 2020

@StephaneDelcroix shell routes are fine, it just happened that both routes I was testing were using multibinding, which requires a converter, which was not the case in my proxy implementation.

@pulmuone
Copy link

xf 4.7 same issue...

@StephaneDelcroix
Copy link
Member

shell routes are fine

I'm relieved (/cc @PureWeen)

@RamiroGuasti
Copy link

The same using Visual Studio 2019 for Windows.
Xamarin.Forms version: 4.7.0.968+385-sha.9062aad78-azdo.3810621

Error: XamlC error XFC0000 : Cannot resolve type "Application".

@microwales
Copy link

I can also confirm the fix in version 4.7.0.1080 as well. Thank you guys

@andersonvieiragomeslopes

Can confirm it as well: Fixed in 4.7.0.1080. Good Job!

@dfyx
Copy link

dfyx commented Jul 27, 2020

Still happens for me in 4.7.0.1179 with a new .Net Core 3.1 project.

@StephaneDelcroix
Copy link
Member

@dfyx please open a new issue, with an attached repro. thx

@dfyx
Copy link

dfyx commented Jul 27, 2020

Just got it, I was missing a line from the project file that removes the EmbeddedResource build action from WPF XAML files. That could be a little clearer from the documentation. I'll add a new issue as soon as I'm sure about the details.

@lindexi
Copy link
Contributor

lindexi commented Aug 8, 2020

It break in 4.8.0.1269

@lindexi
Copy link
Contributor

lindexi commented Aug 8, 2020

@hplos
Copy link

hplos commented Aug 20, 2020

Please reopen, this issue returns in 4.8.0.1269

@Dids
Copy link
Author

Dids commented Aug 20, 2020

Xamarin.Forms 4.8.0.1269 works fine here, but I'm only targeting iOS at the moment (as well as working from macOS + VS4Mac), so maybe the issue is platform specific this time around?

@kaniosm
Copy link

kaniosm commented Aug 20, 2020

Xamarin Forms 4.8.0.1269+325-sha.f6490bf7d-azdo.3951545 with VS 2019 on Windows 10 - All fine!

@schnerring
Copy link

schnerring commented Aug 21, 2020

Environment:

  • netcoreapp3.1 with WPF
  • VS2019
  • Windows 10
  • Xamarin.Forms.Platform.WPF 4.8.0.1269

Error : XamlC error XFC0000 : Cannot resolve type "Application".

Repro: https://github.com/schnerring/XamarinWPFCompilationBug

I found a fix I don't understand in this article which I think is what @dfyx meant with removing the EmbeddedResource build action. I couldn't find anything about that in the official docs.

I added the fix to my repro code inside the csproj file and commented it:

<ItemGroup>
    <EmbeddedResource Remove="**/*.xaml" />
</ItemGroup>

As soon as you uncomment, the project compiles successfully.

@TroySchmidt
Copy link

Using .NET Core WPF app the fix above by @schnerring worked for me as well.

@Achilles1515
Copy link

Still an issue with 4.8.0.1560 (.NET Core WPF). Workaround mentioned by @schnerring worked.

@givod
Copy link

givod commented Oct 28, 2020

it didn't work for me, instead, the whole threw all sorts of errors

@dcuccia
Copy link

dcuccia commented Dec 22, 2020

Not sure this is resolved. @schnerring 's work-around worked for me as well on 4.8.0.1687. My scenario is deploying MobileBlazorBindings hybrid components in an existing WPF app. I only observed this issue when adding to my existing project with vanilla WPF UserControls. The source is here:

https://github.com/dcuccia/MobileBlazorBindings/tree/master/samples/HybridAppStandalone

@Kcops11
Copy link

Kcops11 commented Dec 30, 2020

Currently experiencing this issue as well. Ive dotted my I's and crossed my T's but cant seem to find any obvious reason. Will try to downgrade to fix.

@cris-m
Copy link

cris-m commented Jan 21, 2021

I am experiencing this issue after Visual studio for Mac update to version 8.8.6 (build 15) and Xamarin Forms 5.0.0.1905. Is there any fix without downgrading Xamarin Forms ?

@Tommigun1980
Copy link

For anyone experiencing this issue please open a new ticket. I am not sure if the closed issues are monitored.

@schnerring
Copy link

I am not sure if the closed issues are monitored.

#13217

@sqlguy6212
Copy link

This is still an error and it's two years later so it says a lot about the team developing Visual Studio. I am using VS 2022. Now the error occurred when I made a small C# code change so most of the excuses above are no good. I need to close / open VS 2022 to get rid of this problem. Along with the horrible OS Win 11 MS has been doing a very poor job in the last while.

@jwoeste
Copy link

jwoeste commented Jan 20, 2022

This is still an error and it's two years later so it says a lot about the team developing Visual Studio. I am using VS 2022. Now the error occurred when I made a small C# code change so most of the excuses above are no good. I need to close / open VS 2022 to get rid of this problem. Along with the horrible OS Win 11 MS has been doing a very poor job in the last while.

I had this issue recently as well. Reason was a 3rd party NuGet Package using URL for package reference.

If I recall correctly it was rg.plugins.popup.

Before I had
xmlns:pages="http://rotorgames.com" (according to their documentation).

Changing it to
xmlns:pages="namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" solved the issue. I had one more nuget but I forgot which it was.

Basically don't use URLs - use the old way.

This XamlC error XFC0000 seems to be some kind of a catch-all error for unhandled errors in the XAML compiler.

Hope it helps.

@GreatBarrier86
Copy link

I haven't tried it, but the link mentioned above had this potential workaround.

#11101

@jl-mobitech
Copy link

This is still an error and it's two years later so it says a lot about the team developing Visual Studio. I am using VS 2022. Now the error occurred when I made a small C# code change so most of the excuses above are no good. I need to close / open VS 2022 to get rid of this problem. Along with the horrible OS Win 11 MS has been doing a very poor job in the last while.

I had this issue recently as well. Reason was a 3rd party NuGet Package using URL for package reference.

If I recall correctly it was rg.plugins.popup.

Before I had xmlns:pages="http://rotorgames.com" (according to their documentation).

Changing it to xmlns:pages="namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" solved the issue. I had one more nuget but I forgot which it was.

Basically don't use URLs - use the old way.

This XamlC error XFC0000 seems to be some kind of a catch-all error for unhandled errors in the XAML compiler.

Hope it helps.

+1

@ajvanlaningham
Copy link

Still an issue I'm experiencing with MAUI:

Severity Code Description Project File Line Suppression State
Error : XamlC error XFC0000 : Cannot resolve type "Application"
Error : XamlC error XFC0000 : Cannot resolve type "Application".
Error : XamlC error XFC0000 : Cannot resolve type "Shell"
Error : XamlC error XFC0000 : Cannot resolve type "Shell"
Error : XamlC error XFC0000 : Cannot resolve type "ResourceDictionary"
Error : XamlC error XFC0000 : Cannot resolve type "ResourceDictionary"
Error : XamlC error XFC0000 : Cannot resolve type "ResourceDictionary"
Error : XamlC error XFC0000 : Cannot resolve type "ResourceDictionary"

Solution wont build at all. I've cleaned, rebuilt, closed, reopend, recleaned, rebuilt, restarted my computer, repaired visual studio, restored nugget packages, restarted my computer, done all that again and nothing has fixed any of it.

@Mercally
Copy link

Mercally commented Jul 5, 2023

This is still an error and it's two years later so it says a lot about the team developing Visual Studio. I am using VS 2022. Now the error occurred when I made a small C# code change so most of the excuses above are no good. I need to close / open VS 2022 to get rid of this problem. Along with the horrible OS Win 11 MS has been doing a very poor job in the last while.

I had this issue recently as well. Reason was a 3rd party NuGet Package using URL for package reference.

If I recall correctly it was rg.plugins.popup.

Before I had xmlns:pages="http://rotorgames.com" (according to their documentation).

Changing it to xmlns:pages="namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup" solved the issue. I had one more nuget but I forgot which it was.

Basically don't use URLs - use the old way.

This XamlC error XFC0000 seems to be some kind of a catch-all error for unhandled errors in the XAML compiler.

Hope it helps.

That work around helped me. Thank you!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
4.7.0 regression on 4.7.0 a/Xaml </> blocker Issue blocks next stable release. Prioritize fixing and reviewing this issue. i/regression t/bug 🐛
Projects
None yet
Development

No branches or pull requests