Skip to content

[Bug] ToJsonString does not serialize all fields of MSAL exception leading to data loss when deserialized #4371

@crmann1

Description

@crmann1

Library version used

4.54

.NET version

.net framework 4.7 .net 6, net 8

Scenario

PublicClient - desktop app

Is this a new or an existing app?

The app is in production, and I have upgraded to a new version of MSAL

Issue description and reproduction steps

When the broker additional fields and telemetry fields were added the tojson and fromjson methods were not updated to include serializing the additional fields.

Relevant code snippets

MSAL Exception
    public string ToJsonString()
    public static MsalException FromJsonString(string json)

are missing
        public const string BrokerErrorContext = "BrokerErrorContext";
        public const string BrokerErrorTag = "BrokerErrorTag";
        public const string BrokerErrorStatus = "BrokerErrorStatus";
        public const string BrokerErrorCode = "BrokerErrorCode";
        public const string BrokerTelemetry = "BrokerTelemetry";

Expected behavior

Those fields should also be serialized.

Identity provider

Microsoft Entra ID (Work and School accounts and Personal Microsoft accounts)

Regression

No response

Solution and workarounds

No response

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions