dotnet/Documentation/compatibility/WCF-AddressHeaderCollection...

1.3 KiB

WCF AddressHeaderCollection now throws an ArgumentException if an addressHeader element is null

Scope

Minor

Version Introduced

4.7.1

Source Analyzer Status

NotPlanned

Change Description

Starting with the .NET Framework 4.7.1, the M:System.ServiceModel.Channels.AddressHeaderCollection.#ctor(System.Collections.Generic.IEnumerable{System.ServiceModel.Channels.AddressHeader}) constructor throws an T:System.ArgumentException if one of the elements is null. In the .NET Framework 4.7 and earlier versions, no exception is thrown.

If you encounter compatibility issues with this change on the .NET Framework 4.7.1 or a later version, you can opt-out of it by adding the following line to the <runtime> section of the app.config file::

<configuration>
    <runtime>
	    <AppContextSwitchOverrides value="Switch.System.ServiceModel.DisableAddressHeaderCollectionValidation=true" />
	</runtime>
</configuration>

Affected APIs

  • M:System.ServiceModel.Channels.AddressHeaderCollection.#ctor(System.Collections.Generic.IEnumerable{System.ServiceModel.Channels.AddressHeader})

Category

  • Windows Communication Foundation (WCF)