2017-12-14 21 views
0

15.5.1へのアップグレード以降、私のXamarinプロジェクトはもう動作していないようです。ページをロードする際XamarinフォームAndroid MethodAccessException

は、私はこのエラーを取得:

System.MethodAccessException: Method Xamarin.Forms.View:.ctor()' is inaccessible from method MyApp.MyPage.InitializeComponent()'

しかし、このページは正確に働いている私の他のページのように構築されていますが、私は、検索を開始することは考えています。これはどこから来たのでしょうか?私はXamarin.Formsプラグインバージョン2.5.0.121934を使用します。

編集:編集2

public partial class MyPage : global::Xamarin.Forms.ContentPage { 
     [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Xamarin.Forms.Build.Tasks.XamlG", "0.0.0.0")] 
     private void InitializeComponent() { 
      global::Xamarin.Forms.Xaml.Extensions.LoadFromXaml(this, typeof(MyPage)); 
     } 
    } 

:例外が立ち上がったファイルを生成した。これは、自動の内容である

namespace MyApp 
{ 
    public partial class MyPage : ContentPage 
    { 
     MyPageVM viewModel; 
     public PNewWeighing(String information) 
     { 
      this.InitializeComponent(); 

      viewModel = new MyPageVM(); 
      viewModel.information = information; 
      BindingContext = viewModel; 
     } 

     protected override bool OnBackButtonPressed() 
     { 
      viewModel.OnNavigateCancelCommand(); 
      return true; 
     } 
    } 
} 

そして

<?xml version="1.0" encoding="UTF-8"?> 
<ContentPage 
    xmlns="http://xamarin.com/schemas/2014/forms" 
    xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" 
    x:Class="MyApp.MyPage" 
    x:Name="MyPage" 
    NavigationPage.HasBackButton="False" 
    NavigationPage.HasNavigationBar="False"> 
<ContentPage.Padding> 
    <OnPlatform 
      x:TypeArguments="Thickness" 
      iOS="20, 40, 20, 20" 
      Android="20, 20, 20, 20" 
      WinPhone="20, 20, 20, 20" /> 
</ContentPage.Padding> 
<ContentPage.Content> 
    <ScrollView> 
    <Grid 
     HorizontalOptions="FillAndExpand" 
     VerticalOptions="FillAndExpand" 
     <Grid.ColumnDefinitions> 
      <ColumnDefinition Width="*" /> 
     </Grid.ColumnDefinitions> 
      <Grid.RowDefinitions> 
       <RowDefinition Height="Auto" /> 
       <RowDefinition Height="*" /> 
       <RowDefinition Height="Auto" /> 
      </Grid.RowDefinitions> 

     <Label 
      Grid.Row="0" 
      Grid.ColumnSpan="2" 
      Text="{Binding Text}" 
      FontAttributes="Bold" /> 

     <!-- Placeholder --> 
     <View 
      Grid.Row="1" 
      Grid.ColumnSpan="2" /> 

     <!-- General controls --> 

    </Grid> 
    </ScrollView> 
</ContentPage.Content> 

答えて

1

私は確信していませんが、あなたはできるページのコンストラクタでthis.InitializeComponent()を使用してみてください。

+0

何も変わっていないことを試してみました。/いくつかのページがうまくいくのはちょっと変わったことです。私は別のテストをして、もう一方の同じエラーを受け取りました。 – Marcel

+1

本当に奇妙です、なぜそれが動作しなかったのか分かりません。私はさらに検索します – W0RT4

+0

私も、ありがとう男! – Marcel

関連する問題