Closed vineeththomasalex closed 1 month ago
LGTM. Consider adding unit test for the generated vs expected JSON to ensure this does not regress in the future.
LGTM. Consider adding unit test for the generated vs expected JSON to ensure this does not regress in the future.
As I understand, this was technically not a regression. The .Net7 breaking change just made it necessary to explicitly declare the TypeInfoResolver property. There is no change in the JSON.
Summary of the pull request
Fixes an issue with JsonSerializerOptions caused by this breaking change in .Net8 that is mysteriously not hitting on Dev builds (not just my computer).
References and relevant issues
https://github.com/microsoft/devhome/issues/3573
Detailed description of the pull request / Additional comments
.Net8 requires explicit declaration of TypeInfoResolver in JsonSerializerOptions for complex objects. The failure stack in Canary build was: *** WARNING: Unable to verify checksum for C:\Program Files\WindowsApps\Microsoft.Windows.DevHomeGitHubExtension.Canary_0.1700.585.0_x64__8wekyb3d8bbwe\System.Text.Json.dll
Child-SP RetAddr Call Site 00 000000c1
197bdfd0 00007ffe
e916b423 KERNELBASE!RaiseException+0x6c 01 000000c1197be0b0 00007ffe
e916adc9 coreclr!RaiseTheExceptionInternalOnly+0x26b [D:\a_work\1\s\src\coreclr\vm\excep.cpp @ 2795] 02 000000c1197be1c0 00007ffe
89695558 coreclr!IL_Throw+0xb9 [D:\a_work\1\s\src\coreclr\vm\jithelpers.cpp @ 4247] 03 000000c1197be320 00007ffe
db1c1e96 System_Text_Json!System.Text.Json.ThrowHelper.ThrowInvalidOperationException_JsonSerializerIsReflectionDisabled()+0x48 04 000000c1197be360 00007ffe
db1c102c System_Text_Json!System.Text.Json.JsonSerializerOptions.ConfigureForJsonSerializer()+0x36 05 000000c1197be390 00007ffe
dba1fae1 System_Text_Json!System.Text.Json.JsonSerializer.GetTypeInfo(System.Text.Json.JsonSerializerOptions, System.Type)+0x2c 06 000000c1197be3d0 00007ffe
dba1ff7b System_Text_Json!System.Text.Json.JsonSerializer.GetTypeInfo[System.__Canon, System.Private.CoreLib]+0x31 07 000000c1197be420 00007ffe
db9f9c20 System_Text_Json!System.Text.Json.JsonSerializer.Serialize[[System.Canon, System.Private.CoreLib]](System.Canon, System.Text.Json.JsonSerializerOptions)+0x2b 08 000000c1197be460 00007ffe
da92fcd0 GitHubExtension!GitHubExtension.Helpers.Json.Stringify[System.__Canon, System.Private.CoreLib]+0x30 09 000000c1197be4a0 00007ffe
daa3bedc GitHubExtension!GitHubExtension.DeveloperId.LoginUIPage.UpdateExtensionAdaptiveCard(Microsoft.Windows.DevHome.SDK.IExtensionAdaptiveCard)+0x30 0a 000000c1197be4f0 00007ff8
19f77503 Microsoft_Windows_DevHome_SDK_Lib!ABI.Microsoft.Windows.DevHome.SDK.IExtensionAdaptiveCardSession.Do_Abi_Initialize_0(IntPtr, IntPtr, IntPtr*)+0x6cFixed using the recommended way in breaking change
Validation steps performed
Ran tests, automated and manually. Couldn't repro original bug on Dev build, but this doesn't break anything on Dev build.
PR checklist