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

[Bug]Error: : XamlC error XFC0000 : Cannot resolve type "Shield" #1311

Closed
rsbepvb opened this issue May 17, 2021 · 29 comments · Fixed by #1714
Closed

[Bug]Error: : XamlC error XFC0000 : Cannot resolve type "Shield" #1311

rsbepvb opened this issue May 17, 2021 · 29 comments · Fixed by #1714
Labels
bug Something isn't working. Breaky break. buildchain

Comments

@rsbepvb
Copy link

rsbepvb commented May 17, 2021

Description. Error: : XamlC error XFC0000 : Cannot resolve type "Shield"

Steps to Reproduce

  1. Installed Xamarin Community Toolkit (v 1.1.0) in All projects (iOS, Android, Main)
  2. Insert xmlns:xct="http://xamarin.com/schemas/2020/toolkit" in xaml page
  3. Insert <xct:Shield x:Name="Shield1"
    Subject="Software Version Number"
    Status="on discord"
    StatusBackgroundColor="SeaGreen"
    StatusTextColor="White"
    Margin="2,0"
    HeightRequest="30"
    HorizontalOptions="Start"/>
    in xaml

Expected Behavior

Expect Shield to Appear without error and intelisense to work in xaml.cs page

Actual Behavior

intelisense does not work in xaml.cs page -- intelisense indicates Shield not found. Further when compiling, xaml produces error above -- Error: : XamlC error XFC0000 : Cannot resolve type "Shield".
Interestingly, the shield does appear in app when run.

Basic Information

Would appreciate any suggestions to resolve. None found in searching so far.

@rsbepvb rsbepvb added bug Something isn't working. Breaky break. s/unverified This issue needs verification/reproduction by a team member. PRs cannot be accepted/merged. labels May 17, 2021
@jfversluis
Copy link
Member

I've seen this a couple of times...

Any reason you discarded the rest of the report template? Because I would love to know if you're using Visual Studio on Windows or Mac for instance. If you could complete it with the missing info as much as possible that would be great.

Could you try deleting your bin & obj folders from each project folder on the filesystem and see if it still occurs?

Not sure if it's any help, I see the same thing happened to Forms here at some point.

@jfversluis jfversluis added buildchain and removed s/unverified This issue needs verification/reproduction by a team member. PRs cannot be accepted/merged. labels May 18, 2021
@rsbepvb
Copy link
Author

rsbepvb commented May 18, 2021

Thanks JFVerluis. I deleted the bin and obj folders from each project folder and recompiled but unfortunately, the same error is still present. As for the additional information, see below:

  • Version with issue: xct 1.1.0
  • Last known good version: none
  • IDE: Visual Studio Community 2019 for Mac
    Version 8.9.9 (build 3)
  • Platform Target Frameworks:
    • iOS: xcode 14.5
    • Android: Target is 10.0 (API Level 29)
    • UWP: n/a
  • Android Support Library Version:
  • Nuget Packages:
  • Affected Devices: tested against iphones only.

***Gerald, big fan of your you tube videos --- watched the one last night on toast and snackbar -- well done.

@jorgediegocrespo
Copy link

Hello. I having the same issue. I have updated and downgraded the nuget, remove bin, obj and .vs folders, updated VS... and the issue is still there. Is there any news about that?

@rsbepvb
Copy link
Author

rsbepvb commented Jun 3, 2021

No update that I am aware of. Problem is still unresolved at my end.

@jorgediegocrespo
Copy link

It seems it is a cache problem. I have run a maintenance task on Onyx and VS is already working fine :)

@pictos
Copy link
Contributor

pictos commented Jun 24, 2021

As mentioned in other related issues, this is more a tooling issue than an XCT issue. We can't do too much here :(

As far we know you should be able to build and run your app even with those errors

@MarcosCobena
Copy link

Hi,

There's a workaround where replacing URIs with clr-namespaces gets rid of those errors.

For instance, replace

      xmlns:xct="http://xamarin.com/schemas/2020/toolkit"

with

      xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

I hope it helps!

@pavshr
Copy link

pavshr commented Jul 8, 2021

Hello, @MarcosCobena
Thanks for posting this, however, the proposed workaround didn't work for me 😔.

In general:
I get the error in Azure CD pipeline (XamarinAndroid and XamatiniOS tasks) after upgrading from 1.1.0 to 1.2.0 (we wanted to take in use SemanticOrderView).

The error is:
XamlC error XFC0000: Cannot resolve type "xct:SemanticOrderView"

Any other suggestions for how I can overpass this issue in the pipeline will be appreciated, thanks.

@rsbepvb
Copy link
Author

rsbepvb commented Jul 8, 2021

Hi,

There's a workaround where replacing URIs with clr-namespaces gets rid of those errors.

For instance, replace

      xmlns:xct="http://xamarin.com/schemas/2020/toolkit"

with

      xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

I hope it helps!

This workaround is working for me. Thanks for the tip.

@MarcosCobena
Copy link

Hello, @MarcosCobena
Thanks for posting this, however, the proposed workaround didn't work for me 😔.

In general:
I get the error in Azure CD pipeline (XamarinAndroid and XamatiniOS tasks) after upgrading from 1.1.0 to 1.2.0 (we wanted to take in use SemanticOrderView).

The error is:
XamlC error XFC0000: Cannot resolve type "xct:SemanticOrderView"

