859 references to Path
InteractiveHost.UnitTests (4)
InteractiveHostCoreInitTests.cs (1)
76AssertEx.AssertEqualToleratingWhitespaceDifferences(PrintSearchPaths(srcDir.Path), output);
InteractiveHostDesktopInitTests.cs (1)
49AssertEx.AssertEqualToleratingWhitespaceDifferences(PrintSearchPaths(srcDir.Path), output);
InteractiveHostDesktopTests.cs (2)
705rspFile.WriteAllText($"/lib:{directory1.Path} /r:Assembly2.dll {initFile.Path}"); 719var expectedSearchPaths = PrintSearchPaths(fxDir, directory1.Path);
Microsoft.Build.Tasks.CodeAnalysis.Sdk.UnitTests (1)
src\Compilers\Core\MSBuildTaskTests\TestUtilities\IntegrationTestBase.cs (1)
93currentDirectory.Path,
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (24)
CopyRefAssemblyTests.cs (2)
35SourcePath = Path.Combine(dir.Path, "does_not_exist.dll") 66var dest = Path.Combine(dir.Path, "dest.dll");
DotNetSdkTests.cs (8)
28var root1 = Path.GetFullPath(ProjectDir.Path + Path.DirectorySeparatorChar); 29var root2 = Path.GetFullPath(sourcePackageDir.Path + Path.DirectorySeparatorChar); 38var sourceLinkJsonPath = Path.Combine(ObjDir.Path, ProjectName + ".sourcelink.json"); 432Path.Combine(ProjectDir.Path, ".editorconfig"), 493Path.Combine(ProjectDir.Path, ".editorconfig"), 528Path.Combine(ProjectDir.Path, ".editorconfig"), 573var dir = Directory.GetParent(ProjectDir.Path); 653Path.Combine(ProjectDir.Path, ".editorconfig"),
IntegrationTests.cs (2)
18return new DisposableFile(Path.Combine(directory.Path, resultFileName)); 695var result = RunCommandLineCompiler(_msbuildExecutable, "/p:UseSharedCompilation=false", testDir.Path);
RuntimeHostInfoTests.cs (5)
49new("PATH", globalDotNetDir.Path), 56AssertEx.Equal(NormalizePath(globalDotNetDir.Path), NormalizePath(result)); 81var symlinkPath = Path.Combine(binDir.Path, $"dotnet{PlatformInformation.ExeExtension}"); 88new("PATH", binDir.Path), 95AssertEx.Equal(NormalizePath(globalDotNetDir.Path), NormalizePath(result));
TestUtilities\DotNetSdkTestBase.cs (6)
199Assert.True(File.Exists(Path.Combine(ObjDir.Path, "project.assets.json"))); 200Assert.True(File.Exists(Path.Combine(ObjDir.Path, ProjectFileName + ".nuget.g.props"))); 201Assert.True(File.Exists(Path.Combine(ObjDir.Path, ProjectFileName + ".nuget.g.targets"))); 224var evaluationResultsFile = Path.Combine(OutDir.Path, "EvaluationResult.txt"); 226EmitTestHelperProps(ObjDir.Path, ProjectFileName, customProps, uploadUtil); 227EmitTestHelperTargets(ObjDir.Path, evaluationResultsFile, ProjectFileName, expressions, customTargets, uploadUtil);
TestUtilities\IntegrationTestBase.cs (1)
93currentDirectory.Path,
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (350)
CommandLineIVTTests.cs (4)
44var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}"; 121var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}"; 200var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}"; 285var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}";
CommandLineTestBase.cs (2)
41File.WriteAllBytes(Path.Combine(dir.Path, "mscorlib.dll"), Net461.ReferenceInfos.mscorlib.ImageBytes); 42return dir.Path;
CommandLineTests.cs (321)
147var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.Path }); 154string exePath = Path.Combine(dir.Path, "temp.exe"); 167var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.Path }); 174var xmlPath = Path.Combine(dir.Path, docName); 196var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 289var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 341var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 377var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 390$"error CS8700: Multiple analyzer config files cannot be in the same directory ('{dir.Path}').", 401var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", src.Path }); 410var result = ProcessUtilities.Run(Path.Combine(dir.Path, "sjis.exe"), arguments: "", workingDirectory: dir.Path); 412Assert.Equal("星野 八郎太", File.ReadAllText(Path.Combine(dir.Path, "output.txt"), Encoding.GetEncoding(932))); 421var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/codepage:932", src.Path }); 430var result = ProcessUtilities.Run(Path.Combine(dir.Path, "sjis.exe"), arguments: "", workingDirectory: dir.Path); 432Assert.Equal("星野 八郎太", File.ReadAllText(Path.Combine(dir.Path, "output.txt"), Encoding.GetEncoding(932))); 478string basePath = baseDir.Path; 491{ Path.Combine(dirSubDir.Path, @"b.rsp"), @" 566var parser = CSharpCommandLineParser.Default.Parse(new[] { "file.cs", $"-out:{parentDir.Path}", "/noSdkPath" }, parentDir.Path, null); 584var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/nosdkpath", "/r:System.dll", "a.cs" }); 623args = DefaultParse(new[] { "/main:Test", "a.cs" }, folder.Path); 627args = DefaultParse(new[] { "/main:\"Test\"", "a.cs" }, folder.Path); 631args = DefaultParse(new[] { "/main:\"Test.Class1\"", "a.cs" }, folder.Path); 635args = DefaultParse(new[] { "/m:Test", "a.cs" }, folder.Path); 639args = DefaultParse(new[] { "/m:\"Test\"", "a.cs" }, folder.Path); 643args = DefaultParse(new[] { "/m:\"Test.Class1\"", "a.cs" }, folder.Path); 648args = DefaultParse(new[] { "/m:\"решения.Class1\"", "a.cs" }, folder.Path); 660args = DefaultParse(new[] { "-debug+/debug:portable" }, folder.Path); 692int exitCode = CreateCSharpCompiler(null, folder.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", @"/recurse:.", "/out:abc.dll" }).Run(outWriter); 697exitCode = CreateCSharpCompiler(null, folder.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", @"/recurse:. ", "/out:abc.dll" }).Run(outWriter); 702exitCode = CreateCSharpCompiler(null, folder.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", @"/recurse: . ", "/out:abc.dll" }).Run(outWriter); 707exitCode = CreateCSharpCompiler(null, folder.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", @"/recurse:././.", "/out:abc.dll" }).Run(outWriter); 714args = DefaultParse(new[] { @"/recurse:*.cp*", @"/recurse:a\*.c*", @"/out:a.dll" }, folder.Path); 717AssertEx.Equal(new[] { folder.Path + @"\c.cpp", folder.Path + @"\B\B_c.cpx", folder.Path + @"\a\A_a.cs", folder.Path + @"\a\A_b.cs", }, resolvedSourceFiles); 719args = DefaultParse(new[] { @"/recurse:.\\\\\\*.cs", @"/out:a.dll" }, folder.Path); 724args = DefaultParse(new[] { @"/recurse:.////*.cs", @"/out:a.dll" }, folder.Path); 1880var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/langversion:?" }); 2254var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/debug:embedded", "/sourcelink:sl.json", "a.cs" }); 2258var peStream = File.OpenRead(Path.Combine(dir.Path, "a.exe")); 2286var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/debug:portable", "/sourcelink:sl.json", "a.cs" }); 2290var pdbStream = File.OpenRead(Path.Combine(dir.Path, "a.pdb")); 2315var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/debug:full", "/sourcelink:sl.json", "a.cs" }); 2319var pdbStream = File.OpenRead(Path.Combine(dir.Path, "a.pdb")); 2458var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", debugSwitch, embedSwitch, "embed.cs", "embed2.cs" }); 2482using (var peReader = new PEReader(File.OpenRead(Path.Combine(dir.Path, "embed.exe")))) 2489MetadataReaderProvider.FromPortablePdbStream(File.OpenRead(Path.Combine(dir.Path, "embed.pdb")))) 2517symReader = SymReaderFactory.CreateReader(File.OpenRead(Path.Combine(dir.Path, "embed.pdb"))); 2789var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/a:missing.dll", "a.cs" }); 2812var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + typeof(object).Assembly.Location, "a.cs" }); 2929var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs" }); 2965var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs", "/ruleset:" + ruleSetFile.Path }); 2998var csc = CreateCSharpCompiler(null, dir.Path, 3009csc = CreateCSharpCompiler(null, dir.Path, 3045dir.Path); 3077dir.Path); 3110dir.Path); 3143dir.Path); 3177dir.Path); 3211dir.Path); 3245dir.Path); 3279dir.Path); 3314dir.Path); 3349dir.Path); 3373dir.Path); 3406dir.Path); 3439dir.Path); 3473dir.Path); 3517var csc = CreateCSharpCompiler(null, dir.Path, 3528csc = CreateCSharpCompiler(null, dir.Path, 3586var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "a.cs" }); 3596" + Path.GetFullPath(Path.Combine(dir.Path, @"..\b.cs")) + @"(40,13): error CS0103: The name 'Goo' does not exist in the current context 3597" + Path.GetFullPath(Path.Combine(dir.Path, @"..\b.cs")) + @"(50,13): error CS0103: The name 'Goo' does not exist in the current context 3614csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/fullpaths", "a.cs" }); 3619" + Path.Combine(dir.Path, @"a.cs") + @"(8,13): error CS0103: The name 'Goo' does not exist in the current context 3623" + Path.GetFullPath(Path.Combine(dir.Path, @"..\b.cs")) + @"(40,13): error CS0103: The name 'Goo' does not exist in the current context 3624" + Path.GetFullPath(Path.Combine(dir.Path, @"..\b.cs")) + @"(50,13): error CS0103: The name 'Goo' does not exist in the current context 3631" + Path.Combine(dir.Path, @"a.cs") + @"(32,13): error CS0103: The name 'Goo' does not exist in the current context 4495var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/modulename:hocusPocus ", "/out:" + exeName + " ", file1.Path }); 4503Assert.Equal(1, Directory.EnumerateFiles(dir.Path, exeName).Count()); 4505using (var metadata = ModuleMetadata.CreateFromImage(File.ReadAllBytes(Path.Combine(dir.Path, "aa.exe")))) 4682var parsedArgs = DefaultParse(new[] { @"/lib:lib1", @"/libpath:lib2", @"/libpaths:lib3", "a.cs" }, dir.Path, sdkDirectory: sdkDirectory); 4686lib1.Path, 4687lib2.Path, 4688lib3.Path 6017string tempDir = Temp.CreateDirectory().Path; 6053string tempDir = Temp.CreateDirectory().Path; 6086string tempDir = Temp.CreateDirectory().Path; 6120string tempDir = Temp.CreateDirectory().Path; 6132string tempDir = Temp.CreateDirectory().Path; 6970var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/target:exe", "a.cs" }); 6992var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/target:exe", "a.cs" }); 7016var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/target:library", "a.cs" }); 7039var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", "a.cs" }); 7084var csc = CreateCSharpCompiler(null, dir.Path, commandLineArguments.Concat(new[] { inputName1, inputName2 }).ToArray()); 7092Assert.Equal(1, Directory.EnumerateFiles(dir.Path, "*" + PathUtilities.GetExtension(expectedOutputName)).Count()); 7093Assert.Equal(1, Directory.EnumerateFiles(dir.Path, expectedOutputName).Count()); 7095using (var metadata = ModuleMetadata.CreateFromImage(File.ReadAllBytes(Path.Combine(dir.Path, expectedOutputName)))) 7128var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/r:missing.dll", "a.cs" }); 7204var csc = CreateCSharpCompiler(null, dir.Path, commandLineArguments.Concat(new[] { fileName }).ToArray()); 7227var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:sub\\a.exe" }); 7231Assert.Contains("error CS2012: Cannot open '" + dir.Path + "\\sub\\a.exe' for writing", outWriter.ToString(), StringComparison.Ordinal); 7253var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:sub\\" }); 7281var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:sub\\ " }); 7309var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out:aaa:\\a.exe" }); 7335var csc = CreateCSharpCompiler(null, dir.Path, new[] { fileName, "/preferreduilang:en", "/target:exe", "/out: " }); 7369var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "a.cs", "/keyfile:key.snk", }); 7391var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "a.cs", "/keycontainer:bbb", }); 7414var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "a.cs", "/keyFile:key.snk", "/features:UseLegacyStrongNameProvider" }); 7434var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "a.cs", "/features:disable-length-based-switch" }); 7438cmd = CreateCSharpCompiler(null, dir.Path, new[] { "a.cs" }); 7529var output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $"/nologo /t:library \"{file}\"", startFolder: dir.Path); 7532output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $"/nologo /preferreduilang:en /t:library /codepage:20127 \"{file}\"", expectedRetCode: 1, startFolder: dir.Path); // 20127: US-ASCII 7810csc = CreateCSharpCompiler(null, dir.Path, new[] 7820csc = CreateCSharpCompiler(null, dir.Path, new[] 7834IntPtr lib = LoadLibraryEx(Path.Combine(dir.Path, outputFileName), IntPtr.Zero, 0x00000002); 8429csc = CreateCSharpCompiler(null, Temp.CreateDirectory().Path, new[] { source, "/preferreduilang:en" }); 8456csc = CreateCSharpCompiler(null, Temp.CreateDirectory().Path, new[] { source, "/preferreduilang:en", "/fullpaths" }); 8786int exitCode1 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source1.Path }).Run(outWriter); 8792int exitCode2 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source2.Path }).Run(outWriter); 8803int exitCode3 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source3.Path }).Run(outWriter); 8848int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/debug:full", libSrc.Path }).Run(outWriter); 8865AssertEx.Equal(new[] { "Lib.cs", "Lib.dll", "Lib.pdb" }, Directory.GetFiles(dir.Path).Select(p => Path.GetFileName(p)).Order()); 8922AssertEx.Equal(new[] { "Lib.cs", "Lib.dll", "Lib.pdb" }, Directory.GetFiles(dir.Path).Select(p => Path.GetFileName(p)).Order()); 8930Directory.Delete(dir.Path, recursive: false); 8955int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter); 8963AssertEx.Equal(new[] { "Lib.cs", "Lib.dll" }, Directory.GetFiles(dir.Path).Select(p => Path.GetFileName(p)).Order()); 8974int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter); 8975Assert.Contains($"error CS2012: Cannot open '{libDll.Path}' for writing", outWriter.ToString()); 8996var srcPath = MakeTrivialExe(Temp.CreateDirectory().Path); 9018var srcPath = MakeTrivialExe(Temp.CreateDirectory().Path); 9041var srcPath = MakeTrivialExe(Temp.CreateDirectory().Path); 9065var srcPath = MakeTrivialExe(Temp.CreateDirectory().Path); 9299TestCS2002(commandLineArgs, tempDir.Path, 0, aWrnString); 9305TestCS2002(commandLineArgs, tempDir.Path, 0, warnings); 9311TestCS2002(commandLineArgs, tempDir.Path, 0, AWrnString); 9317TestCS2002(commandLineArgs, tempDir.Path, 0, String.Empty); 9323TestCS2002(commandLineArgs, tempParentDir.Path, 0, tmpDiraString); 9328TestCS2002(commandLineArgs, tempParentDir.Path, 0, tmpDiraString); 9333TestCS2002(commandLineArgs, tempParentDir.Path, 0, tmpDiraString); 9338TestCS2002(commandLineArgs, tempParentDir.Path, 0, tmpDiraString); 9342TestCS2002(commandLineArgs, tempParentDir.Path, 0, tmpDiraString); 9348var formattedcs1504Str = String.Format(cs1504, PathUtilities.CombineAbsoluteAndRelativePaths(tempParentDir.Path, "tmpDir\a.cs"), "Illegal characters in path."); 9349TestCS2002(commandLineArgs, tempParentDir.Path, 1, formattedcs1504Str); 9357TestCS2002(commandLineArgs, tempParentDir.Path, 1, (string[])null, parseDiags); 9364TestCS2002(commandLineArgs, tempParentDir.Path, 1, (string[])null, parseDiags); 9368var formattedcs1504 = String.Format(cs1504, PathUtilities.CombineAbsoluteAndRelativePaths(tempParentDir.Path, @":a.cs"), @"The given path's format is not supported."); 9369TestCS2002(commandLineArgs, tempParentDir.Path, 1, formattedcs1504); 9372System.IO.Directory.Delete(tempParentDir.Path, true); 9975args = DefaultParse(new[] { "/additionalfile:web*.config", "a.cs" }, baseDir.Path); 9978Assert.Equal(Path.Combine(baseDir.Path, "web1.config"), args.AdditionalFiles[0].Path); 9979Assert.Equal(Path.Combine(baseDir.Path, "web2.config"), args.AdditionalFiles[1].Path); 9980Assert.Equal(Path.Combine(baseDir.Path, "web3.config"), args.AdditionalFiles[2].Path); 10197Directory.Delete(dir.Path, true); 10256Directory.Delete(dir.Path, true); 10322Directory.Delete(dir.Path, true); 10429Directory.Delete(dir.Path, true); 10526Directory.Delete(dir.Path, true); 10563Directory.Delete(dir.Path, true); 10603Directory.Delete(dir.Path, true); 10655var csc = CreateCSharpCompiler(null, sourceDir.Path, args, analyzers: analyzers, generators: generators, driverCache: driverCache); 11693var csc = CreateCSharpCompiler(null, dir.Path, args); 11697var exePath = Path.Combine(dir.Path, "a.exe"); 11709var pdbPath = Path.Combine(dir.Path, "a.pdb"); 11716var pdbPath = Path.Combine(dir.Path, "a.pdb"); 11717AssertPdbEmit(dir, pdbPath, @"q:\a.pdb", $@"/pathmap:{dir.Path}=q:\"); 11723var pdbPath = Path.Combine(dir.Path, "a.pdb"); 11724AssertPdbEmit(dir, pdbPath, @"q:\a.pdb", $@"/pathmap:{dir.Path}=q:\", "/deterministic"); 11731var pdbPath = Path.Combine(dir.Path, @"pdb\a.pdb"); 11732AssertPdbEmit(dir, pdbPath, @"q:\pdb\a.pdb", $@"/pathmap:{dir.Path}=q:\"); 11739var pdbPath = Path.Combine(dir.Path, "a.pdb"); 11746var pdbPath = Path.Combine(dir.Path, "a.pdb"); 11747AssertPdbEmit(dir, pdbPath, @"/a.pdb", $@"/pathmap:{dir.Path}=/"); 11753var pdbPath = Path.Combine(dir.Path, "a.pdb"); 11754AssertPdbEmit(dir, pdbPath, "/goo/a.pdb", $"/pathmap:{dir.Path}=/goo,{dir.Path}{PathUtilities.DirectorySeparatorChar}=/bar"); 11819var output = ProcessUtilities.RunAndGetOutput(csc32exe.Path, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir32.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir32.Path); 11822output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir64.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir64.Path); 11872var csc = CreateCSharpCompiler(null, dir.Path, 11878var exe = Path.Combine(dir.Path, "a.exe"); 11887var doc = Path.Combine(dir.Path, "doc.xml"); 11908var output = ProcessUtilities.RunAndGetOutput(exe, startFolder: dir.Path); 11911var refDll = Path.Combine(refDir.Path, "a.dll"); 11923CleanupAllGeneratedFiles(dir.Path); 11924CleanupAllGeneratedFiles(refDir.Path); 11937var csc = CreateCSharpCompiler(null, dir.Path, 11942var dll = Path.Combine(dir.Path, "a.dll"); 11945var refDll = Path.Combine(dir.Path, Path.Combine("ref", "a.dll")); 11951CleanupAllGeneratedFiles(dir.Path); 11988var csc = CreateCSharpCompiler(null, dir.Path, 11994var refDll = Path.Combine(dir.Path, "a.dll"); 12005var pdb = Path.Combine(dir.Path, "a.pdb"); 12008var doc = Path.Combine(dir.Path, "doc.xml"); 12036CleanupAllGeneratedFiles(dir.Path); 12097var result = ProcessUtilities.Run(cscPath, arguments: "/nologo /t:library unknown.cs", workingDirectory: dir.Path); 12105result = ProcessUtilities.Run(cscPath, arguments: "/nologo /t:library unknown.cs", workingDirectory: dir.Path); 12326var cscCopy = Path.Combine(dir.Path, "csc.exe"); 12334workingDirectory: dir.Path, 12342result = ProcessUtilities.Run(cscCopy, arguments, workingDirectory: dir.Path); 12349workingDirectory: dir.Path, 12366var csc = CreateCSharpCompiler(null, dir.Path, args); 12370var exePath = Path.Combine(dir.Path, "a.exe"); 12388var buildPaths = new BuildPaths(clientDir: "", workingDir: workingDir.Path, sdkDir: null, tempDir: tempDir.Path); 12404var buildPaths = new BuildPaths(clientDir: "", workingDir: workingDir.Path, sdkDir: null, tempDir: tempDir.Path); 12424var buildPaths = new BuildPaths(clientDir: "", workingDir: workingDir.Path, sdkDir: null, tempDir: tempDir.Path); 12445var buildPaths = new BuildPaths(clientDir: "", workingDir: workingDir.Path, sdkDir: null, tempDir: tempDir.Path); 13496var cmd = CreateCSharpCompiler(null, dir.Path, arguments, 13558string binaryPath = Path.Combine(dir.Path, "temp.dll"); 13561string pdbPath = Path.Combine(dir.Path, pdbName); 13564string xmlDocFilePath = Path.Combine(dir.Path, docName); 13604string binaryPath = Path.Combine(dir.Path, "temp.dll"); 13607string pdbPath = Path.Combine(dir.Path, pdbName); 13610string xmlDocFilePath = Path.Combine(dir.Path, docName); 13654string binaryPath = Path.Combine(dir.Path, "temp.dll"); 13657string pdbPath = Path.Combine(dir.Path, pdbName); 13660string xmlDocFilePath = Path.Combine(dir.Path, docName); 13685string binaryPath = Path.Combine(dir.Path, "temp.dll"); 13741var cmd = CreateCSharpCompiler(null, dir.Path, arguments, 13832var cmd = CreateCSharpCompiler(null, dir.Path, args, analyzers: new[] { analyzer }); 13869var cmd = CreateCSharpCompiler(null, dir.Path, args, analyzers: new[] { analyzer }); 14002var generatorPrefix = GeneratorDriver.GetFilePathPrefixForGenerator(dir.Path, generator); 14003ValidateEmbeddedSources_Portable(new Dictionary<string, string> { { Path.Combine(dir.Path, generatorPrefix, $"generatedSource.cs"), generatedSource } }, dir, true); 14007Directory.Delete(dir.Path, true); 14043var generatorPrefix = GeneratorDriver.GetFilePathPrefixForGenerator(dir.Path, generator); 14044ValidateEmbeddedSources_Portable(new Dictionary<string, string> { { Path.Combine(dir.Path, generatorPrefix, "generatedSource.cs"), generatedSource } }, dir, true); 14082var generator1Prefix = GeneratorDriver.GetFilePathPrefixForGenerator(dir.Path, generator); 14083var generator2Prefix = GeneratorDriver.GetFilePathPrefixForGenerator(dir.Path, generator2); 14087{ Path.Combine(dir.Path, generator1Prefix, source1Name), source1}, 14088{ Path.Combine(dir.Path, generator2Prefix, source2Name), source2}, 14093Directory.Delete(dir.Path, true); 14105var genPath1 = Path.Combine(dir.Path, "Microsoft.CodeAnalysis.Test.Utilities", "Roslyn.Test.Utilities.TestGenerators.TestSourceGenerator", "hint1.cs"); 14106var genPath2 = Path.Combine(dir.Path, "Microsoft.CodeAnalysis.Test.Utilities", "Roslyn.Test.Utilities.TestGenerators.TestSourceGenerator", "hint2.cs"); 14125using (Stream peStream = File.OpenRead(Path.Combine(dir.Path, "checksum.exe")), pdbStream = File.OpenRead(Path.Combine(dir.Path, "checksum.pdb"))) 14137Directory.Delete(dir.Path, true); 14147var genPath1 = Path.Combine(dir.Path, "Microsoft.CodeAnalysis.Test.Utilities", "Roslyn.Test.Utilities.TestGenerators.TestSourceGenerator", "hint1.cs"); 14148var genPath2 = Path.Combine(dir.Path, "Microsoft.CodeAnalysis.Test.Utilities", "Roslyn.Test.Utilities.TestGenerators.TestSourceGenerator", "hint2.cs"); 14167using (Stream peStream = File.OpenRead(Path.Combine(dir.Path, "checksum.exe")), pdbStream = File.OpenRead(Path.Combine(dir.Path, "checksum.pdb"))) 14179Directory.Delete(dir.Path, true); 14209VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null); 14211var generatorPrefix = GeneratorDriver.GetFilePathPrefixForGenerator(generatedDir.Path, generator); 14214{ Path.Combine(generatedDir.Path, generatorPrefix, expectedDir), new() { { expectedFileName, generatedSource } } } 14219Directory.Delete(dir.Path, true); 14235VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator1 }, analyzers: null); 14237var generatorPrefix = GeneratorDriver.GetFilePathPrefixForGenerator(generatedDir.Path, generator1); 14238ValidateWrittenSources(new() { { Path.Combine(generatedDir.Path, generatorPrefix), new() { { "generatedSource.cs", generatedSource1 } } } }); 14243VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator2 }, analyzers: null); 14245ValidateWrittenSources(new() { { Path.Combine(generatedDir.Path, generatorPrefix), new() { { "generatedSource.cs", generatedSource2 } } } }); 14249Directory.Delete(dir.Path, true); 14270VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator, generator2 }, analyzers: null); 14272var generator1Prefix = GeneratorDriver.GetFilePathPrefixForGenerator(generatedDir.Path, generator); 14273var generator2Prefix = GeneratorDriver.GetFilePathPrefixForGenerator(generatedDir.Path, generator2); 14283Directory.Delete(dir.Path, true); 14311VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null); 14313var generatorPrefix = GeneratorDriver.GetFilePathPrefixForGenerator(generatedDir.Path, generator); 14316{ Path.Combine(generatedDir.Path, generatorPrefix, expectedDir), new() { { generatedFileName, generatedSource } } } 14321Directory.Delete(dir.Path, true); 14330var snk = Temp.CreateFile("TestKeyPair_", ".snk", dir.Path).WriteAllBytes(TestResources.General.snKey); 14332var virtualSnProvider = new DesktopStrongNameProvider(ImmutableArray.Create(dir.Path)); 14347var path = Path.Combine(dir.Path, Guid.NewGuid().ToString() + ".dll"); 14362VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, "/analyzer:" + gen1, "/analyzer:" + gen2 }.ToArray()); 14369{ Path.Combine(generatedDir.Path, "generator", "TestGenerator"), new() { { "generatedSource.cs", "//from version 2.0.0.0" } } } 14387ValidateWrittenSources(new() { { generatedDir.Path, new() } }); 14391Directory.Delete(dir.Path, true); 14403var generatedDirPath = Path.Combine(dir.Path, "noexist"); 14412Directory.Delete(dir.Path, true); 14428VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null); 14430var generatorPrefix = GeneratorDriver.GetFilePathPrefixForGenerator(generatedDir.Path, generator); 14431ValidateWrittenSources(new() { { Path.Combine(generatedDir.Path, generatorPrefix), new() { { "generatedSource.cs", generatedSource } } } }); 14435Directory.Delete(dir.Path, true); 14504Directory.Delete(dir.Path, true); 14520VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/generatedfilesout:" + generatedDir.Path, $"/touchedfiles:{dir.Path}/touched", "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null); 14522var touchedFiles = Directory.GetFiles(dir.Path, "touched*"); 14525string[] writtenText = File.ReadAllLines(Path.Combine(dir.Path, "touched.write")); 14532Directory.Delete(dir.Path, true); 14600Directory.Delete(dir.Path, true); 14659$"/out:{objDir.Path}/embed.exe", 14669Directory.Delete(dir.Path, true); 14725pathMapArgument = pathMapArgument.Replace("DIRPATH", dir.Path).Replace("SRCDIRPATH", srcDir.Path).Replace("OBJDIRPATH", objDir.Path); 14731"/generatedfilesout:" + objDir.Path, 14742var generatorPrefix = GeneratorDriver.GetFilePathPrefixForGenerator(objDir.Path, generator); 14750Directory.Delete(dir.Path, true); 14838var cmd = CreateCSharpCompiler(null, dir.Path, args, generators: new[] { generator }); 14898var cmd = CreateCSharpCompiler(null, dir.Path, 14918var cmd = CreateCSharpCompiler(null, dir.Path, 14943var cmd = CreateCSharpCompiler(null, dir.Path, 14963var cmd = CreateCSharpCompiler(null, dir.Path, 15003Directory.Delete(dir.Path, true); 15069var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15150var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15364CleanupAllGeneratedFiles(srcDirectory.Path); 15520var generatorPath = Path.Combine(directory.Path, "generator.dll"); 15556Directory.CreateDirectory(Path.GetDirectoryName(Path.Combine(srcDirectory.Path, additionalFilePath1))); 15557Directory.CreateDirectory(Path.GetDirectoryName(Path.Combine(srcDirectory.Path, additionalFilePath2))); 15563string path2 = additionalFile2?.Path ?? Path.Combine(srcDirectory.Path, additionalFilePath2); 15580CleanupAllGeneratedFiles(srcDirectory.Path); 15675var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15686cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15727var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15738cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15809var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15820cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15862var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15873cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15940var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 15979var cmd = CreateCSharpCompiler(null, dir.Path, new[] { 16019var cmd = CreateCSharpCompiler(null, dir.Path, new[] {
SarifErrorLoggerTests.cs (10)
43var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 74var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 108var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 140var errorLogFile = Path.Combine(outputDir.Path, "ErrorLog.txt"); 141var outputFilePath = Path.Combine(outputDir.Path, "test.dll"); 177var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 212var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 247var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 282var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 315var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt");
SarifV2ErrorLoggerTests.cs (8)
447var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 529var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 599var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 669Assert.False(File.Exists(Path.Combine(mappedDir.Path, "otherfile.cs"))); 674#line 123 "{{mappedDir.Path}}\otherfile.cs" 679var errorLogFile = Path.Combine(errorLogDir.Path, "ErrorLog.txt"); 713Assert.Equal($"file:///{mappedDir.Path.Replace(@"\", "/")}/otherfile.cs", (string)resultFile["uri"]); 739Assert.Equal(expected: $"file:///{mappedDir.Path.Replace(@"\", "/")}/otherfile.cs", (string)physicalLocation["artifactLocation"]["uri"]);
TouchedFileLoggingTests.cs (5)
40var touchedBase = Path.Combine(touchedDir.Path, "touched"); 68var touchedBase = Path.Combine(touchedDir.Path, "touched"); 115var touchedBase = Path.Combine(touchedDir.Path, "touched"); 154var touchedBase = Path.Combine(touchedDir.Path, "touched"); 161"/touchedfiles:" + touchedDir.Path + "\\touched",
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (8)
Completion\CompletionProviders\AppDirectiveCompletionProviderTests.cs (6)
59var scriptFilePath = Path.Combine(tempDirectory.Path, "App.cs"); 90var scriptFilePath = Path.Combine(tempDirectory.Path, "App.cs"); 142var scriptFilePath = Path.Combine(tempDirectory.Path, "App.cs"); 170var scriptFilePath = Path.Combine(tempDirectory.Path, "App.cs"); 241var scriptFilePath = Path.Combine(tempDirectory.Path, "App.cs"); 255<AnalyzerConfigDocument FilePath="{Path.Combine(tempDirectory.Path, ".globalconfig")}"><![CDATA[{globalAnalyzerConfig}]]></AnalyzerConfigDocument>
Workspaces\WorkspaceTests_EditorFeatures.cs (2)
1147var analyzerConfigPath = PathUtilities.CombineAbsoluteAndRelativePaths(Temp.CreateDirectory().Path, ".editorconfig"); 1392var analyzerConfigDocFilePath = PathUtilities.CombineAbsoluteAndRelativePaths(Temp.CreateDirectory().Path, ".editorconfig");
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (15)
Emit\CompilationEmitTests.cs (2)
4716var dllPath = Path.Combine(tmpDir.Path, "assemblyname.dll"); 4717var pdbPath = Path.Combine(tmpDir.Path, "assemblyname.pdb");
Emit\DesktopStrongNameProviderTests.cs (13)
23var provider = new DesktopStrongNameProvider(tempPath: tempDir.Path); 24Assert.Equal(tempDir.Path, provider.FileSystem.GetSigningTempPath()); 38var provider1 = new DesktopStrongNameProvider(tempPath: tempDir.Path); 39var provider2 = new DesktopStrongNameProvider(tempPath: tempDir.Path); 48var provider1 = new DesktopStrongNameProvider(keyFileSearchPaths: [tempDir.Path]); 49var provider2 = new DesktopStrongNameProvider(keyFileSearchPaths: [tempDir.Path]); 58var provider1 = new DesktopStrongNameProvider(tempPath: tempDir.Path); 59var provider2 = new DesktopStrongNameProvider(tempPath: tempDir.Path + "2"); 68var provider1 = new DesktopStrongNameProvider(keyFileSearchPaths: [tempDir.Path]); 69var provider2 = new DesktopStrongNameProvider(keyFileSearchPaths: [tempDir.Path + "2"]); 78var provider1 = new DesktopStrongNameProvider(keyFileSearchPaths: [tempDir.Path]); 79var provider2 = new DesktopStrongNameProvider(keyFileSearchPaths: [tempDir.Path.ToUpper()]); 93var provider = new DesktopStrongNameProvider(ImmutableArray<string>.Empty, new VirtualizedStrongNameFileSystem(tempDir.Path));
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (8)
Attributes\AttributeTests_Security.cs (4)
1502var resolver = new XmlFileResolver(tempDir.Path); 1585var resolver = new XmlFileResolver(tempDir.Path); 1606string filePath = Path.Combine(tempDir.Path, "pset_01.xml"); 1629TestOptions.ReleaseDll.WithXmlReferenceResolver(new XmlFileResolver(tempDir.Path)));
Attributes\EmitTestStrongNameProvider.cs (1)
25var fileSystem = new TestStrongNameFileSystem(_signingTempDirectory.Path)
Attributes\InternalsVisibleToAndStrongNameTests.cs (3)
65new DesktopStrongNameProvider(ImmutableArray.Create(keyFilePath), strongNameFileSystem: new VirtualizedStrongNameFileSystem(_signingTempDirectory.Path)); 230new VirtualizedStrongNameFileSystem(_signingTempDirectory.Path)) 2857var provider = new TestDesktopStrongNameProvider(fileSystem: new VirtualizedStrongNameFileSystem(_signingTempDirectory.Path))
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (15)
CommandLineRunnerTests.cs (14)
378workingDirectory: dir.Path); 481var scriptPath = PathUtilities.CombinePathsUnchecked(PathUtilities.GetFileName(directory.Path), scriptName); 482var workingDirectory = PathUtilities.GetDirectoryName(directory.Path); 536var runner = CreateRunner([$"/loadpath:{dir1.Path}", $"/loadpaths:{dir2.Path};{dir3.Path}", main.Path]); 573var runner = CreateRunner(["/r:4.dll", $"/lib:{dir1.Path}", $"/libpath:{dir2.Path}", $"/libpaths:{dir3.Path};{dir4.Path}", main.Path]); 594SourcePaths.Add(@""{dir.Path}"") 609> SourcePaths.Add(@""{dir.Path}"") 630ReferencePaths.Add(@""{dir.Path}"") 645> ReferencePaths.Add(@""{dir.Path}"")
InteractiveSessionReferencesTests.cs (1)
143File.Move(libBFile.Path, Path.Combine(dir.Path, "libB.dll"));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (2)
DocumentationComments\DocumentationCommentCompilerTests.cs (2)
4714var resolver = new XmlFileResolver(rootDir.Path); 8655var path = dir.Path;
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
Emit\CompilationOutputFilesTests.cs (1)
57Directory.Delete(dir.Path, recursive: true);
Microsoft.CodeAnalysis.ExternalAccess.Razor.UnitTests (5)
RazorAnalyzerAssemblyResolverTests.cs (5)
116var dir1 = TempRoot.CreateDirectory().Path; 118var dir2 = TempRoot.CreateDirectory().Path; 150var dir1 = TempRoot.CreateDirectory().Path; 152var dir2 = TempRoot.CreateDirectory().Path; 174var dir = TempRoot.CreateDirectory().Path;
Microsoft.CodeAnalysis.Features.UnitTests (2)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (2)
122AddDocument(CreateDesignTimeOnlyDocument(projectPId, name: "dt1.cs", path: Path.Combine(dir.Path, "dt1.cs"))). 982var designTimeOnlyFilePath = Path.Combine(dir.Path, designTimeOnlyFileName);
Microsoft.CodeAnalysis.LanguageServer.UnitTests (261)
AutoLoadProjectsInitializerTests.cs (1)
59var settingsPath = Path.Combine(settingsDirectory.Path, "settings.json");
DefaultFileChangeWatcherTests.cs (94)
39using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 43Assert.Equal(tempDirectory.Path, watchedDirectory.path); 69new WatchedDirectory(root.Path, extensionFilters: []), 70new WatchedDirectory(child.Path, extensionFilters: []) 75Assert.Equal(root.Path, watchedDirectory.path); 87new WatchedDirectory(child.Path, extensionFilters: []), 88new WatchedDirectory(root.Path, extensionFilters: []) 93Assert.Equal(root.Path, watchedDirectory.path); 105new WatchedDirectory(root.Path, extensionFilters: [".cs"]), 106new WatchedDirectory(child.Path, extensionFilters: [".vb"]) 111Assert.Equal(root.Path, watchedDirectory.path); 119var filePath = Path.Combine(tempDirectory.Path, "test.cs"); 122using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 134var filePath = Path.Combine(otherDir.Path, "test.cs"); 137using var context = watcher.CreateContext([new WatchedDirectory(watchedDir.Path, extensionFilters: [])]); 148var filePath = Path.Combine(tempDirectory.Path, "test.txt"); 152using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 163var filePath = Path.Combine(tempDirectory.Path, "test.cs"); 172Assert.Equal(tempDirectory.Path, watchedDirectory.path); 183using var watchedFile1 = context.EnqueueWatchingFile(Path.Combine(tempDirectory.Path, "a.cs")); 184using var watchedFile2 = context.EnqueueWatchingFile(Path.Combine(tempDirectory.Path, "b.cs")); 191Assert.Equal(tempDirectory.Path, watchedDirectory.path); 199var filePath = Path.Combine(tempDirectory.Path, "multi.txt"); 218var filePath = Path.Combine(subDirectory.Path, "nested.cs"); 221using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 243var csFilePath = Path.Combine(tempDirectory.Path, "test.cs"); 244var vbFilePath = Path.Combine(tempDirectory.Path, "test.vb"); 245var txtFilePath = Path.Combine(tempDirectory.Path, "test.txt"); 248using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs", ".vb"])]); 269var filePath = Path.Combine(level3.Path, "deep.cs"); 272using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 285var filePath = Path.Combine(siblingDir.Path, "test.cs"); 288using var context = watcher.CreateContext([new WatchedDirectory(watchedDir.Path, extensionFilters: [])]); 300var filePath = Path.Combine(rootDir.Path, "test.cs"); 303using var context = watcher.CreateContext([new WatchedDirectory(watchedDir.Path, extensionFilters: [])]); 314var filePath = Path.Combine(tempDirectory.Path, "test.txt"); 341context.EnqueueWatchingFile(Path.Combine(seed.Path, "seed.cs")); 344context.EnqueueWatchingFile(Path.Combine(pairA.Path, "one.cs")); 345context.EnqueueWatchingFile(Path.Combine(pairB.Path, "two.cs")); 346context.EnqueueWatchingFile(Path.Combine(other.Path, "three.cs")); 361var context1 = watcher.CreateContext([new WatchedDirectory(root.Path, extensionFilters: [".cs"])]); 362var context2 = watcher.CreateContext([new WatchedDirectory(root.Path, extensionFilters: [".vb"])]); 365var file1 = context1.EnqueueWatchingFile(Path.Combine(root.Path, "extra.txt")); 366var file2 = context2.EnqueueWatchingFile(Path.Combine(root.Path, "extra2.log")); 384var context = watcher.CreateContext([new WatchedDirectory(root.Path, extensionFilters: [".cs"])]); 387_ = context.EnqueueWatchingFile(Path.Combine(root.Path, "extra.txt")); 436var filePath = Path.Combine(tempDirectory.Path, "created.cs"); 456var filePath = Path.Combine(tempDirectory.Path, "modified.cs"); 462using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 476var filePath = Path.Combine(tempDirectory.Path, "deleted.cs"); 482using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 496var filePath = Path.Combine(tempDirectory.Path, "filtered.cs"); 499using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 513var txtFilePath = Path.Combine(tempDirectory.Path, "filtered.txt"); 517using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 534var filePath = Path.Combine(subDirectory.Path, "nested.cs"); 537using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 551var filePath = Path.Combine(tempDirectory.Path, "individual.txt"); 572var filePath = Path.Combine(tempDirectory.Path, "individual_modify.txt"); 596var csharpFilePath = Path.Combine(tempDirectory.Path, "created.cs"); 597var visualBasicFilePath = Path.Combine(tempDirectory.Path, "created.vb"); 601new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"]), 602new WatchedDirectory(tempDirectory.Path, extensionFilters: [".vb"]) 622var filePath = Path.Combine(tempDirectory.Path, "disposed.txt"); 651using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 654var file1 = Path.Combine(tempDirectory.Path, "file1.cs"); 655var file2 = Path.Combine(tempDirectory.Path, "file2.cs"); 656var file3 = Path.Combine(tempDirectory.Path, "file3.cs"); 680var nonExistentDir = Path.Combine(root.Path, "not_yet_created"); 710var originalPath = Path.Combine(tempDirectory.Path, "original.cs"); 711var renamedPath = Path.Combine(tempDirectory.Path, "renamed.cs"); 717using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 730var originalPath = Path.Combine(tempDirectory.Path, "original.cs"); 731var renamedPath = Path.Combine(tempDirectory.Path, "renamed.cs"); 737using var context = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 756using var context1 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 757using var context2 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 762Assert.Equal(tempDirectory.Path, watchedPath.path); 772using var context1 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 773string pathWithExtraSeparators = tempDirectory.Path.Replace(Path.DirectorySeparatorChar.ToString(), Path.DirectorySeparatorChar.ToString() + Path.DirectorySeparatorChar); 778Assert.Equal(tempDirectory.Path, watchedPath.path); 788var context1 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 789var context2 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 793Assert.Equal(tempDirectory.Path, watchedPath.path); 800Assert.Equal(tempDirectory.Path, watchedPath.path); 813var filePath = Path.Combine(tempDirectory.Path, "test.cs"); 816using var context1 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 817using var context2 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 836var filePath = Path.Combine(tempDirectory.Path, "test.cs"); 839var context1 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 840using var context2 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [".cs"])]); 865var context1 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 871using var context2 = watcher.CreateContext([new WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 874Assert.Equal(tempDirectory.Path, watchedPath.path);
ExportProviderBuilderTests.cs (2)
89await using var testServer = await TestLspServer.CreateAsync(new Roslyn.LanguageServer.Protocol.ClientCapabilities(), LoggerFactory, MefCacheDirectory.Path, includeDevKitComponents: true, [dllPath]); 165var mefCompositions = Directory.EnumerateFiles(MefCacheDirectory.Path, "*.mef-composition", SearchOption.AllDirectories);
FileBasedProgramsEntryPointDiscoveryTests.cs (135)
55cacheDirectory: _mefCacheDirectory.Path, 95DeferDeleteCacheDirectory(tempDir.Path); 110await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 113AssertSequenceEqualAndStable([appFile.Path], () => discovery.FindEntryPoints(tempDir.Path)); 120AssertEx.SequenceEqual([appFile.Path], discovery.FindEntryPoints(tempDir.Path)); 124AssertEx.Empty(discovery.FindEntryPoints(tempDir.Path)); 128AssertEx.SequenceEqual([appFile.Path], discovery.FindEntryPoints(tempDir.Path)); 134AssertEx.Empty(discovery.FindEntryPoints(tempDir.Path)); 138AssertEx.SequenceEqual([appFile.Path], discovery.FindEntryPoints(tempDir.Path)); 150DeferDeleteCacheDirectory(tempDir.Path); 163await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 166AssertSequenceEqualAndStable([app2File.Path], () => discovery.FindEntryPoints(tempDir.Path)); 180DeferDeleteCacheDirectory(tempDir.Path); 193await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 196AssertSequenceEqualAndStable([appFile.Path], () => discovery.FindEntryPoints(tempDir.Path)); 200AssertSequenceEqualAndStable([appFile.Path, programFile.Path], () => discovery.FindEntryPoints(tempDir.Path)); 209DeferDeleteCacheDirectory(tempDir.Path); 224new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace1" } 242DeferDeleteCacheDirectory(tempDir.Path); 257new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace1" } 275DeferDeleteCacheDirectory(tempDir.Path); 284await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 299DeferDeleteCacheDirectory(tempDir.Path); 311await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 314AssertEx.SequenceEqual([appFile.Path], discovery.FindEntryPoints(tempDir.Path)); 348DeferDeleteCacheDirectory(tempDir.Path); 350await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 354Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub1")); 355File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/File1.cs"), FbaContent); 356File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/File2.cs"), OrdinaryCsContent); 359var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 362File.Move(Path.Combine(tempDir.Path, @"sub1/File1.cs"), Path.Combine(tempDir.Path, @"sub1/File4.cs")); 363File.Move(Path.Combine(tempDir.Path, @"sub1/File2.cs"), Path.Combine(tempDir.Path, @"sub1/File1.cs")); 366var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 369var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 373var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 382DeferDeleteCacheDirectory(tempDir.Path); 384await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 388Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub1")); 389File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/File1.cs"), OrdinaryCsContent); 390File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/File2.cs"), FbaContent); 393var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 396File.Move(Path.Combine(tempDir.Path, @"sub1/File1.cs"), Path.Combine(tempDir.Path, @"sub1/File4.cs")); 397File.Move(Path.Combine(tempDir.Path, @"sub1/File2.cs"), Path.Combine(tempDir.Path, @"sub1/File1.cs")); 400var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 403var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 407var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 416DeferDeleteCacheDirectory(tempDir.Path); 418await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 422Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub1")); 423Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub2")); 424File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/File1.cs"), FbaContent); 425File.WriteAllText(Path.Combine(tempDir.Path, @"sub2/File1.cs"), OrdinaryCsContent); 428var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 431Directory.Move(Path.Combine(tempDir.Path, @"sub1"), Path.Combine(tempDir.Path, @"sub4")); 432Directory.Move(Path.Combine(tempDir.Path, @"sub2"), Path.Combine(tempDir.Path, @"sub1")); 435var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 438var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 442var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 451DeferDeleteCacheDirectory(tempDir.Path); 453await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 457Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub1")); 458Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub2")); 459File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/File1.cs"), OrdinaryCsContent); 460File.WriteAllText(Path.Combine(tempDir.Path, @"sub2/File1.cs"), FbaContent); 463var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 466Directory.Move(Path.Combine(tempDir.Path, @"sub1"), Path.Combine(tempDir.Path, @"sub4")); 467Directory.Move(Path.Combine(tempDir.Path, @"sub2"), Path.Combine(tempDir.Path, @"sub1")); 470var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 473var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 477var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 485DeferDeleteCacheDirectory(tempDir.Path); 487await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 491File.WriteAllText(Path.Combine(tempDir.Path, @"Fba0.cs"), FbaContent); 492File.WriteAllText(Path.Combine(tempDir.Path, @"Fba1.cs"), FbaContent); 493File.WriteAllText(Path.Combine(tempDir.Path, @"Ordinary2.cs"), OrdinaryCsContent); 496var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 499File.WriteAllText(Path.Combine(tempDir.Path, @"New102.csproj"), CsprojContent); 500File.Delete(Path.Combine(tempDir.Path, @"Fba0.cs")); 501File.WriteAllText(Path.Combine(tempDir.Path, @"NewOrd22.cs"), OrdinaryCsContent); 502File.WriteAllText(Path.Combine(tempDir.Path, @"Ordinary2.cs"), OrdinaryCsContent); 503File.WriteAllText(Path.Combine(tempDir.Path, @"Ordinary2.cs"), FbaContent); 504File.WriteAllText(Path.Combine(tempDir.Path, @"NewOrd5.cs"), OrdinaryCsContent); 505File.WriteAllText(Path.Combine(tempDir.Path, @"New79.csproj"), CsprojContent); 508var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 511var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 515var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 523DeferDeleteCacheDirectory(tempDir.Path); 525await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 529File.WriteAllText(Path.Combine(tempDir.Path, @"Fba0.cs"), FbaContent); 530Directory.CreateDirectory(Path.Combine(tempDir.Path, @"deep/nested")); 531File.WriteAllText(Path.Combine(tempDir.Path, @"deep/nested/Fba1.cs"), FbaContent); 532Directory.CreateDirectory(Path.Combine(tempDir.Path, @"deep/nested")); 533File.WriteAllText(Path.Combine(tempDir.Path, @"deep/nested/Project2.csproj"), CsprojContent); 534File.WriteAllText(Path.Combine(tempDir.Path, @"Project3.csproj"), CsprojContent); 535Directory.CreateDirectory(Path.Combine(tempDir.Path, @"deep/nested/sub3")); 538var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 541File.WriteAllText(Path.Combine(tempDir.Path, @"NewOrd40.cs"), OrdinaryCsContent); 542File.WriteAllText(Path.Combine(tempDir.Path, @"deep/nested/sub3/New52.csproj"), CsprojContent); 543File.WriteAllText(Path.Combine(tempDir.Path, @"deep/nested/NewOrd20.cs"), OrdinaryCsContent); 544File.WriteAllText(Path.Combine(tempDir.Path, @"deep/nested/Fba1.cs"), OrdinaryCsContent); 547var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 550var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 554var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 562DeferDeleteCacheDirectory(tempDir.Path); 564await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 568Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub1")); 569Directory.CreateDirectory(Path.Combine(tempDir.Path, @"sub1/sub3")); 570File.WriteAllText(Path.Combine(tempDir.Path, @"Project0.csproj"), CsprojContent); 571File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/sub3/Fba1.cs"), FbaContent); 572File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/Fba2.cs"), FbaContent); 573File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/Fba3.cs"), FbaContent); 574File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/Ordinary4.cs"), OrdinaryCsContent); 577var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 580File.Delete(Path.Combine(tempDir.Path, @"Project0.csproj")); 581File.WriteAllText(Path.Combine(tempDir.Path, @"sub1/sub3/NewFba64.cs"), FbaContent); 584var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 587var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 591var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 795DeferDeleteCacheDirectory(tempDir.Path); 797await using var testLspServer = await CreateDiscoveryTestServerAsync(tempDir.Path); 802var workspace = new FuzzWorkspace(tempDir.Path); 809foreach (var entry in Directory.EnumerateFileSystemEntries(tempDir.Path)) 818var cacheDirectory = VirtualProjectXmlProvider.GetDiscoveryCacheDirectory(tempDir.Path); 832var firstResult = discovery.FindEntryPoints(tempDir.Path).ToArray(); 847var cachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray(); 854var uncachedResult = discovery.FindEntryPoints(tempDir.Path).Order(StringComparer.OrdinalIgnoreCase).ToArray();
FileBasedProgramsWorkspaceTests.cs (12)
56cacheDirectory: _mefCacheDirectory.Path, 1127WorkspaceFolders = [new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace" }], 1287WorkspaceFolders = [new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace" }] 1347WorkspaceFolders = [new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace" }] 1377WorkspaceFolders = [new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace" }] 1408WorkspaceFolders = [new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace" }] 1469WorkspaceFolders = [new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace" }] 1502new() { DocumentUri = CreateAbsoluteDocumentUri(src1Dir.Path), Name = "workspace1" }, 1503new() { DocumentUri = CreateAbsoluteDocumentUri(src2Dir.Path), Name = "workspace2" }, 1536new() { DocumentUri = CreateAbsoluteDocumentUri(src1Dir.Path), Name = "workspace1" }, 1537new() { DocumentUri = CreateAbsoluteDocumentUri(tempDir.Path), Name = "workspace2" }, 1594new() { DocumentUri = CreateAbsoluteDocumentUri(src1Dir.Path), Name = "workspace1" }
LspFileChangeWatcherTests.cs (8)
31await using var testLspServer = await TestLspServer.CreateAsync(new ClientCapabilities(), LoggerFactory, MefCacheDirectory.Path); 39await using var testLspServer = await TestLspServer.CreateAsync(_clientCapabilitiesWithFileWatcherSupport, LoggerFactory, MefCacheDirectory.Path); 49await using var testLspServer = await TestLspServer.CreateAsync(_clientCapabilitiesWithFileWatcherSupport, LoggerFactory, MefCacheDirectory.Path); 60var context = lspFileChangeWatcher.CreateContext([new ProjectSystem.WatchedDirectory(tempDirectory.Path, extensionFilters: [])]); 65Assert.Equal(tempDirectory.Path, watcher.GlobPattern.Second.BaseUri.Second.GetRequiredParsedUri().LocalPath); 79await using var testLspServer = await TestLspServer.CreateAsync(_clientCapabilitiesWithFileWatcherSupport, LoggerFactory, MefCacheDirectory.Path); 91var filePath = Path.Combine(tempDirectory.Path, "SingleFile.txt"); 97Assert.Equal(tempDirectory.Path, watcher.GlobPattern.Second.BaseUri.Second.GetRequiredParsedUri().LocalPath);
TelemetryReporterTests.cs (1)
20MefCacheDirectory.Path,
Utilities\AbstractLanguageServerClientTests.cs (3)
46var projectPath = Path.Combine(projectDirectory.Path, "Project.csproj"); 60var codePath = Path.Combine(projectDirectory.Path, "Code.cs"); 71ExtensionLogsDirectory.Path,
Utilities\AbstractLanguageServerHostTests.cs (1)
32return TestLspServer.CreateAsync(new ClientCapabilities(), LoggerFactory, MefCacheDirectory.Path, includeDevKitComponents);
VirtualProjectXmlProviderTests.cs (2)
47LoggerFactory, includeDevKitComponents: false, MefCacheDirectory.Path, extensionPaths: null); 155var content = await projectProvider.GetVirtualProjectContentAsync(Path.Combine(tempDir.Path, "BAD"), LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None);
VSCodeSettingsTests.cs (1)
60var settingsPath = Path.Combine(settingsDirectory.Path, "settings.json");
WorkspaceProjectFactoryServiceTests.cs (1)
21loggerFactory, includeDevKitComponents: false, MefCacheDirectory.Path, []);
Microsoft.CodeAnalysis.Rebuild.UnitTests (1)
CSharpDeterministicKeyBuilderTests.cs (1)
406var fileSystem = new TestStrongNameFileSystem(temp.CreateDirectory().Path);
Microsoft.CodeAnalysis.Remote.Razor.UnitTests (4)
RemoteMefCompositionTest.cs (4)
20var cacheDirectory = tempRoot.CreateDirectory().Path; 33var cacheDirectory = tempRoot.CreateDirectory().Path; 52var cacheDirectory = tempRoot.CreateDirectory().Path; 70var cacheDirectory = tempRoot.CreateDirectory().Path;
Microsoft.CodeAnalysis.Scripting.UnitTests (4)
RuntimeMetadataReferenceResolverTests.cs (4)
30new RelativePathResolver(ImmutableArray.Create(directory.Path), directory.Path), 50searchPaths: ImmutableArray.Create(directory.Path), 51baseDirectory: directory.Path);
Microsoft.CodeAnalysis.Test.Utilities (4)
AssemblyLoadTestFixture.cs (1)
23public string TempDirectory => _directory.Path;
TempFiles\DisposableDirectory.cs (3)
21if (Path != null && Directory.Exists(Path)) 25Directory.Delete(Path, recursive: true);
Microsoft.CodeAnalysis.UnitTests (17)
AnalyzerAssemblyLoaderTests.cs (2)
341var analyzerPath = Path.Combine(tempDir.CreateDirectory("a").Path, "analyzer.dll"); 1661AnalyzerTestKind.ShadowLoad => new AnalyzerAssemblyLoader([new ShadowCopyAnalyzerPathResolver(Temp.CreateDirectory().Path)], [AnalyzerAssemblyLoader.DiskAnalyzerAssemblyResolver], alc),
Analyzers\AnalyzerFileReferenceTests.cs (5)
320new BuildPaths(clientDir: directory.Path, workingDir: directory.Path, sdkDir: null, tempDir: null), 349new BuildPaths(clientDir: directory.Path, workingDir: directory.Path, sdkDir: null, tempDir: null), 482var generatorPath = Path.Combine(directory.Path, $"generator_{targetFramework}.dll");
CompilerResolverTests.cs (2)
53var assembly = Loader.CompilerAnalyzerAssemblyResolver.Resolve(Loader, name, ScratchContext, TempRoot.CreateDirectory().Path); 60var assembly = Loader.CompilerAnalyzerAssemblyResolver.Resolve(Loader, AssemblyInCompilerContext.GetName(), ScratchContext, TempRoot.CreateDirectory().Path);
FileSystem\RelativePathResolverTests.cs (2)
171ImmutableArray.Create(dir1.Path, dir2.Path),
InvokeUtil.cs (1)
58pathResolvers = [.. pathResolvers, new ShadowCopyAnalyzerPathResolver(tempRoot.CreateDirectory().Path)];
ShadowCopyAnalyzerPathResolverTests.cs (5)
25PathResolver = new ShadowCopyAnalyzerPathResolver(TempRoot.CreateDirectory().Path); 55var analyzerPath = Path.Combine(TempRoot.CreateDirectory().Path, "analyzer.dll"); 63var analyzerPath = Path.Combine(TempRoot.CreateDirectory().Path, "analyzer.dll"); 77var dir = TempRoot.CreateDirectory().Path; 90var dir = TempRoot.CreateDirectory().Path;
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (6)
NetCoreTests.cs (4)
41["NUGET_PACKAGES"] = _nugetCacheDir.Path 48workingDirectory: SolutionDirectory.Path, 57RunDotNet($@"msbuild ""{normalizedPath}"" /t:restore /bl:{Path.Combine(SolutionDirectory.Path, "restore.binlog")}"); 63var arguments = $@"msbuild ""{normalizedPath}"" /bl:{Path.Combine(SolutionDirectory.Path, "build.binlog")}";
NewlyCreatedProjectsFromDotNetNew.cs (1)
166var projectDirectory = SolutionDirectory.Path;
WorkspaceTestBase.cs (1)
38return Path.Combine(this.SolutionDirectory.Path, NormalizePath(relativeFileName));
Microsoft.CodeAnalysis.Workspaces.UnitTests (3)
CommandLineProject\CommandLineProjectWorkspaceTests.cs (1)
30var info = CommandLineProject.CreateProjectInfo("TestProject", LanguageNames.CSharp, commandLine, tempDirectory.Path, ws);
SolutionTests\SolutionWithSourceGeneratorTests.cs (1)
1467var analyzerPath = Path.Combine(tempDirectory.Path, "Microsoft.CodeAnalysis.TestAnalyzerReference.dll");
WorkspaceTests\AdhocWorkspaceTests.cs (1)
283var analyzerConfigDocFilePath = PathUtilities.CombineAbsoluteAndRelativePaths(Temp.CreateDirectory().Path, ".editorconfig");
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (15)
PersistentStorage\AbstractPersistentStorageTests.cs (4)
873solution = solution.AddDocument(id, "file.cs", "class C { void M() }", filePath: Path.Combine(_persistentFolder.Path, "file.cs")); 893solution = solution.AddDocument(id, "file.cs", "class C { void M() }", filePath: Path.Combine(_persistentFolder.Path, "file.cs")); 1009var configuration = new MockPersistentStorageConfiguration(solution.Id, persistentFolder.Path, throwOnFailure); 1027var configuration = new MockPersistentStorageConfiguration(solutionKey.Id, _persistentFolder.Path, throwOnFailure: true);
ProjectSystemShim\SdkAnalyzerAssemblyRedirectorTests.cs (5)
26var vsDir = Path.Combine(testDir.Path, "vs"); 41var vsDir = Path.Combine(testDir.Path, "vs"); 56var vsDir = Path.Combine(testDir.Path, "vs"); 73var vsDir = Path.Combine(testDir.Path, "vs"); 102var vsDir = Path.Combine(testDir.Path, "vs");
ProjectSystemShim\TempPECompilerServiceTests.cs (2)
31pszOutputFileName: Path.Combine(directory.Path, "Output.dll"), 37optionValues: [Path.Combine(directory.Path, "MissingReference.dll")]);
ProjectSystemShim\VisualStudioCompilationOutputFilesTests.cs (4)
65Directory.Delete(dir.Path, recursive: true); 72var outputs = new CompilationOutputFilesWithImplicitPdbPath(Path.Combine(dir.Path, "nonexistent.dll")); 87var debugDirPdbPath = Path.Combine(dir.Path, "nonexistent.pdb"); 104Directory.Delete(dir.Path, recursive: true);
VBCSCompiler.UnitTests (109)
AnalyzerConsistencyCheckerTests.cs (12)
87var assemblyLoader = AnalyzerAssemblyLoader.CreateNonLockingLoader(directory.CreateDirectory("shadow").Path); 90var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger); 98var assemblyLoader = AnalyzerAssemblyLoader.CreateNonLockingLoader(directory.CreateDirectory("shadow").Path); 113var assemblyLoader = AnalyzerAssemblyLoader.CreateNonLockingLoader(directory.CreateDirectory("shadow").Path); 123var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger); 138var assemblyLoader = AnalyzerAssemblyLoader.CreateNonLockingLoader(directory.CreateDirectory("shadow").Path); 144directory.Path, 154directory.Path, 187var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger); 210var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, assemblyLoader, Logger); 228var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new ThrowingLoader(), Logger); 242var result = AnalyzerConsistencyChecker.Check(directory.Path, analyzerReferences, new AnalyzerAssemblyLoader(), Logger);
BuildClientTests.cs (2)
40workingDir: Temp.CreateDirectory().Path, 41tempDir: Temp.CreateDirectory().Path);
BuildServerConnectionTests.cs (4)
40var workingDirectory = TempRoot.CreateDirectory().Path; 69var workingDirectory = TempRoot.CreateDirectory().Path; 99ProtocolUtil.CreateEmptyCSharp(TempRoot.CreateDirectory().Path), 120var workingDirectory = TempRoot.CreateDirectory().Path;
CompilationCacheBehaviorTests.cs (25)
52var arguments = BuildCompilationArguments(visualBasic, serverData.PipeName, sourceFileName, outputFileName, additionalArguments: $"/a:{supportAssembly}", cachePath: cacheDirectory.Path); 59File.Delete(Path.Combine(workingDirectory.Path, outputFileName)); 65Assert.True(File.Exists(Path.Combine(workingDirectory.Path, outputFileName))); 77var touchedFilesBase = Path.Combine(workingDirectory.Path, "touched"); 90var arguments = BuildCompilationArguments(visualBasic, serverData.PipeName, sourceFileName, outputFileName, additionalArguments: $"/touchedfiles:{touchedFilesBase}", cachePath: cacheDirectory.Path); 97File.Delete(Path.Combine(workingDirectory.Path, outputFileName)); 130var arguments = BuildCompilationArguments(visualBasic, serverData.PipeName, sourceFileName, outputFileName, additionalArguments: $"/reportanalyzer /a:{supportAssembly}", cachePath: cacheDirectory.Path); 139File.Delete(Path.Combine(workingDirectory.Path, outputFileName)); 191var referenceArguments = BuildCompilationArguments(visualBasic, serverData.PipeName, referenceSourceFileName, referenceOutputFileName, cachePath: cacheDirectory.Path); 201cachePath: cacheDirectory.Path); 208File.Delete(Path.Combine(workingDirectory.Path, consumerOutputFileName)); 223var generatedFilesDirectory = Path.Combine(workingDirectory.Path, "generated"); 240cachePath: cacheDirectory.Path); 246File.Delete(Path.Combine(workingDirectory.Path, outputFileName)); 284cachePath: cacheDirectory.Path); 288Assert.True(File.Exists(Path.Combine(workingDirectory.Path, keyFileName))); 290File.Delete(Path.Combine(workingDirectory.Path, outputFileName)); 291File.Delete(Path.Combine(workingDirectory.Path, pdbFileName)); 292File.Delete(Path.Combine(workingDirectory.Path, keyFileName)); 297Assert.True(File.Exists(Path.Combine(workingDirectory.Path, outputFileName))); 298Assert.True(File.Exists(Path.Combine(workingDirectory.Path, pdbFileName))); 299Assert.False(File.Exists(Path.Combine(workingDirectory.Path, keyFileName))); 413var path = Path.Combine(directory.Path, assemblyName + ".dll"); 443var filePath = Path.Combine(currentDirectory.Path, "netstandard.dll"); 507workingDir: currentDirectory.Path,
CompilationCacheTests.cs (39)
63var cacheDir = Temp.CreateDirectory().Path; 96var cacheDir = Temp.CreateDirectory().Path; 98var outputDir = Temp.CreateDirectory().Path; 114var cacheDir = Temp.CreateDirectory().Path; 118var outputDir = Temp.CreateDirectory().Path; 140var cacheDir = Temp.CreateDirectory().Path; 144var outputDir = Temp.CreateDirectory().Path; 176var cacheDir = Temp.CreateDirectory().Path; 180var outputDir = Temp.CreateDirectory().Path; 205var cacheDir = Temp.CreateDirectory().Path; 209var outputDir = Temp.CreateDirectory().Path; 233var cacheDir = Temp.CreateDirectory().Path; 237var outputDir = Temp.CreateDirectory().Path; 259var cacheDir = Temp.CreateDirectory().Path; 266var outputDir = Temp.CreateDirectory().Path; 298var cacheDir = Temp.CreateDirectory().Path; 304var outputDir = Temp.CreateDirectory().Path; 328var cacheDir = Temp.CreateDirectory().Path; 343var cacheDir = Temp.CreateDirectory().Path; 349var outputDir = Temp.CreateDirectory().Path; 380var cacheDir = Temp.CreateDirectory().Path; 386var outputDir = Temp.CreateDirectory().Path; 390var restoreDir = Temp.CreateDirectory().Path; 411var cacheDir = Temp.CreateDirectory().Path; 426var cacheDir = Temp.CreateDirectory().Path; 455var cacheDir = Temp.CreateDirectory().Path; 459var outputDir = Temp.CreateDirectory().Path; 481var cacheDir = Temp.CreateDirectory().Path; 486var outputDir = Temp.CreateDirectory().Path; 502var cacheDir = Temp.CreateDirectory().Path; 507var outputDir = Temp.CreateDirectory().Path; 526var cacheDir = Temp.CreateDirectory().Path; 560var cacheDir = Temp.CreateDirectory().Path; 582var cacheDir = Temp.CreateDirectory().Path; 603var cacheDir = Temp.CreateDirectory().Path; 626var cacheDir = Temp.CreateDirectory().Path; 648var cacheDir = Temp.CreateDirectory().Path; 665var cacheDir = Temp.CreateDirectory().Path; 685var cacheDir = Temp.CreateDirectory().Path;
CompilerServerApiTest.cs (1)
115var request = BuildRequest.Create(RequestLanguage.CSharpCompile, workingDirectory: temp.CreateDirectory().Path, tempDirectory: null, compilerHash: BuildProtocolConstants.GetCommitHash(), libDirectory: null, args: Array.Empty<string>());
CompilerServerTests.cs (20)
97var filePath = Path.Combine(currentDirectory.Path, "netstandard.dll"); 168workingDir: currentDirectory.Path, 198finalFlags = $"{flags} /shared:{serverData.PipeName} /pathmap:{tempDir.Path}=/ /out:{outFile} {srcFile}"; 224return new DisposableFile(Path.Combine(directory.Path, resultFileName)); 257var newTempDir = _tempDirectory.CreateDirectory(new string('a', 100 - _tempDirectory.Path.Length)); 259new[] { new KeyValuePair<string, string>("TMPDIR", newTempDir.Path) }, 526Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "hello.exe"))); 556Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "hello.exe"))); 573Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "missingfile.exe"))); 591Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "hello.exe"))); 616Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "app.exe"))); 634Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "missingfile.exe"))); 663Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "hellovb.exe"))); 692Assert.False(File.Exists(Path.Combine(_tempDirectory.Path, "app.exe"))); 1030$"src1.cs /shared:{serverData.PipeName} /nologo /t:library /out:" + Path.Combine(libDirectory.Path, "lib.dll"), 1048additionalEnvironmentVars: new Dictionary<string, string>() { { "LIB", libDirectory.Path } }); 1081$"src1.vb /shared:{serverData.PipeName} /vbruntime* /nologo /t:library /out:" + Path.Combine(libDirectory.Path, "lib.dll"), 1100additionalEnvironmentVars: new Dictionary<string, string>() { { "LIB", libDirectory.Path } }); 1364var tmp = Path.Combine(_tempDirectory.Path, "Temp"); 1398var tmp = Path.Combine(_tempDirectory.Path, "Temp");
TouchedFileLoggingTests.cs (4)
49var loader = AnalyzerAssemblyLoader.CreateNonLockingLoader(Temp.CreateDirectory().Path); 60var touchedBase = Path.Combine(touchedDir.Path, "touched"); 100var loader = AnalyzerAssemblyLoader.CreateNonLockingLoader(Temp.CreateDirectory().Path); 111var touchedBase = Path.Combine(touchedDir.Path, "touched");
VBCSCompilerServerTests.cs (2)
303var workingDirectory = TempRoot.CreateDirectory().Path; 344var workingDirectory = TempRoot.CreateDirectory().Path;