xamarin / XamarinCommunityToolkit

The Xamarin Community Toolkit is a collection of Animations, Behaviors, Converters, and Effects for mobile development with Xamarin.Forms. It simplifies and demonstrates common developer tasks building iOS, Android, and UWP apps with Xamarin.Forms.
MIT License
1.59k stars 474 forks source link

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

Closed rsbepvb closed 2 years ago

rsbepvb commented 3 years ago

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.

jfversluis commented 3 years ago

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.

rsbepvb commented 3 years ago

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:

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

jorgediegocrespo commented 3 years ago

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 commented 3 years ago

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

jorgediegocrespo commented 3 years ago

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

pictos commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

It also doesn't work for me!

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

MarcosCobena commented 3 years ago

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 commented 3 years ago

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 commented 2 years ago

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

dansiegel commented 2 years ago

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.

2) 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 commented 2 years ago

same issue

Greg-Neumann commented 2 years ago

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

bricefriha commented 2 years ago

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 commented 2 years ago

@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 commented 2 years ago

@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 commented 2 years ago

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 commented 2 years ago

@axeldietz do you mind trying this package and seeing if it works for you?

https://dev.azure.com/xamarin/6fd3d886-57a5-4e31-8db7-52a1b47c07a8/_apis/build/builds/51212/artifacts?artifactName=nuget&api-version=6.0&%24format=zip

axeldietz commented 2 years ago

Hi Pictos,

Thanks for your prompt reply.

Yes, this package works!

Thanks a lot.

Axemasta commented 2 years ago

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 commented 2 years ago

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

bijington commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 9 months ago

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