Any other suggestions for how I can overpass this issue in the pipeline will be appreciated, thanks.

How is xct defined?

@wagenheimer
Copy link

It also doesn't work for me!

Because this error, HotReload don't work for me. It always fails with this error.

@MarcosCobena
Copy link

Just to double check for those of you who still see the error: have you reviewed every namespace? It happened to me I had four or five different XAMLs failing, not just one.

@marcioqmaciel
Copy link

Hi,

There's a workaround where replacing URIs with clr-namespaces gets rid of those errors.

For instance, replace

      xmlns:xct="http://xamarin.com/schemas/2020/toolkit"

with

      xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

I hope it helps!

ty so much!

@420tech
Copy link

420tech commented Sep 18, 2021

The workaround did not work for me. Sigh - when will next tooling update happen for VS for Mac?

@dansiegel
Copy link
Contributor

A couple of notes on this issue.

  1. If you're getting this error please add something in code from the Toolkit like:
_ = new AsyncCommand(async () => {});

This assumes that you are NOT already using anything from XCT in code.

  1. If you're still getting this error then the problem is NOT with the XCT. Please file an issue with the Visual Studio team by going to Help -> Report a Problem (on Mac) or Help -> Send Feedback -> Report a Problem (on Windows)

@pulmuone
Copy link

same issue

@pictos pictos mentioned this issue Nov 11, 2021
6 tasks
@Greg-Neumann
Copy link

Clearing the bin & obj folders resolved this for me (Windows)

@bricefriha
Copy link

Hi,
There's a workaround where replacing URIs with clr-namespaces gets rid of those errors.
For instance, replace

      xmlns:xct="http://xamarin.com/schemas/2020/toolkit"

with

      xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

I hope it helps!

This workaround is working for me. Thanks for the tip.

it doesn't solve #1562 though

@pictos
Copy link
Contributor

pictos commented Dec 13, 2021

@bricefriha @pulmuone and others, can you please try this nuget and let me know if that works for you? Please make sure to delete the current XCT package, clean up everything (deleting bin/obj) and the install this package
https://dev.azure.com/xamarin/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/build/builds/51212/artifacts?artifactName=nuget&api-version=6.0&%24format=zip

@smilingjack10
Copy link

smilingjack10 commented Dec 17, 2021

@bricefriha @pulmuone and others, can you please try this nuget and let me know if that works for you? Please make sure to delete the current XCT package, clean up everything (deleting bin/obj) and the install this package https://dev.azure.com/xamarin/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/build/builds/51212/artifacts?artifactName=nuget&api-version=6.0&%24format=zip

For me it solved the "Cannot Resolve type "TouchEffect"" error. Thx!

@axeldietz
Copy link

Same prob with xct:eventtocommandbehavior.

Applying: xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.Behaviors;assembly=Xamarin.CommunityToolkit" instead of "xmlns:xct="http://xamarin.com/schemas/2020/toolkit" worked for me.

Microsoft Visual Studio Professional 2022 (64-bit) Version 17.0.4

@pictos
Copy link
Contributor

pictos commented Dec 29, 2021

@axeldietz
Copy link

Hi Pictos,

Thanks for your prompt reply.

Yes, this package works!

Thanks a lot.

@Axemasta
Copy link
Contributor

Axemasta commented Feb 2, 2022

I'm getting this error on an azure pipeline agent.
Manually specifying the namespace does resolve the issue:

xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

Although I'd say its quite hacky, I've tried with the latest version of the toolkit (2.0.0) and the issue exists. Interestingly we only started to get this issue after upgrading from 1.2.0 to 2.0.0, so I wonder if there is an issue with the toolkit itself?

The solution is hard to test since the solution does build locally on windows & mac, its just the cloud agent that gets this error. Any ideas?

@CanEker-Backend
Copy link

You can install XCT version 1.1.0 and its done :))

@bijington
Copy link
Contributor

I'm getting this error on an azure pipeline agent. Manually specifying the namespace does resolve the issue:

xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

Although I'd say its quite hacky, I've tried with the latest version of the toolkit (2.0.0) and the issue exists. Interestingly we only started to get this issue after upgrading from 1.2.0 to 2.0.0, so I wonder if there is an issue with the toolkit itself?

The solution is hard to test since the solution does build locally on windows & mac, its just the cloud agent that gets this error. Any ideas?

Are you running the exact same steps locally as you are on your cloud agents?

@1897
Copy link

1897 commented Jul 14, 2022

I'm getting this issue when building azure pipelines, the build fails, none of above worked for me

how do you set following name space guys?
xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

when I set it complains that cannot resolve the type.
now my pipelines fails to build and I'm stuck. Can someone suggest any solutions?

Thanks

@bijington
Copy link
Contributor

I'm getting this issue when building azure pipelines, the build fails, none of above worked for me

how do you set following name space guys? xmlns:xct="clr-namespace:Xamarin.CommunityToolkit.UI.Views;assembly=Xamarin.CommunityToolkit"

when I set it complains that cannot resolve the type. now my pipelines fails to build and I'm stuck. Can someone suggest any solutions?

Thanks

This issue is closed, would you be able to open a new issue including the details of the issue that you are seeing. Thanks

@phamnamkhanhs
Copy link

I also have a same problem XamlC error XFC0000 : Cannot resolve type "Page"., I try 2 way but nothing work

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working. Breaky break. buildchain
Projects
None yet
Development

Successfully merging a pull request may close this issue.