Sometimes, in customized code, roslyn cannot analyze the correct namespace of some symbols (or maybe not?), and code like this is generated:

We need to fix this.
The above code was generated when we have the following customization:

To reproduce:
Prepare typespec:
model Foo {
bar?: Bar;
}
model Bar {
b?: string;
}
In the generated code, add the following:
[CodeGenSerialization(nameof(Bars), "bars"]
public partial class Foo
{
public IList<Bar> Bars {get;}
}
then generate the code.