Skip to content

Commit

Permalink
System.Reflection.MissingMetadataExceptionの回避
Browse files Browse the repository at this point in the history
  • Loading branch information
roamschemer committed May 18, 2020
1 parent 0af740e commit a08d848
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
14 changes: 13 additions & 1 deletion XamarinJson/XamarinJson.UWP/Properties/Default.rd.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,19 @@


<!-- Add your application specific runtime directives here. -->

<!-- ここから -->
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterString" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterUri" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterBoolean" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterInt32" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterInt16" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterByte" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterDecimal" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterGuid" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterEnum" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterDateTime" Dynamic="Required All" />
<Type Name="System.Text.Json.Serialization.Converters.JsonConverterDateTimeOffset" Dynamic="Required All" />
<!-- ここまで -->

</Application>
</Directives>
2 changes: 2 additions & 0 deletions XamarinJson/XamarinJson.UWP/XamarinJson.UWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<EnableGatekeeperAnalysis>false</EnableGatekeeperAnalysis>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
Expand All @@ -88,6 +89,7 @@
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
<EnableGatekeeperAnalysis>true</EnableGatekeeperAnalysis>
</PropertyGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
Expand Down
26 changes: 26 additions & 0 deletions XamarinJson/XamarinJson/Models/CoreModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,32 @@ public void DeletePerson(Person person) {
public void Clear() => Persons.Clear();
}

//コンストラクタの記述がないのでOK
public class TestClass1 {
public string Name { get; set; }
}

//パラメータなしのコンストラクタがないのでNG
public class TestClass2 {
public string Name { get; set; }

public TestClass2(string name) {
Name = name;
}
}

//パラメータなしのコンストラクタ(オーバーロード)があるのでOK
public class TestClass3 {
public string Name { get; set; }

public TestClass3() {
}

public TestClass3(string name) {
Name = name;
}
}

public class CoreModel : BindableBase {

public ObservableCollection<Category> Categorys { get; set; } = new ObservableCollection<Category>();
Expand Down

0 comments on commit a08d848

Please sign in to comment.