Visual Studio F# Rename corrupts record update expressions
メンテナーはふだん 3 日以内に返信
評価
この issue はまだ評価されていません。
説明
Visual Studio's F# Rename operation corrupts record update expressions when renaming a record type. The rename preview already shows incorrect edits before they are applied.
Repro steps
- Create a new F# console application in Visual Studio.
- Replace the source code with the following:
module Main
type State = { Count: int }
type Msg =
| Increment
| Decrement
type Cmd = | NoOp
let update msg (state: State) =
match msg with
| Increment -> { state with Count = state.Count + 1 }, Cmd.NoOp
| Decrement -> { state with Count = state.Count - 1 }, Cmd.NoOp
- Place the cursor on the record type name State.
- Invoke Rename (Ctrl+R, R) and rename State to Model.
- Inspect the rename preview.
Expected behavior
Only references to the record type State should be renamed to Model. The Count field accesses and surrounding record update expressions should remain unchanged.
Actual behavior
The rename preview incorrectly includes parts of the record update expressions as rename targets.
After applying the rename, the code becomes corrupted:
module Main
type Model = { Count: int }
type Msg =
| Increment
| Decrement
type Cmd = | NoOp
let update msg (state: Model) =
match msg with
| Increment -> { state with Count = state.Model, Cmd.NoOp
| Decrement -> { state with Count = state.Model, Cmd.NoOp
The expressions state.Count + 1 and state.Count - 1 are incorrectly replaced with state.Model, and parts of the surrounding expressions are deleted.
The issue reproduces in a minimal F# console application and does not require third-party libraries. It does not reproduce in VS Code.
Known workarounds
No workaround has been identified yet, other than avoiding Rename for this scenario and changing the references manually.
Related information
- Operating system: Windows 11 26H2 (Build 26300.9711)
- Editing tool: Visual Studio 2026, version 18.11.0
- Project type: F# console application
- Potentially related issue: #14057
- 主要言語
- F#
- スター
- 4.3k
- フォーク
- 881
- 平均マージ
- 3日 20時間
- マージ済み PR(30日)
- 108
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/fsharp のほかの issue
-
Documentation: Array.tryPick code example gives an error対応中かも @T-Gro が 1 日前に担当しました。 オープンArea-XmlDocs
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
dotnet/fsharp#20780 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信
-
Semantic classification cache for opened documents is never populated (written to the unopened-documents cache)対応中かも @xperiandri が 42 日前に担当しました。 オープンNeeds-Triage
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
メンテナーはふだん 3 日以内に返信
-
Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
dotnet/fsharp#20265 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
Bug Needs-Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 3 日以内に返信
-
Stack overflow when a quotation contains a list literal of about a thousand elements対応中かも @T-Gro が 1 日前に担当しました。 オープンArea-Quotations
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
dotnet/fsharp#20788 · 担当者 1 名 ·
メンテナーはふだん 3 日以内に返信