I have an Expander that has always worked in my application. I updated Xamarin Forms to version 5.0.0 and XAML signaled me an error, the control no longer exists.
The type 'Expander' was not found. Verify that you are not missing an
assembly reference and that all referenced assemblies have been built.
Has it changed its name? was it deleted ?
Expander has been moved to Xamarin Community Toolkit package under the namespace (source).
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
Questions related to Expander on SO
Official documentation: https://learn.microsoft.com/en-us/xamarin/community-toolkit/views/expander
Official repo: https://github.com/xamarin/XamarinCommunityToolkit
Related
I have an old project with workflow (Appfabric) files in xaml and that project was targeting framework 4.0. We needed to update framework version so we changed the framework to 4.8 and suddenly some of our xaml files stop working.
I could see that there had been no change in the files but still we got errors saying that it can not load some of our custom activity because it could not find files that were in the project.
When looking at the imports it said that Namespace [Namespace.Name] cannot be resolved for those namespace where our custom activity was.
The code for the activity had not change and it was working but somehow the xaml file could not resolve it any more.
The only thing we did was to change the target framework to 4.8 for the project.
I am stuck and wounder if anyone else has had the same problem?
If this is still an issue:
Can you please confirm that the error is coming from AppFabric and
post the full error message
The same
Error Assembly '' can not be resolved. Please add a reference to this assembly in the project that is being built. [Project] [Path].xaml
I am really new to Xamarin.Forms and trying to learn using this nice tutorial.
I have managed to set up everything in Visual Studio 2017 Community Edition and successfully deploy to both emulated and physical devices (Android only).
During various trials, I have noticed that some XAML errors are not highlighted and build is successfully performed, but XAML failed at runtime, crashing the app. E.g. misspell a style name or any an attribute value.
Running in debug mode will just hang the app. Breaking it indicates the following line:
public partial class MainPage : global::Xamarin.Forms.ContentPage { [System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")]
private void InitializeComponent() {
// this is the last line from my code that hands when XAML is invalid
this.LoadFromXaml(typeof(MainPage));
}
}
Resuming the execution shows a hint of what is wrong (no fancy details as provided by the new VS2017 exception interface):
Unhandled Exception:
Xamarin.Forms.Xaml.XamlParseException: occurred
Question: Is there a way to catch invalid XAML errors earlier? Or at least obtain more relevant information? Or is this a known limitation of Xamarin.Forms?
To make things worse, autocomplete for attribute values does not seem to work in VS2017 (it works in VS2015), but this is another issue for another question.
Further details about installed software:
Microsoft Visual Studio Community 2017
Version 15.0.26228.9 D15RTWSVC
Microsoft .NET Framework
Version 4.6.01586
Installed Version: Community
Xamarin 4.3.0.795 (aece090)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin.Android SDK 7.1.0.41 (9578cdc)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 10.4.0.123 (35d1ccd)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
To catch XAML errors at compilation time you have to add one line to AssemblyInfo.cs :
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
More information on this can be found here.
Unfortunately Xamarin.Forms XAML intellisense support in VS is not like for WPF or SilverLight, it's very limited currently. One suggestion can be to write your ui in code, this way you will get a feedback faster and if you are very new to Xamarin.Forms XAML you can get familiar with it much easier because of intellisense in code behind.
Another option is to use IDE extensions, in your case as I understand it is VS 2017 for Windows so it will not help you, but for Xamarin Studio for MC you have tools like mfractor, that build to solve the issues you addressed.
I'm trying to reference a VB.NET DLL in a Xamarin.Forms (Portable) application. During the course of my research, I found the following post that might allow this: Xamarin.Android and VB.Net Libraries
I've tried to use the "Embed" work-around mentioned in the link, but the Xamarin.Forms project would fail to build because it can't load the Microsoft.VisualBasic assembly, version 8.0.0.0.
I've also found the following link as well during my research that should allow at least some VB.NET usage in a Xamarin application: https://developer.xamarin.com/guides/cross-platform/application_fundamentals/pcl/portable_visual_basic_net/xamarin-forms/
At the bottom of the site, there is a "Limitations of VB.NET in Xamarin.Forms" section. With the last item: "Xamarin does not support the Visual Basic.NET language," does that simply mean that you can't use a VB.NET dll in any Xamarin.Forms (portable) project that happens to also reference Xamarin.Forms.Core, Xamarin.Forms.Platform, and Xamarin.Forms.Xaml?
Thanks for any insight!
A DLL doesn't contain it's dependencies. If your DLL relies on Microsoft.VisualBasic, you will need to load the DLL that contains that assembly as well.
So either remove the Microsoft.VisualBasic assembly reference from the VB DLL, or include it as a reference in your Xamarin project (which may or may not be possible, I am not sure.)
I've created a Xamarin project which added the following projects to the solution:
Xamarin.UI(Portable)
Xamarin.UI.Droid
Xamarin.UI.iOS
Xamarin.UI.UWP
Xamarin.UI.Windows (Windows 8.1)
Xamarin.UI.WindowsPhone (Windows Phone 8.1)
I am having problems creating a client which can consume my WCF service.
1) Firstly the current Xamarin project template doesn't reference System.ServiceModel assembly in the PCL therefore I cannot right click the PCL and Add Service Reference to my project. When I manually add a reference to System.ServiceModel from this location - C:\Program Files\Reference Assemblies\Microsoft\Framework.NETFramework\v4.5 the menu item for create service reference pops up. When I click Go in the Add Service Reference dialog I get the following error:
"This service cannot be consumed by the current project. Please check if the project target framework supports this service type."
The PCL targets are as follows:
.NET Framework 4.5
ASP.NET Core 1.0
Windows 8
Windows Phone 8.1
Xamarin.Android
Xamarin.iOS
Xamarin.iOS
I don't know how to get this working ?
2) Secondly the work around I use is to create the client with SlSvcUtil.exe
Add the generated code to my PCL along with a reference to System.ServiceModel and everything builds ok. The problem is that when I run the code it flags up type reference errors ! Should I be manually adding the reference to System.ServiceModel anyway? What am I doing wrong in this scenario? Am I missing some steps?
I've checked the Xamarin docs but it seems that I can't find detailed instructions on this.
Please help me out ! Thanks:)
PCL and WCF should be supported. Alternatively, you could get this to work manually with HttpClient, etc. But maybe if you can use the shared project instead of PCL, that would be easier. Otherwise you'd have to also use DependencyService, create interfaces, etc. for each platform.
I have a Windows Metro App, I created a Grid App and have added a whole bunch of forms and controls and pages,changed namespaces. Now I'm getting a XAML error saying it cannot locate Common:LayoutAwarePage.
I have looked at this article : XAML cannot find reference in local namespace. However when looking through my application I cannot find any winmd files other than those for Bing.Maps
I created the project in Win 8 RP and vs 2012 RC, but have since upgraded the RTM versions of both . I even created a blank grid app and built it and there was no winmd file. Is there something I'm doing wrong and how do I solve this issue?