Source generator generates code using unsafe even if EnableUnsafeBlocks isn't enabled. We probably should check if it is not enabled and given a better diagnostic asking EnableUnsafeBlocks to be enabled. If the CsWinRT package is referenced, this isn't an issue. But when the source generator is ran standalone as part of the projection package, it is.
WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(680,31,680,54): error CS0227: Unsafe code may only appear if compiling with /unsafe
It is also seems for the system classes, we sometimes generate code when we don't need to like the string class as we see it as a valid winrt type but it technically isn't a winrt projected class.
Source generator generates code using unsafe even if EnableUnsafeBlocks isn't enabled. We probably should check if it is not enabled and given a better diagnostic asking EnableUnsafeBlocks to be enabled. If the CsWinRT package is referenced, this isn't an issue. But when the source generator is ran standalone as part of the projection package, it is.
WinRT.SourceGenerator\Generator.WinRTAotSourceGenerator\WinRTGenericInstantiation.g.cs(680,31,680,54): error CS0227: Unsafe code may only appear if compiling with /unsafe