This issue has been moved from a ticket on Developer Community.
This repository demonstrates a bug in the F# build system related to type providers and units of measure across different projects.
The issue is that changing the unit of measure in a record type is not always noticed by the build system, causing errors to not appear, or not go away
(depending on whether your edit is causing or fixing a units-of-measure mismatch).
Steps to Reproduce
-
**Initial State (build error) **
- In
ClassLibrary1/TypeWIthUnits.fs, the record is defined as:
type RecordWithUnits =
{
Value: int<a>
}
- In
UnitsMismatch/Usage.fs), a value of type int<b> is supplied to RecordWithUnits.
- Result: The project will not build due to a units-of-measure mismatch error.
-
Change the UOM (to fix the error)
- Change the declaration of
RecordWithUnits to:
type RecordWithUnits =
{
Value: int<b>
}
- Action: Perform a Build (not Rebuild).
- Result: The build fails with the same error as before, even though the code should now be correct.
-
Perform a Rebuild
- Now perform a Rebuild operation.
- Result: The build succeeds as expected.
-
Change Back to Original UOM (to cause a build error)
- Change the declaration of
RecordWithUnits back to:
type RecordWithUnits =
{
Value: int<a>
}
- Action: Perform a Build.
- Result: The build succeeds, even though it should fail due to the units-of-measure mismatch.
-
Rebuild Again
- Perform a Rebuild.
- Result: The expected build error appears.
Summary
- Build does not always pick up changes to units of measure in record types, leading to stale or incorrect build results.
- Rebuild is required to get the correct build status after such changes.
Expected Behavior
Changing the unit of measure in a type definition should always result in the correct build errors or success, even with an incremental Build.
Actual Behavior
Build does not always detect changes to units of measure, leading to confusing or incorrect build results. Only a full Rebuild produces the correct outcome.
Original Comments
Feedback Bot on 9/17/2025, 05:08 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.
This issue has been moved from a ticket on Developer Community.
Repro case is in https://github.com/marklam/UnitsMismatch - the README is copied below:
This repository demonstrates a bug in the F# build system related to type providers and units of measure across different projects.
The issue is that changing the unit of measure in a record type is not always noticed by the build system, causing errors to not appear, or not go away
(depending on whether your edit is causing or fixing a units-of-measure mismatch).
Steps to Reproduce
**Initial State (build error) **
ClassLibrary1/TypeWIthUnits.fs, the record is defined as:UnitsMismatch/Usage.fs), a value of typeint<b>is supplied toRecordWithUnits.Change the UOM (to fix the error)
RecordWithUnitsto:Perform a Rebuild
Change Back to Original UOM (to cause a build error)
RecordWithUnitsback to:Rebuild Again
Summary
Expected Behavior
Changing the unit of measure in a type definition should always result in the correct build errors or success, even with an incremental Build.
Actual Behavior
Build does not always detect changes to units of measure, leading to confusing or incorrect build results. Only a full Rebuild produces the correct outcome.
Original Comments
Feedback Bot on 9/17/2025, 05:08 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.