Skip to main content



XmlSerializer fails in .NET 10 when loading RuleApplicationDef

Applies to: InRule Repository SDK 5.8.x to 5.9.x
This article was last updated: March 2026

Overview​

When upgrading applications to .NET 10, you may encounter failures when loading or converting rule applications using the InRule Repository SDK.

The failure occurs during construction of:

XmlSerializer(typeof(RuleApplicationDef))

This happens before any rule application data is read and prevents all rule applications from loading.

The behavior is caused by a change in the .NET 10 XML serialization engine.

Symptoms​

Applications may throw an exception similar to the following:

InvalidOperationException: There was an error reflecting type 'InRule.Repository.RuleApplicationDef'

Inner exception:

InvalidOperationException: Cannot serialize member with [Obsolete(IsError = true)]

Key characteristics:

  • The exception occurs during XmlSerializer type reflection.
  • The failure is not related to rule application content.
  • All rule applications fail to load.

Cause​

In .NET 10, XmlSerializer treats members marked with:

[Obsolete(IsError = true)]

as fatal errors during serialization and deserialization.

RuleApplicationDef, or one of its nested types, contains a deprecated member marked with IsError = true. When the serializer inspects the type, it throws an exception.

Earlier versions of .NET ignored these members. .NET 10 does not.

Resolution​

To restore pre-.NET 10 behavior, enable the runtime compatibility switch that instructs XmlSerializer to ignore obsolete members.

Add the following during application startup:

AppContext.SetSwitch("Switch.System.Xml.IgnoreObsoleteMembers", true);

This switch prevents the serializer from failing on members marked with [Obsolete(IsError = true)].

No changes are required to:

  • Rule applications
  • InRule SDK usage

This is the recommended workaround until official .NET 10 support is released.

When to troubleshoot​

Use this switch if:

  • Your application targets .NET 10, and\
  • You use the InRule Repository SDK to load or convert rule applications, for example:
    • RuleApplicationDef
    • FileSystemRuleApplicationReference
    • Custom serialization paths

Future support​

The InRule Product and Engineering teams are reviewing the .NET 10 serialization change and its impact on the SDK. Updated guidance will be published once formal support is completed.