我搜索了SO找到this問題,但答案沒有爲我工作,所以問題依然存在。迴歸問題:XamlCompilation錯誤值不能爲空,參數名稱:方法
就我個人而言,我認爲這個問題可能與某些配置「東西」有關,但我不知道從哪裏開始尋找解決方法。據我所知,我沒有改變任何配置設置超出標準(只是使用標準的新項目方法)。這裏是我的問題上的一些細節:
就這樣發生,今天是第一次嘗試XamlC功能。起初,我試着在我App.cs文件彙編級屬性:
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
編譯後,我得到一大堆的都是相同的錯誤。我在使用TemplateControl的任何頁面上也遇到了不同的錯誤。所以我把它關閉的裝配水平,把一個單一的類級屬性在一個頁面上,它仍然失敗,相同的錯誤:
Value cannot be null.
Parameter name: method
我捅圍繞#2,發現大約一年前有人有同樣的問題(這裏),但他們表示他們通過將Xam Forms升級到最新版本來解決這個問題。由於我在最新的穩定版本,我沒有去那裏。
我在我的應用程序的幾個頁面上試過這個類級屬性,只發現它在我的整個應用程序的單個頁面上工作......只是發生這個頁面在XAML標記中有零綁定。我想知道是否引入了一個導致它炸燬的bug。
標記網頁的不工作:
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Prepify.App.Pages.MainMenu"
xmlns:controls="clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin.Abstractions"
BackgroundColor="White"
Title="Menu">
<StackLayout VerticalOptions="FillAndExpand">
<ListView
Header="{Binding .}"
SeparatorColor="{StaticResource dividerColor}"
HasUnevenRows="True"
ItemSelected="AppMenu_OnItemSelected"
ItemTapped="AppMenu_OnItemTapped"
ItemsSource="{Binding Items}"
x:Name="appMenu">
<ListView.HeaderTemplate>
<DataTemplate>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="30"/>
<ColumnDefinition Width="10"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="30"/>
<RowDefinition Height="80"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="5"/>
</Grid.RowDefinitions>
<BoxView Grid.ColumnSpan="4" Grid.RowSpan="4" BackgroundColor="{StaticResource grayDark}"/>
<controls:CircleImage Grid.Column="1" Grid.Row="1" HorizontalOptions="Start" VerticalOptions="End" Source="{Binding ProfileImageUrl}" WidthRequest="75" HeightRequest="75"/>
<Label Grid.Column="1" Grid.Row="2" Text="{Binding FullName}"/>
<ActivityIndicator Grid.Column="2" Grid.Row="2" IsVisible="{Binding IsBusy}" IsRunning="{Binding IsBusy}" Color="White" WidthRequest="20" HeightRequest="20" VerticalOptions="Center" />
</Grid>
</DataTemplate>
</ListView.HeaderTemplate>
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout Orientation="Horizontal" >
<StackLayout.Padding>
<OnPlatform x:TypeArguments="Thickness" Android="15,15,15,15" iOS="25,12,15,12" />
</StackLayout.Padding>
<Image Source="{Binding Icon}" VerticalOptions="Center" WidthRequest="20" HeightRequest="20"/>
<Image WidthRequest="20"/>
<Label Text="{Binding Label}" VerticalOptions="Center" TextColor="{Binding LabelColor}" Style="{DynamicResource ListItemTextStyle}"/>
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage>
標記單頁面,做工作(注意,沒有任何地方綁定):
<MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Prepify.App.Pages.Root"
xmlns:pages="clr-namespace:Prepify.App.Pages;assembly=Prepify.App"
MasterBehavior="Popover"
Title="Make Preparedness Easy">
<MasterDetailPage.Master>
<pages:MainMenu/>
</MasterDetailPage.Master>
</MasterDetailPage>
我使用所有的最新作張貼這個問題。 的Visual Studio 2015年 Xamarin.Forms 2.3.3.193 Xamarin.VS 4.3.0.784