Skip to content

Commit f996ac5

Browse files
smoothdeveloperKevinRansom
authored andcommitted
wonder if this is why I'm seeing "evaluating local variables..." in VS while debugging. (#6595)
It seems a bit smoother when working with FSharp.sln fsi.exe but not tried under trace / profiling
1 parent b3df14c commit f996ac5

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/fsharp/range.fs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,14 @@ type range(code1:int64, code2: int64) =
252252
try
253253
let endCol = r.EndColumn - 1
254254
let startCol = r.StartColumn - 1
255-
File.ReadAllLines(r.FileName)
256-
|> Seq.skip (r.StartLine - 1)
257-
|> Seq.take (r.EndLine - r.StartLine + 1)
258-
|> String.concat "\n"
259-
|> fun s -> s.Substring(startCol + 1, s.LastIndexOf("\n", StringComparison.Ordinal) + 1 - startCol + endCol)
255+
if FileSystem.IsInvalidPathShim r.FileName then "path invalid: " + r.FileName
256+
elif not (FileSystem.SafeExists r.FileName) then "non existing file: " + r.FileName
257+
else
258+
File.ReadAllLines(r.FileName)
259+
|> Seq.skip (r.StartLine - 1)
260+
|> Seq.take (r.EndLine - r.StartLine + 1)
261+
|> String.concat "\n"
262+
|> fun s -> s.Substring(startCol + 1, s.LastIndexOf("\n", StringComparison.Ordinal) + 1 - startCol + endCol)
260263
with e ->
261264
e.ToString()
262265
#endif

0 commit comments

Comments
 (0)