Describe the Bug
Cursor Bug Report: Agent cannot StrReplace/Write existing .cs files + NTFS Length inflated by +1024
Environment
- OS: Windows 10/11 (build 26100)
- Cursor: 3.14.7
- Workspace:
C:\Project\code\LinuxDeploy(local NTFS, not OneDrive folder) - Sandbox config:
~/.cursor/sandbox.jsontype=insecure_none - Agent approval mode: unrestricted / insecure_none
- Extensions involved:
anysphere.csharp(reproduces with and without; disabling LS reduces but does not eliminate size inflation) - Reconfirmed: 2026-08-03 — Agent
StrReplaceon healthy.cs(size==read) still returnsWrite permission denied
Bug A — Agent file tools fail on .cs
Symptoms
StrReplace/Writeon existing.cs→Write permission deniedReadon.cscreated outside Cursor (e.g. PowerShell) →Permission denied- Same operations on
.md/.txt/.csprojin the same folder → OK - Creating a new
.csviaWrite→ OK - Terminal/PowerShell can read/write the same
.cspaths without error - OS ACLs are normal (Authenticated Users: Modify; not ReadOnly)
Minimal repro
- Open any folder containing
.csfiles in Cursor Agent mode - Ask agent to change one line in an existing
.csvia normal edit tools - Observe:
Write permission denied - In terminal: overwrite the same file → succeeds
- Ask agent to edit
README.md→ succeeds
Bug B — .cs file Length becomes readableContent+1024
Symptoms
FileInfo.Length/:$DATAstream length is exactly 1024 bytes larger than bytes returned byFile.ReadAllBytesgit addfails:error: short read while indexing ...git hash-objectmay still succeed- Inflating process correlates with Cursor/
anysphere.csharpLanguageServer activity, but can recur even after disabling the extension folder - Reproduces across many project
.csfiles; newly written tiny probes sometimes stay healthy until touched by Cursor tooling
Minimal repro
- Ensure a
.csfile hassize == read - Use Cursor (open solution / agent / filesync) against the project
- Recheck: many
.csshowsize = read + 1024 git add path/to/File.cs→ short read
Impact
Agent cannot reliably edit C# source with normal tools; developers are forced to use shell workarounds. Git indexing breaks intermittently. Affects multiple local projects, not limited to one repo.
Workarounds tried
- Closed Visual Studio: no fix
- Set sandbox
insecure_none+ added workspace toadditionalReadwritePaths: no fix for Bug A git initin workspace: no fix for Bug A- Disable
anysphere.csharpby renaming extension dir: reduces LS involvement; Bug A remains; Bug B less frequent but still observed - Rewrite files with
FileStream.SetLength(actual): temporarily repairs Bug B until reinflation
Request
- Fix agent
StrReplace/Writedenial specifically for.cs(or surface a real approval prompt instead of hard deny) - Investigate what component extends EOF by 1024 without writing valid data (Filesync / csharp LS / other)
- Ensure agent tools and git see consistent file sizes
Diagnostics available
- Cursor logs under
%APPDATA%\Cursor\logs\... - Filesync.log shows uploads/sync of
.csmodelVersion - Local repro script:
fix-cs-filesize.ps1
Steps to Reproduce
SS
Operating System
Windows 10/11
Version Information
For WINDOWS IDE
Does this stop you from using Cursor
No - Cursor works, but with this issue