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".
AppShell.xaml
in any way and hit SaveXAML should successfully save after any edits.
XAML fails to generate files when saving changes.
https://github.com/Dids/XAMLCompilationBug
Downgrade to Xamarin.Forms 4.6.0.967 or older.
@StephaneDelcroix Could be related with https://github.com/xamarin/Xamarin.Forms/pull/11021?
I'm currently running into this as well... Every page now generates the error above... I'm downgrading in the meantime :)
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, 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!
@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 ?
Hi @StephaneDelcroix, I鈥檓 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.
@kaniosm that shell routes looks something different. could you please open a new issue, ideally with a small repro for it ?
/cc @PureWeen
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.
@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.
xf 4.7 same issue...
shell routes are fine
I'm relieved (/cc @PureWeen)
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".
JFYI, NuGet currently lists 4.7.0.968 as the latest "stable" release. I think this is a mistake with your CI, since this is clearly a dev-build, not something that has been tested + QA'ed.
same issue for m
xf 4.7 same issue...
For me too:
XamlC error XFC0000 : Cannot resolve type "ContentPage".
Xamarin.Forms 4.7 with VS for mac 8.4
Same here. Started to happen out of the blue with one of my XAML files.
Xamarin.Forms 4.7.0.968.
I had a real error; "SignUpPage.xaml(68,68): Error XFC0000: Cannot resolve type "SignUpPage+SignUpType". (XFC0000) (ProjectName) XamlC" in the project, but in addition to that I got 40 errors claiming things like Application not being found. I had to clean the project and restart VS before things went back to normal.
Edit: While fixing this error, VS again started to print bogus errors when I saved the file:
.xaml: Error: : XamlC error XFC0000 : Cannot resolve type "Application".
.xaml: Error: : XamlC error XFC0000 : Cannot resolve type "ResourceDictionary".
.xaml: Error: : XamlC error XFC0000 : Cannot resolve type "ContentView".
, and 37 other bogus errors, where several are repeated.
Same problem with v4.7.0.968 downgraded to v4.6.0.967 and problem goes away. First appeared when I set a resource dictionary in the App.xaml file
same here - downgrading back to v.4.6.0.967
Well, I suppose I'll downgrade as well.
same error as well. when i first open VS, the error doesn't exists. but when I restart the project (changes in C# code), the error shows up
i'm using hot reload, vs 2019, all packages are updated especially Xamarin Forms (latest stable in nuget)
Maybe this helps a little:
I upgraded my project to 4.7.0.968 a few days ago and didn't have this error until I added a "<" and ">" to one of my XAML files. This triggered the error. It's not disappearing since. Removing the special characters again also didn't help.
Maybe this helps a little:
I upgraded my project to 4.7.0.968 a few days ago and didn't have this error until I added a "<" and ">" to one of my XAML files. This triggered the error. It's not disappearing since. Removing the special characters again also didn't help.
Sorry, GitHub parsed my post: I added the special syntax for "<" and ">" to my XAML as described here:
https://docs.microsoft.com/de-de/dotnet/framework/wpf/advanced/how-to-use-special-characters-in-xaml
I have this same problem since 4.7 but here is the weird thing:
@BlueRaja @samhouts This issue is not resolved yet.
I verified the issue is still present in XF 4.7.0.968. Please reopen the bug.
same issues but does not affect compilations
The fix will be in the next service release we are pushing soon.
I had the same issue. But then deleted FORM and dependent package. Then in GIT, Rolled back the changes to Packages, etc. That then restored them to Forms, IOS, Droid. So - My FORMs version is back to the 4.7.0. Closed SLN, re-opened, Had to say RELOAD on a few projects. For some reason a few IDs in my SLN updated, but I am back building again.
=(
I had to Downgrade to Xamarin.Forms 4.6.0.967
Can confirm it's fixed for me with Xamarin.Forms 4.7.0. 1080
Cheers!
I can confirm this issue is fixed with Xamarin.Forms 4.7.0.1080 for my project as well.
Great job guys!!!
Can confirm it as well: Fixed in 4.7.0.1080. Good work!
I can also confirm the fix in version 4.7.0.1080 as well. Thank you guys
Can confirm it as well: Fixed in 4.7.0.1080. Good Job!
Still happens for me in 4.7.0.1179 with a new .Net Core 3.1 project.
@dfyx please open a new issue, with an attached repro. thx
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.
It break in 4.8.0.1269
Please reopen, this issue returns in 4.8.0.1269
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?
Xamarin Forms 4.8.0.1269+325-sha.f6490bf7d-azdo.3951545 with VS 2019 on Windows 10 - All fine!
Environment:
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.
Using .NET Core WPF app the fix above by @schnerring worked for me as well.
Still an issue with 4.8.0.1560 (.NET Core WPF). Workaround mentioned by @schnerring worked.
it didn't work for me, instead, the whole threw all sorts of errors
Most helpful comment
Environment:
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:
As soon as you uncomment, the project compiles successfully.