Written By: 川俣 晶
Blazor 0.70でJson.NETが使用できない。使おうとすると例外で落ちる。
不明。(おそらく、mscorelibからSystem.Collections.Specialized.INotifyCollectionChangedを読み込もうとして失敗している。そんなモジュールはBlazorの世界には存在しないから)
Json.NET throws TypeLoadException on Blazor 0.7.0 #11848に書かれた以下のコードは動作しなかった。
public class Startup
{
static Startup()
typeof(System.ComponentModel.INotifyPropertyChanging).GetHashCode();
typeof(System.ComponentModel.INotifyPropertyChanged).GetHashCode();
}
おそらく、例外情報にあるインターフェース名に置き換えないと動作しない。
筆者の場合、例外情報にSystem.Collections.Specialized.INotifyCollectionChangedという名前があったので、以下のように書き換えたところ動作した。
typeof(System.Collections.Specialized.INotifyCollectionChanged).GetHashCode();
これで動作する理由は目的の型がメモリ上に読み込まれるため、改めてモジュールをチェックに行かなくなるから。(たぶん)
Json.NET throws TypeLoadException on Blazor 0.7.0 #1692
Json.NET throws TypeLoadException on Blazor 0.7.0 #11848