Uh oh!
There was an error while loading. Please reload this page.
Support reference type custom converters in source gen - #57592
Conversation
ghost
commented
Aug 17, 2021
Tagging subscribers to this area: @eiriktsarpalis, @layomia Issue DetailsFixes #56864
|
| metadataInitSource = $@"{JsonConverterTypeRef} converter = {typeMetadata.ConverterInstantiationLogic}; | ||
| {TypeTypeRef} typeToConvert = typeof({typeCompilableName}); | ||
| if (!converter.CanConvert(typeToConvert)) | ||
| {{ |
There was a problem hiding this comment.
Nit: given that there is a some amount of duplication between the ref type and value type generated code, is there any way we could splice in the nullable check, i.e some thing like
if(!converter.CanConvert(typeToConvert)){{{!typeof(T).IsValueType?"":EmitNullableTypeHandling()}?
There was a problem hiding this comment.
That is a fair suggestion, and I'll leave it up to @layomia to change it if desired. However, in this case I think it is more readable\understandable to have separate ifs since the amount of emit duplication is only 5 LOC or so.
steveharter
commented
Aug 19, 2021
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1148393523 |
steveharter
commented
Aug 23, 2021
/backport to release/6.0-rc1 |
Started backporting to release/6.0-rc1: https://github.com/dotnet/runtime/actions/runs/1159663823 |
Fixes#56864
Expect this to be ported to https://github.com/dotnet/runtime/tree/release/6.0