Null reference exception in compiler when referencing duplicate type defined in another project #16970
Labels
Area-Compiler-Checking
Type checking, attributes and all aspects of logic checking
Bug
Triage-Investigate
Milestone
When a project has two types with the same name in the same namespace defined in two separate files, and the second of the two definitions is referenced in another project, I see
error FS0193: internal error: Object reference not set to an instance of an object
, indicating a null reference exception somewhere in the compiler. If I reference the first definition, I geterror FS0039: The value or constructor 'T1' is not defined
. I would expect the latter error in both cases.Repro steps
Provide the steps required to reproduce the problem:
error FS0193: internal error: Object reference not set to an instance of an object
.Minimal repro: https://gist.github.com/brianrourkeboll/169502b7cd20ec41f84a59cc0559b4b4
A/T1.fs
A/T2.fs
B/Program.fs
Expected behavior
I would expect to see
error FS0249: Two type definitions named 'T' occur in namespace 'A' in two parts of this assembly
in project A anderror FS0039: The value or constructor 'T1' is not defined
in project B when referencing either of the duplicate types.Actual behavior
I do see
error FS0249: Two type definitions named 'T' occur in namespace 'A' in two parts of this assembly
in project A, but I seeerror FS0193: internal error: Object reference not set to an instance of an object
when I reference the second of the two duplicate types in project B.Related information
I see this in Visual Studio 17.9.3 and 17.10.0 Preview 2, as well as in VS Code with Ionide with .NET SDK 8.0.202. I'm not sure how long this behavior has been around.
The text was updated successfully, but these errors were encountered: