Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit42b38bf

Browse files
vasily-kirichenkodsyme
authored andcommitted
Fix "The path is not of a legal form" during loading VFT solution (#3007)
* check if a referenced assembly exists before adding it into ProjectContext's metadata references* check path correctness
1 parent53f1103 commit42b38bf

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

‎vsintegration/src/FSharp.Editor/LanguageService/LanguageService.fs‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ and
264264
project.Disconnect()
265265
|_->()
266266

267+
letinvalidPathChars= set(Path.GetInvalidPathChars())
268+
letisPathWellFormed(path:string)=not(String.IsNullOrWhiteSpace path)&& path|> Seq.forall(fun c->not(Set.contains c invalidPathChars))
269+
267270
overridethis.Initialize()=
268271
base.Initialize()
269272

@@ -304,27 +307,31 @@ and
304307

305308
/// Sync the information for the project
306309
memberthis.SyncProject(project:AbstractProject,projectContext:IWorkspaceProjectContext,site:IProjectSite,workspace,forceUpdate)=
307-
lethashSetIgnoreCase x=new HashSet<string>(x, StringComparer.OrdinalIgnoreCase)
308-
letupdatedFiles= site.SourceFilesOnDisk()|> hashSetIgnoreCase
309-
letworkspaceFiles= project.GetCurrentDocuments()|> Seq.map(fun file-> file.FilePath)|> hashSetIgnoreCase
310+
letwellFormedFilePathSetIgnoreCase(paths:seq<string>)=
311+
HashSet(paths|> Seq.filter isPathWellFormed, StringComparer.OrdinalIgnoreCase)
312+
313+
letupdatedFiles= site.SourceFilesOnDisk()|> wellFormedFilePathSetIgnoreCase
314+
letworkspaceFiles= project.GetCurrentDocuments()|> Seq.map(fun file-> file.FilePath)|> wellFormedFilePathSetIgnoreCase
310315

311316
let mutableupdated= forceUpdate
312317

313318
for filein updatedFilesdo
314319
ifnot(workspaceFiles.Contains(file))then
315320
projectContext.AddSourceFile(file)
316321
updated<-true
322+
317323
for filein workspaceFilesdo
318324
ifnot(updatedFiles.Contains(file))then
319325
projectContext.RemoveSourceFile(file)
320326
updated<-true
321327

322-
letupdatedRefs= site.AssemblyReferences()|>hashSetIgnoreCase
323-
letworkspaceRefs= project.GetCurrentMetadataReferences()|> Seq.map(fun ref-> ref.FilePath)|>hashSetIgnoreCase
328+
letupdatedRefs= site.AssemblyReferences()|>wellFormedFilePathSetIgnoreCase
329+
letworkspaceRefs= project.GetCurrentMetadataReferences()|> Seq.map(fun ref-> ref.FilePath)|>wellFormedFilePathSetIgnoreCase
324330

325331
for refin updatedRefsdo
326332
ifnot(workspaceRefs.Contains(ref))then
327333
projectContext.AddMetadataReference(ref, MetadataReferenceProperties.Assembly)
334+
328335
for refin workspaceRefsdo
329336
ifnot(updatedRefs.Contains(ref))then
330337
projectContext.RemoveMetadataReference(ref)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp