Type mismatch error when building a solution with type provider (since .NET 10)
- Dominant language
- F#
- Stars
- 4.3k
- Forks
- 876
- Avg merge
- 4d 22h
- Merged PRs (30d)
- 144
Description
Hello,
I think I'm still experiencing https://github.com/dotnet/fsharp/issues/20010 / https://github.com/dotnet/fsharp/pull/19969 even though I updated my SDK to v10.0.400. (Can you confirm the fix is actually included in this version?)
Basically, I have a solution with multiple projects and multiple type providers providing erased types.
I get random type errors related to the type provider, indicating that two types with the same name are not compatible, e.g.:
```
error FS3033: The type provider 'FSharp.Data.WsdlProviderImplementation+WsdlProvider' reported an error: Type mismatch when building 'value': the type of the field was incorrect. Expected 'PlanningFilter', but received type 'PlanningFilter'. (Parameter 'receivedType')
```
The build error occurs 8 times out of 10 when building in the IDE (VS2026), and 10 times out of 10 when using `dotnet build` or `dotnet publish` on the CLI.
Strangely, the issue does not occur in my CI pipeline. Maybe the container only has one virtual CPU, avoiding the issue entirely?
**Repro steps**
Target .NET 10 and build a multi-project solution with type providers. I'm not sure of the exact triggers of the issue.
Unfortunately, I cannot share the project I'm working on, and it seems complicated to isolate the issue.
I'll be happy to provide logs if you can tell me how to get more detailed information than what the build normally outputs...
**Known workarounds**
When downgrading to .NET 9 (using a global.json file), the problem disappears.
Specifying `false` in the failing project also fixes the issue when targeting .NET 10.
**Related information**
* Operating system: Windows 11
* .NET Runtime kind (.NET Core, .NET Framework, Mono): .NET Core 10
* Editing Tools (e.g. Visual Studio Version, Visual Studio): Visual Studio / Powershell CLI
Contributor guide
Research direction
Start by reproducing the reported multi-project .NET 10 solution with multiple erased type providers using dotnet build or dotnet publish, comparing parallel and non-parallel compilation. Use the global.json downgrade to .NET 9 as a control; done means identifying the trigger and preventing the inconsistent same-name type errors without requiring ParallelCompilation=false.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fsharp
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100