MessagePack.Formatters.System_Globalization_DateTimeFormatFlagsFormatter6 is attempting to implement an inaccessible interface
まだ誰も着手していません。
評価
調査の方向性
報告された .NET Framework 4.8 の再現で MessagePackSerializer.Typeless.Serialize から開始し、スタックをたどって DynamicEnumResolver.BuildType と System_Globalization_DateTimeFormatInfoFormatter6 に進んでください。inaccessible-interface TypeLoadException を確認し、関連する resolver または formatter の動作を特定してください。issue ではソースファイルもテストも指定されていないため、完了とはこの例外なしでシリアル化が完了することを意味します。
索引モデルが issue の本文から書いたものです。
説明
Bug description
I am attempting to serialise a .NET Framework 4.8 object using MessagePackSerializer.Typeless.Serialize(). I receive a
MessagePack.MessagePackSerializationException, Failed to serialize System.Object value, full details below. Inner exception is:
TypeLoadException: Type 'MessagePack.Formatters.System_Globalization_DateTimeFormatFlagsFormatter6' from assembly 'MessagePack.Resolvers.DynamicEnumResolver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.
Repro steps
UserDTO userDTO = new UserDTO(); //
byte[] inbyt = MessagePackSerializer.Typeless.Serialize(userDTO);
Expected behavior
Class is serialised.
Actual behavior
MessagePack.MessagePackSerializationException
HResult=0x80131500
Message=Failed to serialize System.Object value.
Source=MessagePack
StackTrace:
at MessagePack.MessagePackSerializer.Serialize[T](MessagePackWriter& writer, T value, MessagePackSerializerOptions options)
at MessagePack.MessagePackSerializer.Serialize[T](T value, MessagePackSerializerOptions options, CancellationToken cancellationToken)
at MessagePack.MessagePackSerializer.Typeless.Serialize(Object obj, MessagePackSerializerOptions options, CancellationToken cancellationToken)
at Amt.AmtBusinessObject.FormatConverter.ObjectToByteArray(Object obj) in C:\git\amt\AmtClient\AmtObj\FormatConverter\FormatConverter.cs:line 34
at Amt.Data.GetAmtUser.GetUserDetailsC(Int32 userId, String Ip_Address, Int32 amtMode, Byte[] additionalLoggingFields) in C:\git\amt\AmtClient\AmtDataWCF\GetAmtUser.cs:line 481
at Amt.Data.GetStartup.GetUserInfoAAD(String oId, Byte[] _wuserGroups, String Ip_Address, Int32[] fileSizes, String cacheLastModChange, String databaseID, String currentStatus, Boolean forceRewrite, Int32 amtMode, Byte[] additionalLoggingFields) in C:\git\amt\AmtClient\AmtDataWCF\GetStartup.cs:line 204
This exception was originally thrown at this call stack:
System.Reflection.Emit.TypeBuilder.CreateTypeNoLock()
System.Reflection.Emit.TypeBuilder.CreateTypeInfo()
MessagePack.Resolvers.DynamicEnumResolver.BuildType(System.Type, bool)
MessagePack.FormatterResolverExtensions.Throw(System.TypeInitializationException)
MessagePack.FormatterResolverExtensions.GetFormatterWithVerify(MessagePack.IFormatterResolver)
MessagePack.Formatters.System_Globalization_DateTimeFormatInfoFormatter6.Serialize(ref MessagePack.MessagePackWriter, System.Globalization.DateTimeFormatInfo, MessagePack.MessagePackSerializerOptions)
MessagePack.Formatters.System_Globalization_CultureInfoFormatter4.Serialize(ref MessagePack.MessagePackWriter, System.Globalization.CultureInfo, MessagePack.MessagePackSerializerOptions)
MessagePack.Formatters.TypelessFormatter.Serialize(ref MessagePack.MessagePackWriter, object, MessagePack.MessagePackSerializerOptions)
...
[Call Stack Truncated]
Inner Exception 1:
TypeLoadException: Type 'MessagePack.Formatters.System_Globalization_DateTimeFormatFlagsFormatter6' from assembly 'MessagePack.Resolvers.DynamicEnumResolver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.
- Version used: 3.1.3
- Runtime: .NET Framework 4.8
Additional context
I can successfully serialise other classes using MessagePackSerializer.Typeless.Serialize(), so assume the issue might in the specific class UserDTO, but wondering if there are any known issues.
- 主要言語
- C#
- スター
- 6.8k
- フォーク
- 783
- 平均マージ
- 19時間 47分
- マージ済み PR(30日)
- 3
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
MessagePack-CSharp/MessagePack-CSharp のほかの issue
-
SerializableMemberTypeAnalyzer throws AD0001 when any referenced assembly has an assembly-level attribute with a single array argument対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
MessagePack-CSharp/MessagePack-CSharp#2324 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
MessagePack-CSharp/MessagePack-CSharp#2276 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
MessagePack-CSharp/MessagePack-CSharp#2252 · コメント 3 件 ·
-
dynamic type fails sourcegenerator CS8785 'MessagePackGenerator' failed to generate source.対応中かも @1AbdullahButt が 13 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
MessagePack-CSharp/MessagePack-CSharp#2318 · コメント 2 件 ·
MessagePack-CSharp/MessagePack-CSharp の issue をすべて見る
似ている issue
-
type:task ux
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
elsa-workflows/elsa-foundation#5253 ·
メンテナーはふだん 1 日以内に返信