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

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

Closed
crmann1 opened this issue Oct 10, 2023 · 1 comment · Fixed by #4376

Comments

@crmann1
Copy link
Contributor

crmann1 commented Oct 10, 2023

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

@crmann1 crmann1 added untriaged Do not delete. Needed for Automation needs attention Delete label after triage labels Oct 10, 2023
@bgavrilMS bgavrilMS added VS Feature Request public-client WAM and removed untriaged Do not delete. Needed for Automation needs attention Delete label after triage labels Oct 10, 2023
@bgavrilMS
Copy link
Member

bgavrilMS commented Oct 10, 2023

Hah, I always wondered if anybody actually uses ToJsonString / FromJsonString. I guess I know now :)

Are you serializing these so that you can store the exception in some DB?

@pmaytak pmaytak self-assigned this Oct 12, 2023
@pmaytak pmaytak added this to the 4.57.0 milestone Oct 12, 2023
@pmaytak pmaytak changed the title [Bug] ToJson does not serialize all fields of MSAL exception leading to data loss when deserialized [Bug] ToJsonString does not serialize all fields of MSAL exception leading to data loss when deserialized Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment