Fix DateOnly/TimeOnly design-time type resolution failure for netstandard2.0 targets#1611
Merged
dsyme merged 2 commits intorepo-assist/feature-dateonly-timeonly-1461-03f39b53850547dbfrom Feb 22, 2026
Conversation
11 tasks
…gets Co-authored-by: dsyme <7204669+dsyme@users.noreply.github.com>
15cf3ce
into
repo-assist/feature-dateonly-timeonly-1461-03f39b53850547db
Contributor
Author
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Copilot
AI
changed the title
[WIP] Add DateOnly and TimeOnly inference support
Fix DateOnly/TimeOnly design-time type resolution failure for netstandard2.0 targets
Feb 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the design-time assembly (running on .NET 8) infers
DateOnly/TimeOnlytypes, it was emitting them into generated code even for projects targeting netstandard2.0 — where those types don't exist, causing:Fix: downgrade inferred types when target doesn't support .NET 6+
Detection (
Helpers.fs):runtimeSupportsNet6Typeschecks the runtime assembly path TFM (e.g..../net8.0/...) to determine whether the target supportsDateOnly/TimeOnly.Downgrade functions (
StructuralInference.fs): Two new internal functions —downgradeNet6Types(fullInferedTypetree walk) anddowngradeNet6PrimitiveProperty(CSV field) — replaceDateOnly→DateTimeandTimeOnly→TimeSpan. Includes reference-equality cycle detection to prevent stack overflow on recursive XML type graphs.Provider integration (
CsvProvider.fs,JsonProvider.fs,XmlProvider.fs,HtmlGenerator.fs,HtmlProvider.fs): Each provider calls the appropriate downgrade function whenruntimeSupportsNet6Typesreturnsfalse.Fix: XSD schema inference for
xs:dateXsdInference.fswas always mappingXmlTypeCode.Date → typeof<DateTime>. Now maps totypeof<DateOnly>on .NET 6+, making schema-inferred types consistent with value-inferred types.FSharp.Data.Xml.Core.fsproj: Addednet8.0toTargetFrameworks(wasnetstandard2.0only) so#if NET6_0_OR_GREATERactivates in XSD inference code.Test updates (
InferenceTests.fs)Date-only inference expectations (e.g.
"2012-12-19"→DateOnly, timestamps with time component remainDateTime) wrapped in#if NET6_0_OR_GREATER.💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.