Since I updated to XF 3.5, I can't compile any view where there is an x:DataType attribute on an ItemTemplate.
Correct compilation.
An build failed with this message : Value cannot be null.
Pages/SearchPage/SearchPage.xaml : error : Value cannot be null.
Pages/SearchPage/SearchPage.xaml : error : Parameter name: type
at Mono.Cecil.Mixin.CheckType (System.Object type) [0x00012] in <fc280261b06a412d89649efff4649cd8>:0
at Mono.Cecil.ModuleDefinition.ImportReference (Mono.Cecil.TypeReference type, Mono.Cecil.IGenericParameterProvider context) [0x00000] in <fc280261b06a412d89649efff4649cd8>:0
at Mono.Cecil.ModuleDefinition.ImportReference (Mono.Cecil.TypeReference type) [0x00000] in <fc280261b06a412d89649efff4649cd8>:0
at Xamarin.Forms.Build.Tasks.ModuleDefinitionExtensions.ImportReference (Mono.Cecil.ModuleDefinition module, System.ValueTuple`3[T1,T2,T3] type) [0x00037] in <3fbac45ee5034384a87b31143f0cde2e>:0
at Xamarin.Forms.Build.Tasks.SetPropertiesVisitor+<CompileBindingPath>d__30.MoveNext () [0x002e3] in <3fbac45ee5034384a87b31143f0cde2e>:0
at Xamarin.Forms.Build.Tasks.SetPropertiesVisitor+<ProvideValue>d__29.MoveNext () [0x0047c] in <3fbac45ee5034384a87b31143f0cde2e>:0
at Xamarin.Forms.Build.Tasks.ILProcessorExtensions.Append (Mono.Cecil.Cil.ILProcessor processor, System.Collections.Generic.IEnumerable`1[T] instructions) [0x00017] in <3fbac45ee5034384a87b31143f0cde2e>:0
at Xamarin.Forms.Build.Tasks.SetPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x0014a] in <3fbac45ee5034384a87b31143f0cde2e>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x000ac] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00044] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Build.Tasks.SetPropertiesVisitor.SetDataTemplate (Xamarin.Forms.Xaml.IElementNode parentNode, Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Build.Tasks.ILContext parentContext, System.Xml.IXmlLineInfo xmlLineInfo) [0x00220] in <3fbac45ee5034384a87b31143f0cde2e>:0
at Xamarin.Forms.Build.Tasks.SetPropertiesVisitor.Visit (Xamarin.Forms.Xaml.ElementNode node, Xamarin.Forms.Xaml.INode parentNode) [0x00073] in <3fbac45ee5034384a87b31143f0cde2e>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x000ac] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00044] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00044] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.ElementNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Xaml.RootNode.Accept (Xamarin.Forms.Xaml.IXamlNodeVisitor visitor, Xamarin.Forms.Xaml.INode parentNode) [0x00079] in <c4cf206f62c5417f814e9ead9d453d58>:0
at Xamarin.Forms.Build.Tasks.XamlCTask.TryCoreCompile (Mono.Cecil.MethodDefinition initComp, Mono.Cecil.MethodDefinition initCompRuntime, Xamarin.Forms.Build.Tasks.ILRootNode rootnode, System.Exception& exception) [0x0041b] in <3fbac45ee5034384a87b31143f0cde2e>:0
Here is my Vs for mac information :
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.8.1 (build 4)
Installation UUID: 37cc8c40-d076-4974-8bf8-344f707f4364
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.0.0.0 ( / b40230c0)
Package version: 516000221
=== Mono Framework MDK ===
Runtime:
Mono 5.16.0.221 (2018-06/b63e5378e38) (64-bit)
Package version: 516000221
=== NuGet ===
Version: 4.8.0.5385
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
2.2.0
2.1.2
2.1.1
2.0.5
SDK: /usr/local/share/dotnet/sdk/2.2.101/Sdks
SDK Versions:
2.2.101
2.1.302
2.1.301
2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Updater ===
Version: 11
=== Xamarin.Android ===
Version: 9.1.8.0 (Visual Studio Enterprise)
Android SDK: /Users/jonathanantoine/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.4 (API level 19)
8.1 (API level 27)
SDK Tools Version: 26.1.1
SDK Platform Tools Version: 28.0.1
SDK Build Tools Version: 28.0.3
=== Microsoft Mobile OpenJDK ===
Java SDK: /Users/jonathanantoine/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.9
1.8.0-9
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Android Device Manager ===
Version: 7.8.1.0
Hash: 8924ea4a
=== Apple Developer Tools ===
Xcode 10.1 (14460.46)
Build 10B61
=== Xamarin.Mac ===
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.
=== Xamarin.iOS ===
Version: 12.2.1.15 (Visual Studio Enterprise)
Hash: d60abd198
Branch: d15-9
Build date: 2019-02-01 12:23:29-0500
=== Xamarin Inspector ===
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 708010004
Git revision: 8e2582c0fc1558364b67502b43d2e6a44ff6bc48
Build date: 2019-02-21 18:39:01+00
Build branch: release-7.8
Xamarin extensions: af96e69ddf566b275db40628f8530ca48a97f0b9
=== Operating System ===
Mac OS X 10.14.2
Darwin 18.2.0 Darwin Kernel Version 18.2.0
Mon Nov 12 20:24:46 PST 2018
root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64
=== Enabled user installed extensions ===
LiveXAML 1.3.31
NuGet Package Management Extensions 0.15
@jonathanantoine Can you share the XAML that is failing? Thanks!
here we go :)
<?xml version="1.0" encoding="utf-8"?>
<ContentPage
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:vm="clr-namespace:Podcasts.Pages.SearchPage"
xmlns:infra="clr-namespace:Podcasts.Infra"
xmlns:controls="clr-namespace:Podcasts.Controls"
xmlns:effects="clr-namespace:Podcasts.Effects"
Title="{infra:Translate Text=Discover_TabTitle}"
BackgroundColor="{StaticResource BackgroundLightGreyColor}"
x:Class="Podcasts.SearchPage">
<ContentPage.BindingContext>
<vm:SearchViewModel />
</ContentPage.BindingContext>
<Grid
CompressedLayout.IsHeadless="true"
RowSpacing="0">
<Grid.RowDefinitions>
<RowDefinition
Height="Auto" />
<RowDefinition
Height="*" />
</Grid.RowDefinitions>
<Grid
Grid.Row="1"
IsVisible="{Binding IsInSearchMode}">
<ListView
IsVisible="{Binding IsNotInError}"
SeparatorVisibility="None"
IsPullToRefreshEnabled="false"
ItemTapped="Handle_ItemTapped"
HasUnevenRows="false"
CachingStrategy="RecycleElement"
RowHeight="90"
ItemsSource="{Binding CurrentResults}">
<ListView.ItemTemplate>
<DataTemplate
x:DataType="vm:SearchResultViewModel">
<ViewCell>
<Grid
CompressedLayout.IsHeadless="true">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="*" />
</Grid.ColumnDefinitions>
<Grid
IsClippedToBounds="false"
HorizontalOptions="Fill"
HeightRequest="70"
RowSpacing="0"
Margin="10,5,10,5">
<Grid.ColumnDefinitions>
<ColumnDefinition
Width="70" />
<ColumnDefinition
Width="*" />
</Grid.ColumnDefinitions>
<Frame
IsClippedToBounds="true"
HeightRequest="70"
HasShadow="false"
Padding="0"
CornerRadius="5"
HorizontalOptions="Start"
VerticalOptions="Start">
<Image
BackgroundColor="Silver"
Aspect="Fill"
HeightRequest="70"
WidthRequest="70"
HorizontalOptions="Start"
VerticalOptions="Start"
Source="{Binding Data.Image600}" />
</Frame>
<StackLayout
Margin="0,-5,0,0"
Spacing="0"
Grid.Column="1">
<Label
TextColor="Black"
FontAttributes="Bold"
FontSize="16"
LineBreakMode="WordWrap"
MaxLines="2"
HorizontalTextAlignment="Start"
Text="{Binding CuratedTitle}" />
<Label
FontSize="12"
Opacity="0.7"
HorizontalTextAlignment="Start"
TextColor="{StaticResource MainColor}"
Text="{Binding NumberOfEpisodes}" />
<Label
FontSize="12"
Opacity="0.7"
MaxLines="2"
HorizontalTextAlignment="Start"
TextColor="Black"
Text="{Binding Data.Author}" />
</StackLayout>
</Grid>
</Grid>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</Grid>
</Grid>
</ContentPage>
By the way @samhouts, if I set "x:DataType="{x:Null}" to the first view in the item template fix the issue but disable compiled bindings.
Perhaps related to #5270
@samhouts seems to be a really different issue as I can't even build my project. How can I go further to help you? Is it possible to enable some extra logs to know what is exactly crashing xaml compilation?
@jonathanantoine thanks for reporting this. I don't see anything wrong with the xaml, so there might be something we do not handle well with your view model.
In order to evaluate this issue, we'd need a full project triggering the issue. Thanks a lot.
If you can't provide a repro, please try 3.6.0 which contains additional fixes that might or might not help you.
@jonathanantoine Since you didn't include the whole project, I can't test it. Can you try adding setters to all of the properties on your ViewModel and see if that helps? Thanks!
Hello @samhouts, you are right it seems that I forgot to add some files in it, sorry.
In the meantime, I found the root cause of my issue (without being able to have a repro projects - it's a lot of work if I don't want to give you my full project source) : I was using the "old project format". Moving to the new one fixed the issue and it compile allright now.
Old project format :
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
...
</Project>
New project format which fix the issue :
```
...
I hope this help you (or anyone having the same issue) fixing this bug.
Thanks for your help !
Interesting! Thanks for the update!!
You don't support the old project format?
You don't support the old project format?
we do. please provide a project so we can reproduce this issue. We'll reopen then. Project format shouldn't matter.
@StephaneDelcroix ok, thanks for the clarification. I do no more have the repro project as I fixed my issue by migrating.
for a clean check out we see this error intermittently on our build server - any idea why this is happening? we use the new project format
"Xamarin.Forms" Version="3.4.0.1008975"
MS Build Engine version 15.9.21+g9802d43bc3
"d:\j\workspace\ACMEMyApp_rc0.8\MyApp.sln" (Rebuild target) (1) ->
"d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj" (Rebuild target) (19) ->
(XamlC target) ->
App.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
App.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\BaleSizeFilterCriteria.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\BaleSizeFilterCriteria.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\DateRangeFilterCriteria.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\DateRangeFilterCriteria.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\FilterPicker.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\FilterPicker.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\GeofenceFilterCriteria.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\GeofenceFilterCriteria.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\InfoLayout.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\InfoLayout.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyCountdownDialogToastView.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyCountdownDialogToastView.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyDialogToastView.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyDialogToastView.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyLocationButton.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyLocationButton.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyToastView.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\MyToastView.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\NumberListFilterCriteria.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\NumberListFilterCriteria.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\NumberRangeFilterCriteria.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\NumberRangeFilterCriteria.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\PrimaryButton.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\PrimaryButton.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\SecondaryButton.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\SecondaryButton.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\TitleBar.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Controls\TitleBar.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\AboutPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\AboutPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\AddGeofencePage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\AddGeofencePage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\BalingPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\BalingPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\FiltersPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\FiltersPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\HomePage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\HomePage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\LoginPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\LoginPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\OfflineDataPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\OfflineDataPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\ReportsPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\ReportsPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\SaveFilterPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\SaveFilterPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\ScannerConnectionPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\ScannerConnectionPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\SettingsPage.xaml : error : Value cannot be null. [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Pages\SettingsPage.xaml : error : Parameter name: type [d:\j\workspace\ACMEMyApp_rc0.8\MyApp\MyApp.csproj]
Guys,
This is not resolved yet.
Forks, this is resolved ?
If yes then please provide the solution.
@SagarPanwala:- Is it resolved ? Because i am having same issue with Xamarin form 3.6 in iOS Application.
Most helpful comment
@jonathanantoine Can you share the XAML that is failing? Thanks!