Unfortunately, I have no minimal sample of the issue, but I've pushed the repo publicly, where it should be reproducable: https://github.com/Yeah69/ContainerFeatureSampleComparison
I've implemented a source generator, which iterates through the referenced assemblies and tries to extract the code of files which have a specific attribute. The code extraction looks like this:
var sampleText = attributeData.ApplicationSyntaxReference is {} a
? a.GetSyntax().GetLocation().SourceTree is {} b
? b.GetText().ToString()
: "InnerNull"
: "OuterNull";
In certain situations this works fine, in others not. Therefore, I assume a strange flakyness here.
I use Rider as the IDE for development and the .Net SDK 7.0.302 (if that matters).
The output shown in the IDE Source Generator listing works fine:

The file generated with EmitCompilerGeneratedFiles however is faulty:
Same situation when the Release-version of the Composition-project is executed. attributeData.ApplicationSyntaxReference being null in the faulty situations has to be the error. But it riddles me what would cause it, because for the IDE output it seems to work fine. I appreciate any help with this issue.