2
votes

I have problems creating own control: I'm trying to make grid view similar to list view. The problem is in xaml file of the page - when I'm initializing my component app crashes on that page with file not found exception.

Error says: System.IO.FileNotFoundException Could not load file or assembly 'FastFood' or one of its dependencies. The system cannot find the file specified.

Callstack:

    _at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity)

[0x00081] in /Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/AppDomain.cs:706

at System.AppDomain.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in

/Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/AppDomain.cs:674

at System.Reflection.Assembly.Load (System.Reflection.AssemblyName assemblyRef) [0x00000] in

/Users/builder/data/lanes/2320/1f068b49/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System.Reflection/Assembly.cs:551

at Xamarin.Forms.Xaml.XamlParser.GetElementType (Xamarin.Forms.Xaml.XmlType xmlType, IXmlLineInfo xmlInfo,

System.Reflection.Assembly currentAssembly, Xamarin.Forms.Xaml.XamlParseException& exception) [0x00133] in :0 at Xamarin.Forms.Xaml.CreateValuesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, INode parentNode) [0x0002a] in :0 at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x000b1] in :0 at Xamarin.Forms.Xaml.ElementNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00089] in :0 at Xamarin.Forms.Xaml.RootNode.Accept (IXamlNodeVisitor visitor, INode parentNode) [0x00064] in :0 at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.String xaml) [0x000a4] in :0 at Xamarin.Forms.Xaml.XamlLoader.Load (Xamarin.Forms.BindableObject view, System.Type callingType) [0x0002e] in :0 at Xamarin.Forms.Xaml.Extensions.LoadFromXaml[CategoryPage] (FastFood.CategoryPage view, System.Type callingType) [0x00000] in :0 at FastFood.CategoryPage.InitializeComponent () [0x0000c] in /Users/Slider/Coffetab/iOS/obj/iPhoneSimulator/Debug/FastFood.iOS..Users.Slider.Coffetab.FastFood.CategoryPage.xaml.g.cs:33

at FastFood.CategoryPage..ctor () [0x0001a] in /Users/Slider/Coffetab/FastFood/CategoryPage.xaml.cs:25 
at FastFood.MenuPage..ctor () [0x0004b] in /Users/Slider/Coffetab/FastFood/MenuPage.xaml.cs:14 
at FastFood.MainPage.OnLogin (System.Object sender, System.EventArgs e) [0x0002f] in

/Users/Slider/Coffetab/FastFood/MainPage.xaml.cs:29 at Xamarin.Forms.Button.Xamarin.Forms.IButtonController.SendClicked () [0x00020] in :0 at Xamarin.Forms.Platform.iOS.ButtonRenderer.OnButtonTouchUpInside (System.Object sender, System.EventArgs eventArgs) [0x0000e] in :0 at UIKit.UIControlEventProxy.Activated () [0x00007] in /Users/builder/data/lanes/2320/1f068b49/source/maccore/src/UIKit/UIControl.cs:37

at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in

/Users/builder/data/lanes/2320/1f068b49/source/maccore/src/UIKit/UIApplication.cs:77

at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in

/Users/builder/data/lanes/2320/1f068b49/source/maccore/src/UIKit/UIApplication.cs:61

at FastFood.iOS.Application.Main (System.String[] args) [0x0001a] in /Users/Slider/Coffetab/iOS/Main.cs:23_

What I'm doing wrong?

1

1 Answers

0
votes

Years later (for you) but I found a solution on a forum.

I've encountered this some other times with other components and NuGet packages. You'll probably have to live with the fact that you have to include a dummy line of code which instantiates the ExtendedSlider. It doesn't have to do anything, just reference it somewhere.

When you're using it in just XAML the compiler doesn't detect the reference and thus excludes the needed dll. Until the creator of the component finds some fix for this you'll have to use this workaround.

Source: https://forums.xamarin.com/discussion/comment/187222/#Comment_187222

So just add a random var foo = new YourComponentFromTheAssemblyInQuestion(); anywhere in your code and it shouldn't complain anymore.

Maybe this will help others stumbling upon the same issue later on like I did.