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

XmlSerializer: Add GenerateSerializer overload with defaultNamespace argument #57024

Closed
wants to merge 3 commits into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,14 @@ private static XmlSerializer[] GetReflectionBasedSerializers(XmlMapping[] mappin
[UnconditionalSuppressMessage("SingleFile", "IL3000: Avoid accessing Assembly file path when publishing as a single file",
Justification = "Code is used on diagnostics so we fallback to print assembly.FullName if assembly.Location is empty")]
internal static bool GenerateSerializer(Type[]? types, XmlMapping[] mappings, Stream stream)
{
return GenerateSerializer(types, mappings, null, stream);
}

[RequiresUnreferencedCode("calls GenerateSerializerToStream")]
[UnconditionalSuppressMessage("SingleFile", "IL3000: Avoid accessing Assembly file path when publishing as a single file",
Justification = "Code is used on diagnostics so we fallback to print assembly.FullName if assembly.Location is empty")]
internal static bool GenerateSerializer(Type[]? types, XmlMapping[] mappings, string? defaultNamespace, Stream stream)
{
if (types == null || types.Length == 0)
return false;
Expand Down Expand Up @@ -669,7 +677,7 @@ internal static bool GenerateSerializer(Type[]? types, XmlMapping[] mappings, St
}
}

return TempAssembly.GenerateSerializerToStream(mappings, types, null, assembly, new Hashtable(), stream);
return TempAssembly.GenerateSerializerToStream(mappings, types, defaultNamespace, assembly, new Hashtable(), stream);
}

[RequiresUnreferencedCode("calls Contract")]
Expand Down