dotnet / orleans

Cloud Native application framework for .NET
https://docs.microsoft.com/dotnet/orleans
MIT License
10.06k stars 2.03k forks source link

CodeGenerator should warn/err when trying to generate for inaccessible types #8037

Closed koenbeuk closed 1 year ago

koenbeuk commented 1 year ago

Currently, when applying [GenerateSerializer] on a private class (nested within), no code gets generated as this class is then silently ignored by the code generator https://github.com/dotnet/orleans/blob/4a6ddcdb059f4f113998b4ee4fcb1879a9697900/src/Orleans.CodeGenerator/CodeGenerator.cs#L340

Instead, I propose we generate an error as the source generator is unable to fulfill the request.

This is currently happening within the orleans framework, e.g. here: https://github.com/dotnet/orleans/blob/4a6ddcdb059f4f113998b4ee4fcb1879a9697900/src/Orleans.EventSourcing/CustomStorage/LogViewAdaptor.cs#L76

ReubenBond commented 1 year ago

This would be a welcome change, thanks for suggesting it, @koenbeuk. Especially now that we have a way to surface errors to the IDE (the hacky way which we're using for now is by throwing a certain diagnostic exception, but it's of course not ideal)

ReubenBond commented 1 year ago

Fixed in #8087