発生する問題
Unity 2020 を使用しているプロジェクトで Azure Storage Blobs を使っていたのですが、Unity 2021 にアップデートした時に以下のようなエラーが発生しました。
Exception : TypeInitializationException
Root Exception : NotImplementedException
Message : The method or operation is not implemented.
Unity フォーラムでも同じようなエラーが発生している人がいました。
この NotImplementedException
エラーは Unity が使用している .NET のバージョンと NuGet で取得できるライブラリのバージョンが一致していないのが原因です。
ちなみに Unity 2020 では以下のバージョンを利用していました。
Azure.Core : ver.1.19.0
Azure.Storage.Blobs : ver.12.10.0
Azure.Storage.Common : ver.12.9.0
解決方法
NuGet で Azure.Storage.Blobs
をインストールすると Azure.Core
は ver.1.19.0
が依存関係でインストールされるのですが、これが Unity と相性が悪かったので以下のようにしました。
Azure.Core : ver.1.21.0
Azure.Storage.Blobs : ver.12.10.0
Azure.Storage.Common : ver.12.9.0
これで無事に Unity で Azure.Storage.Blobs を利用することができました。