Visual Studio F# Rename corrupts record update expressions
Los mantenedores suelen responder en 3 días
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
- Lenguaje dominante
- F#
- Estrellas
- 4.3k
- Forks
- 881
- Merge medio
- 3 d 20 h
- PR fusionados (30 d)
- 108
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de dotnet/fsharp
-
Documentation: Array.tryPick code example gives an errorPosiblemente ocupada @T-Gro la tomó hace 1 día. AbiertoArea-XmlDocs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 78/100
dotnet/fsharp#20780 · 1 asignado ·
Los mantenedores suelen responder en 3 días
-
Semantic classification cache for opened documents is never populated (written to the unopened-documents cache)Posiblemente ocupada @xperiandri la tomó hace 42 días. AbiertoNeeds-Triage
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 3 días
-
Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
dotnet/fsharp#20265 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Bug Needs-Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 3 días
-
Stack overflow when a quotation contains a list literal of about a thousand elementsPosiblemente ocupada @T-Gro la tomó hace 1 día. AbiertoArea-Quotations
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
dotnet/fsharp#20788 · 1 asignado ·
Los mantenedores suelen responder en 3 días