@@ -14,13 +14,13 @@ namespace Orb.Core;
1414///
1515/// <para>Use <see cref="MultipartJsonSerializer"/> to construct or read instances of this class.</para>
1616/// </summary>
17- public readonly struct MultipartJsonElement ( )
17+ public readonly struct MultipartJsonElement
1818{
1919 /// <summary>
2020 /// A <see cref="JsonElement"/> with <see cref="BinaryContents">placeholders</see>
2121 /// for <see cref="BinaryContent"/>.
2222 /// </summary>
23- internal JsonElement Json { get ; init ; }
23+ internal JsonElement Json { get ; init ; } = default ;
2424
2525 /// <summary>
2626 /// A dictionary from placeholder string in <see cref="Json">the JSON</see> to
@@ -31,6 +31,8 @@ public readonly struct MultipartJsonElement()
3131
3232 public static implicit operator MultipartJsonElement ( JsonElement json ) => new ( ) { Json = json } ;
3333
34+ public MultipartJsonElement ( ) { }
35+
3436 public override string ToString ( ) =>
3537 JsonSerializer . Serialize (
3638 FriendlyJsonPrinter . PrintValue ( this ) ,
@@ -175,7 +177,7 @@ internal static Dictionary<Guid, BinaryContent> BinaryContents
175177
176178 static readonly ThreadLocal <
177179 Dictionary < JsonSerializerOptions , JsonSerializerOptions >
178- > MultipartSerializerOptionsCache = new ( ( ) => [ ] ) ;
180+ > MultipartSerializerOptionsCache = new ( ( ) => new ( ) ) ;
179181
180182 static readonly JsonSerializerOptions DefaultMultipartSerializerOptions =
181183 MultipartSerializerOptions ( new ( ) ) ;
@@ -206,7 +208,7 @@ public static MultipartJsonElement SerializeToElement<T>(
206208 var previousBinaryContents = CurrentBinaryContents . Value ;
207209 try
208210 {
209- CurrentBinaryContents . Value = [ ] ;
211+ CurrentBinaryContents . Value = new ( ) ;
210212 var element = JsonSerializer . SerializeToElement (
211213 value ,
212214 MultipartSerializerOptions ( options )
@@ -249,7 +251,7 @@ public static MultipartFormDataContent Serialize<T>(
249251 JsonSerializerOptions ? options = null
250252 )
251253 {
252- MultipartFormDataContent formDataContent = [ ] ;
254+ MultipartFormDataContent formDataContent = new ( ) ;
253255 var multipartElement = MultipartJsonSerializer . SerializeToElement ( value , options ) ;
254256 void SerializeParts ( string name , JsonElement element )
255257 {
0 commit comments