Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review error messages in JSON #72254

Merged
merged 4 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/libraries/System.Text.Json/src/Resources/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
<value>The requested operation requires an element of type '{0}', but the target element has type '{1}'.</value>
</data>
<data name="TypeInfoResolverImmutable" xml:space="preserve">
<value>Default TypeInfoResolver and custom TypeInfoResolver cannot be changed after first usage.</value>
<value>Cannot add callbacks to the 'Modifiers' property after the resolver has been used for the first time.</value>
</data>
<data name="TypeInfoImmutable" xml:space="preserve">
<value>JsonTypeInfo cannot be changed after first usage.</value>
Expand Down Expand Up @@ -576,7 +576,7 @@
<value>An item with the same key has already been added. Key: {0}</value>
</data>
<data name="SerializerContextOptionsImmutable" xml:space="preserve">
<value>A 'JsonSerializerOptions' instance associated with a 'JsonSerializerContext' instance cannot be mutated once the context has been instantiated.</value>
<value>JsonSerializerOptions instances cannot be modified once encapsulated by a JsonSerializerContext. Such encapsulation can happen either when calling 'JsonSerializerOptions.AddContext' or when passing the options instance to a JsonSerializerContext constructor.</value>
</data>
<data name="ConverterForPropertyMustBeValid" xml:space="preserve">
<value>The generic type of the converter for property '{0}.{1}' must match with the specified converter type '{2}'. The converter must not be 'null'.</value>
Expand All @@ -599,15 +599,9 @@
<data name="NodeJsonObjectCustomConverterNotAllowedOnExtensionProperty" xml:space="preserve">
<value>A custom converter for JsonObject is not allowed on an extension property.</value>
</data>
<data name="MetadataInitFuncsNull" xml:space="preserve">
<value>Invalid configuration provided for 'propInitFunc', 'ctorParamInitFunc' and 'serializeFunc'.</value>
</data>
<data name="NoMetadataForTypeProperties" xml:space="preserve">
<value>TypeInfoResolver '{0}' did not provide property metadata for type '{1}'.</value>
</data>
<data name="NoDefaultOptionsForContext" xml:space="preserve">
<value>To specify a serialization implementation for type '{0}'', context '{0}' must specify default options.</value>
</data>
<data name="FieldCannotBeVirtual" xml:space="preserve">
<value>A 'field' member cannot be 'virtual'. See arguments for the '{0}' and '{1}' parameters. </value>
</data>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,6 @@ public static void ThrowInvalidOperationException_SerializerOptionsImmutable(Jso
throw new InvalidOperationException(message);
}

[DoesNotReturn]
public static void ThrowInvalidOperationException_SerializerContextOptionsImmutable()
{
throw new InvalidOperationException(SR.SerializerContextOptionsImmutable);
}

[DoesNotReturn]
public static void ThrowInvalidOperationException_TypeInfoResolverImmutable()
{
Expand Down Expand Up @@ -662,12 +656,6 @@ public static void ThrowInvalidOperationException_NoMetadataForType(Type type, I
throw new InvalidOperationException(SR.Format(SR.NoMetadataForType, type, resolver?.GetType().FullName ?? "<null>"));
}

[DoesNotReturn]
public static void ThrowInvalidOperationException_MetadatInitFuncsNull()
{
throw new InvalidOperationException(SR.Format(SR.MetadataInitFuncsNull));
}

public static void ThrowInvalidOperationException_NoMetadataForTypeProperties(IJsonTypeInfoResolver? resolver, Type type)
{
throw new InvalidOperationException(SR.Format(SR.NoMetadataForTypeProperties, resolver?.GetType().FullName ?? "<null>", type));
Expand All @@ -678,11 +666,6 @@ public static void ThrowInvalidOperationException_NoMetadataForTypeCtorParams(IJ
throw new InvalidOperationException(SR.Format(SR.NoMetadataForTypeCtorParams, resolver?.GetType().FullName ?? "<null>", type));
}

public static void ThrowInvalidOperationException_NoDefaultOptionsForContext(JsonSerializerContext context, Type type)
{
throw new InvalidOperationException(SR.Format(SR.NoDefaultOptionsForContext, context.GetType(), type));
}

[DoesNotReturn]
public static void ThrowMissingMemberException_MissingFSharpCoreMember(string missingFsharpCoreMember)
{
Expand Down