964 references to Path
InteractiveHost.UnitTests (37)
AbstractInteractiveHostTests.cs (1)
209
return (file.
Path
, image);
InteractiveHostCoreInitTests.cs (2)
58
var dllDir = Path.GetDirectoryName(dll.
Path
)!;
86
await Host.AddReferenceAsync(Path.GetFileName(dll.
Path
));
InteractiveHostDesktopInitTests.cs (2)
31
var dllDir = Path.GetDirectoryName(dll.
Path
)!;
59
await Host.AddReferenceAsync(Path.GetFileName(dll.
Path
));
InteractiveHostDesktopTests.cs (32)
183
var file = Temp.CreateFile().WriteAllText(MethodWithInfiniteLoop + "\r\nfoo();").
Path
;
202
var file = Temp.CreateFile().WriteAllText("1 1").
Path
;
237
").
Path
;
273
await Host.ExecuteFileAsync(file.
Path
);
276
Assert.True(errorOut.StartsWith(file.
Path
+ "(1,7):", StringComparison.Ordinal), "Error output should start with file name, line and column");
464
Assert.True(await LoadReference(file1.
Path
));
465
Assert.True(await LoadReference(file2.
Path
));
509
#r ""{file.
Path
}""
521
#r ""{file.
Path
}""
552
#r ""{file1.
Path
}""
553
#r ""{file2.
Path
}""
563
Assert.Equal(@"(2,1): error CS1704: An assembly with the same simple name 'C' has already been imported. Try removing one of the references (e.g. '" + file1.
Path
+ @"') or sign them to enable side-by-side.
587
#r ""{file1.
Path
}""
588
#r ""{file2.
Path
}""
705
rspFile.WriteAllText($"/lib:{directory1.Path} /r:Assembly2.dll {initFile.
Path
}");
707
await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.
Path
, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
723
{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.
Path
))}
743
rspFile.WriteAllText($"{initFile.
Path
}");
745
await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.
Path
, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
749
@$"{initFile.
Path
}(1,1): error CS0006: {string.Format(CSharpResources.ERR_NoMetadataFile, "Assembly.dll")}", error);
770
await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.
Path
, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
803
$@"{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.
Path
))}
818
{initFile.
Path
}
821
await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.
Path
, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
827
AssertEx.AssertEqualToleratingWhitespaceDifferences($@"{initFile.
Path
}(1,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}
831
{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.
Path
))}
848
await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.
Path
, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
853
$@"{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.
Path
))}
916
#r """ + dll.
Path
+ @"""
945
await Execute($@"#r ""{libFile.
Path
}""");
1028
await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.
Path
, culture, uiCulture, Host.OptionsOpt!.Platform));
1038
{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.
Path
))}
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (32)
CopyRefAssemblyTests.cs (22)
47
File.WriteAllText(file.
Path
, "");
52
SourcePath = file.
Path
,
65
File.WriteAllText(file.
Path
, "test");
71
SourcePath = file.
Path
,
76
AssertEx.AssertEqualToleratingWhitespaceDifferences($$"""Copying reference assembly from "{{file.
Path
}}" to "{{dest}}".""", engine.Log);
85
File.WriteAllText(source.
Path
, "test");
87
File.WriteAllText(dest.
Path
, "dest");
92
SourcePath = source.
Path
,
93
DestinationPath = dest.
Path
,
99
Could not extract the MVID from "{{source.
Path
}}". Are you sure it is a reference assembly?
100
Copying reference assembly from "{{source.
Path
}}" to "{{dest}}".
104
Assert.Equal("test", File.ReadAllText(dest.
Path
));
112
File.WriteAllBytes(source.
Path
, TestResources.General.MVID1);
113
var sourceTimestamp = File.GetLastWriteTimeUtc(source.
Path
).ToString("O");
116
File.WriteAllBytes(dest.
Path
, TestResources.General.MVID2);
117
var destTimestamp = File.GetLastWriteTimeUtc(dest.
Path
).ToString("O");
123
SourcePath = source.
Path
,
124
DestinationPath = dest.
Path
,
130
Source reference assembly "{{source.
Path
}}" (timestamp "{{sourceTimestamp}}", MVID "f851dda2-6ea3-475e-8c0d-19bd3c4d9437") differs from destination "{{dest.
Path
}}" (timestamp "{{destTimestamp}}", MVID "8e1ed25b-2980-4f32-9dee-c1e3b0a57c4b").
131
Copying reference assembly from "{{source.
Path
}}" to "{{dest.
Path
}}".
DotNetSdkTests.cs (6)
42
<Compile Include=""{libFile.
Path
}"" Link=""Lib.cs"" />
433
editorConfigFile2.
Path
494
globalConfigFile.
Path
,
495
globalConfigFile2.
Path
561
globalConfigFile.
Path
,
562
globalConfigFile2.
Path
IntegrationTests.cs (2)
23
return ProcessUtilities.Run(file.
Path
, "", Path.GetDirectoryName(file.
Path
));
TestUtilities\DotNetSdkTestBase.cs (2)
191
Project.
Path
,
233
Project.
Path
,
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (389)
CommandLineIVTTests.cs (8)
38
source2.
Path
,
44
var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.
Path
)}";
115
source2.
Path
,
121
var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.
Path
)}";
194
source2.
Path
,
200
var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.
Path
)}";
279
source2.
Path
,
285
var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.
Path
)}";
CommandLineTests.cs (355)
147
var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.
Path
});
167
var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.
Path
});
200
"/analyzerconfig:" + analyzerConfig.
Path
,
201
src.
Path
});
203
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
243
"/analyzerconfig:" + modifyPath(editorconfig.
Path
, doubleSlashAnalyzerConfig),
244
modifyPath(src.
Path
, doubleSlashSource),
292
"/analyzerconfig:" + analyzerConfig.
Path
,
295
"/additionalfile:" + additionalFile.
Path
,
296
src.
Path
});
298
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
345
"/analyzerconfig:" + analyzerConfig.
Path
,
346
src.
Path
});
348
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
354
$@"warning InvalidSeverityInAnalyzerConfig: The diagnostic 'cs0169' was given an invalid severity 'garbage' in the analyzer config file at '{analyzerConfig.
Path
}'.
381
"/analyzerconfig:" + analyzerConfig1.
Path
,
382
"/analyzerconfig:" + analyzerConfig2.
Path
,
383
src.
Path
401
var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", src.
Path
});
421
var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/codepage:932", src.
Path
});
454
").
Path
;
876
string tmpFileName = Temp.CreateFile().WriteAllBytes(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }).
Path
;
1248
CleanupAllGeneratedFiles(file1.
Path
);
1249
CleanupAllGeneratedFiles(file2.
Path
);
1250
CleanupAllGeneratedFiles(file3.
Path
);
1251
CleanupAllGeneratedFiles(file4.
Path
);
1252
CleanupAllGeneratedFiles(file5.
Path
);
2262
AssertEx.Equal(File.ReadAllBytes(sl.
Path
), blob);
2267
CleanupAllGeneratedFiles(src.
Path
);
2291
AssertEx.Equal(File.ReadAllBytes(sl.
Path
), blob);
2295
CleanupAllGeneratedFiles(src.
Path
);
2320
CleanupAllGeneratedFiles(src.
Path
);
2440
expectedEmbeddedMap.Add(src.
Path
, embed_cs);
2445
expectedEmbeddedMap.Add(src2.
Path
, embed2_cs);
2450
expectedEmbeddedMap.Add(txt.
Path
, embed_xyz);
2473
CleanupAllGeneratedFiles(src.
Path
);
2791
CleanupAllGeneratedFiles(file.
Path
);
2813
CleanupAllGeneratedFiles(file.
Path
);
2838
var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.
Path
, "a.cs" }, WorkingDirectory);
2840
Assert.Equal(expected: file.
Path
, actual: parsedArgs.RuleSetPath);
2864
var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + "\"" + file.
Path
+ "\"", "a.cs" }, WorkingDirectory);
2866
Assert.Equal(expected: file.
Path
, actual: parsedArgs.RuleSetPath);
2893
parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.
Path
, "a.cs" }, WorkingDirectory);
2896
Assert.Equal(expected: file.
Path
, actual: parsedArgs.RuleSetPath);
2901
Assert.Equal(file.
Path
, (string)err.Arguments[0]);
2933
CleanupAllGeneratedFiles(file.
Path
);
2961
var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs", "/ruleset:" + ruleSetFile.
Path
});
2968
CleanupAllGeneratedFiles(file.
Path
);
2998
"/ruleset:" + ruleSetFile.
Path
, "/warnaserror+", "/nowarn:8032" });
3009
"/warnaserror+", "/ruleset:" + ruleSetFile.
Path
, "/nowarn:8032" });
3016
CleanupAllGeneratedFiles(file.
Path
);
3517
"/ruleset:" + ruleSetFile.
Path
, "/warn:0" });
3528
"/warn:0", "/ruleset:" + ruleSetFile.
Path
});
3535
CleanupAllGeneratedFiles(file.
Path
);
3688
CleanupAllGeneratedFiles(file.
Path
);
3708
CleanupAllGeneratedFiles(file.
Path
);
4331
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
4342
var silverlight = Temp.CreateFile().WriteAllBytes(Silverlight.System).
Path
;
4343
var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).
Path
;
4351
"/appconfig:" + appConfigFile.
Path
,
4352
srcFile.
Path
}).Run(outWriter);
4356
CleanupAllGeneratedFiles(srcFile.
Path
);
4357
CleanupAllGeneratedFiles(appConfigFile.
Path
);
4364
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
4371
srcFile.
Path
}).Run(outWriter);
4375
CleanupAllGeneratedFiles(srcFile.
Path
);
4491
var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/modulename:hocusPocus ", "/out:" + exeName + " ", file1.
Path
});
4516
CleanupAllGeneratedFiles(file1.
Path
);
4760
CleanupAllGeneratedFiles(src.
Path
);
4779
CleanupAllGeneratedFiles(src.
Path
);
4787
var filePath = tempFolder.CreateFile("temp").
Path
;
4807
CleanupAllGeneratedFiles(src.
Path
);
5895
public class Mod { }").
Path
;
5900
public class Mod { }").
Path
;
5905
class Test { static void Main() {} }").
Path
;
5942
string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"public static class Extensions { public static bool EB(this bool b) { return b; } }").
Path
;
5943
string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").
Path
;
5962
string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Mod { }").
Path
;
5963
string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").
Path
;
6142
var srcFile = Temp.CreateFile().WriteAllText("\u265A").
Path
;
6146
var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.
Path
, expectedRetCode: 1);
6151
CleanupAllGeneratedFiles(tempOut.
Path
);
6157
var srcFile = Temp.CreateFile().WriteAllText("\u265A").
Path
;
6161
var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /utf8output /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.
Path
, expectedRetCode: 1);
6166
CleanupAllGeneratedFiles(tempOut.
Path
);
6186
CleanupAllGeneratedFiles(aCs.
Path
);
6200
CleanupAllGeneratedFiles(aCs.
Path
);
6214
CleanupAllGeneratedFiles(aCs.
Path
);
6314
var kfile = "/keyfile:" + snkFile.
Path
;
6319
parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698a.
Path
, "CS1698b.cs" }, WorkingDirectory);
6322
parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698b.
Path
, "/out:" + cs1698a.
Path
, "CS1698.cs" }, WorkingDirectory);
6332
CleanupAllGeneratedFiles(snkFile.
Path
);
6333
CleanupAllGeneratedFiles(cs1698a.
Path
);
6334
CleanupAllGeneratedFiles(cs1698b.
Path
);
6335
CleanupAllGeneratedFiles(cs1698.
Path
);
6341
var binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).
Path
;
6426
").
Path
;
6431
").
Path
;
6450
").
Path
;
6459
").
Path
;
6464
").
Path
;
6472
").
Path
;
6478
").
Path
;
6525
").
Path
;
6530
").
Path
;
6566
").
Path
;
6572
").
Path
;
6607
").
Path
;
6613
").
Path
;
6957
CleanupAllGeneratedFiles(file.
Path
);
6981
CleanupAllGeneratedFiles(file.
Path
);
7004
CleanupAllGeneratedFiles(file.
Path
);
7032
CleanupAllGeneratedFiles(file.
Path
);
7105
CleanupAllGeneratedFiles(file1.
Path
);
7106
CleanupAllGeneratedFiles(file2.
Path
);
7128
CleanupAllGeneratedFiles(file.
Path
);
7228
CleanupAllGeneratedFiles(file.
Path
);
7256
CleanupAllGeneratedFiles(file.
Path
);
7284
CleanupAllGeneratedFiles(file.
Path
);
7310
CleanupAllGeneratedFiles(file.
Path
);
7336
CleanupAllGeneratedFiles(file.
Path
);
7500
CleanupAllGeneratedFiles(file.
Path
);
7539
CleanupAllGeneratedFiles(file.
Path
);
7808
Path.GetFileName(sourceFile.
Path
),
7818
string.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.
Path
)),
7819
Path.GetFileName(sourceFile.
Path
),
7861
}").
Path
;
7865
").
Path
;
7908
}").
Path
;
7912
").
Path
;
7942
}").
Path
;
7946
").
Path
;
7976
}").
Path
;
7980
").
Path
;
8016
outWriter.ToString().Replace(Path.GetFileName(src.
Path
), "{FILE}").Trim());
8025
CleanupAllGeneratedFiles(src.
Path
);
8031
return Temp.CreateFile().WriteAllBytes(cscRsp).
Path
;
8170
string OriginalSource = src.
Path
;
8180
CleanupAllGeneratedFiles(src.
Path
);
8240
CleanupAllGeneratedFiles(src.
Path
);
8283
CleanupAllGeneratedFiles(src.
Path
);
8284
CleanupAllGeneratedFiles(xml.
Path
);
8354
CleanupAllGeneratedFiles(src.
Path
);
8355
CleanupAllGeneratedFiles(xml.
Path
);
8394
}").
Path
;
8531
}").
Path
;
8570
").
Path
;
8594
").
Path
;
8628
").
Path
;
8647
string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").
Path
;
8648
string badres = Temp.CreateFile().WriteAllBytes(TestResources.DiagnosticTests.badresfile).
Path
;
8672
string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").
Path
;
8673
string badres = Temp.CreateFile().WriteAllBytes(new byte[] { 0, 0 }).
Path
;
8701
}").
Path
;
8723
} ").
Path
;
8767
using (var stream = File.OpenWrite(exe.
Path
))
8774
using (var stream = File.OpenWrite(pdb.
Path
))
8780
int exitCode1 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source1.
Path
}).Run(outWriter);
8783
ValidateZeroes(exe.
Path
, oldSize);
8784
ValidateZeroes(pdb.
Path
, oldSize);
8786
int exitCode2 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source2.
Path
}).Run(outWriter);
8789
using (var peFile = File.OpenRead(exe.
Path
))
8791
PdbValidation.ValidateDebugDirectory(peFile, null, pdb.
Path
, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false);
8794
Assert.True(new FileInfo(exe.
Path
).Length < oldSize);
8795
Assert.True(new FileInfo(pdb.
Path
).Length < oldSize);
8797
int exitCode3 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source3.
Path
}).Run(outWriter);
8800
using (var peFile = File.OpenRead(exe.
Path
))
8802
PdbValidation.ValidateDebugDirectory(peFile, null, pdb.
Path
, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false);
8838
var fsDll = new FileStream(libDll.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8839
var fsPdb = new FileStream(libPdb.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8842
int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/debug:full", libSrc.
Path
}).Run(outWriter);
8850
AssertEx.Equal(new byte[] { 0x4D, 0x5A }, ReadBytes(libDll.
Path
, 2));
8853
AssertEx.Equal(new byte[] { 0x4D, 0x69 }, ReadBytes(libPdb.
Path
, 2));
8878
var fsDll = new FileStream(libDll.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8879
var fsPdb = new FileStream(libPdb.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8888
var output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $"/target:library /debug:portable \"{libSrc.
Path
}\"", startFolder: dir.ToString());
8904
using (var fsNewDll = File.OpenRead(libDll.
Path
))
8910
AssertEx.Equal(new[] { (byte)'B', (byte)'S', (byte)'J', (byte)'B' }, ReadBytes(libPdb.
Path
, 4));
8919
File.Delete(libSrc.
Path
);
8920
File.Delete(libDll.
Path
);
8921
File.Delete(libPdb.
Path
);
8944
File.SetAttributes(libDll.
Path
, FileAttributes.ReadOnly);
8946
var fsDll = new FileStream(libDll.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8949
int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.
Path
}).Run(outWriter);
8950
Assert.Contains($"error CS2012: Cannot open '{libDll.
Path
}' for writing", outWriter.ToString());
8952
AssertEx.Equal(new[] { (byte)'D', (byte)'L', (byte)'L' }, ReadBytes(libDll.
Path
, 3));
8968
int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.
Path
}).Run(outWriter);
9172
} ").
Path
;
9216
string sourcePath = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(source).
Path
;
9241
var sourcePath = Temp.CreateFile(directory: WorkingDirectory, extension: ".cs").WriteAllText(source).
Path
;
9314
commandLineArgs = new[] { @"tmpDir\a.cs", tempFile.
Path
};
9325
commandLineArgs = new[] { tempFile.
Path
, @"tmpDir\*.cs" };
9340
commandLineArgs = new[] { "/preferreduilang:en", tempFile.
Path
, "tmpDir\a.cs" };
9345
commandLineArgs = new[] { tempFile.
Path
, @"tmpDi\r*a?.cs" };
9354
commandLineArgs = new[] { tempFile.
Path
, currentDrive + @":a.cs" };
9360
commandLineArgs = new[] { "/preferreduilang:en", tempFile.
Path
, @":a.cs" };
9365
CleanupAllGeneratedFiles(tempFile.
Path
);
9438
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9444
new[] { "/reportanalyzer", "/t:library", srcFile.
Path
},
9455
CleanupAllGeneratedFiles(srcFile.
Path
);
9496
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9498
var args = new List<string>() { "/reportanalyzer", "/t:library", "/a:" + typeof(DoNothingGenerator).Assembly.Location, srcFile.
Path
};
9520
CleanupAllGeneratedFiles(srcFile.
Path
);
9529
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9538
new[] { "/reportanalyzer", "/t:library", srcFile.
Path
},
9554
CleanupAllGeneratedFiles(srcFile.
Path
);
9569
workingDirectory: Path.GetDirectoryName(srcFile.
Path
),
9570
args: new[] { "/errorlog:" + errorLog.
Path
, "/warnaserror+", "/nologo", "/t:library", srcFile.
Path
},
9580
CleanupAllGeneratedFiles(srcFile.
Path
);
9581
CleanupAllGeneratedFiles(errorLog.
Path
);
9589
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9592
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.
Path
},
9606
CleanupAllGeneratedFiles(srcFile.
Path
);
9614
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9617
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", $"/warnaserror:{AnalyzerExecutor.AnalyzerExceptionDiagnosticId}", srcFile.
Path
},
9628
CleanupAllGeneratedFiles(srcFile.
Path
);
9636
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9639
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.
Path
},
9650
CleanupAllGeneratedFiles(srcFile.
Path
);
9743
").
Path
;
9794
DefaultParse(new[] { "/lib:" + invalidPath, sourceFile.
Path
}, WorkingDirectory).Errors.Verify(
9797
DefaultParse(new[] { "/lib:" + nonExistentPath, sourceFile.
Path
}, WorkingDirectory).Errors.Verify(
9802
DefaultParse(new[] { sourceFile.
Path
}, WorkingDirectory, additionalReferenceDirectories: invalidPath).Errors.Verify(
9805
DefaultParse(new[] { sourceFile.
Path
}, WorkingDirectory, additionalReferenceDirectories: nonExistentPath).Errors.Verify(
9809
CleanupAllGeneratedFiles(sourceFile.
Path
);
9835
string filePath = Temp.CreateFile().WriteAllText(@"class C {}").
Path
;
10008
string filePath = Temp.CreateFile().WriteAllText(source).
Path
;
10058
string filePath = Temp.CreateFile().WriteAllText(source).
Path
;
10129
CleanupAllGeneratedFiles(src.
Path
);
10188
CleanupAllGeneratedFiles(src.
Path
);
10254
CleanupAllGeneratedFiles(src.
Path
);
10361
CleanupAllGeneratedFiles(src.
Path
);
10364
void RunWithCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache", "/additionalFile:" + additionalFile.
Path
}, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null);
10458
CleanupAllGeneratedFiles(src.
Path
);
10461
void RunWithCache() => VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/langversion:preview", "/features:enable-generator-cache", "/analyzerConfig:" + editorconfig.
Path
, "/analyzerConfig:" + globalconfig.
Path
}, generators: new[] { generator.AsSourceGenerator() }, driverCache: cache, analyzers: null);
10495
CleanupAllGeneratedFiles(src.
Path
);
10535
CleanupAllGeneratedFiles(src.
Path
);
10566
sourceFile.
Path
10663
CleanupAllGeneratedFiles(file.
Path
);
10775
CleanupAllGeneratedFiles(file.
Path
);
10918
CleanupAllGeneratedFiles(file.
Path
);
11116
CleanupAllGeneratedFiles(file.
Path
);
11200
CleanupAllGeneratedFiles(file.
Path
);
11304
CleanupAllGeneratedFiles(file.
Path
);
11403
CleanupAllGeneratedFiles(src.
Path
);
11751
var output = ProcessUtilities.RunAndGetOutput(csc32exe.
Path
, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir32.Path}""=X:\ ""{sourceFile.
Path
}""", expectedRetCode: 0, startFolder: dir32.Path);
11754
output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir64.Path}""=X:\ ""{sourceFile.
Path
}""", expectedRetCode: 0, startFolder: dir64.Path);
12025
var cscPath = dir.CopyFile(s_CSharpCompilerExecutable).
Path
;
12501
string filePath = Temp.CreateFile().WriteAllText("").
Path
;
12521
string filePath = Temp.CreateFile().WriteAllText("").
Path
;
12584
CleanupAllGeneratedFiles(srcFile.
Path
);
12646
CleanupAllGeneratedFiles(srcFile.
Path
);
12702
CleanupAllGeneratedFiles(srcFile.
Path
);
12789
CleanupAllGeneratedFiles(sourceFile.
Path
);
12890
CleanupAllGeneratedFiles(sourceFile.
Path
);
13000
CleanupAllGeneratedFiles(sourceFile.
Path
);
13023
CleanupAllGeneratedFiles(srcFile.
Path
);
13049
CleanupAllGeneratedFiles(srcFile.
Path
);
13116
CleanupAllGeneratedFiles(srcFile.
Path
);
13144
CleanupAllGeneratedFiles(srcFile.
Path
);
13404
"/analyzerconfig:" + analyzerConfig.
Path
,
13405
src.
Path
};
13424
arguments = arguments.Append($"/ruleset:{rulesetFile.
Path
}");
13430
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
13522
additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.
Path
).ToArray();
13572
additionalArgs = additionalArgs.Append("/ruleset:" + rulesetFile.
Path
).ToArray();
13660
"/analyzerconfig:" + analyzerConfig.
Path
,
13661
src.
Path
};
13675
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
13720
output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13729
output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13737
output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13759
var args = new[] { "/nologo", "/t:library", "/preferreduilang:en", src.
Path
};
13798
var args = new[] { "/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.
Path
};
13889
additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.
Path
}").ToArray();
13937
CleanupAllGeneratedFiles(src.
Path
);
13992
CleanupAllGeneratedFiles(src.
Path
);
14023
CleanupAllGeneratedFiles(src.
Path
);
14060
<file id=""1"" name=""{src.
Path
}"" language=""C#"" checksumAlgorithm=""SHA256"" checksum=""A0-78-BB-A8-E8-B1-E1-3B-E8-63-80-7D-CE-CC-4B-0D-14-EF-06-D3-9B-14-52-E1-95-C6-64-D1-36-EC-7C-25"" />
14106
CleanupAllGeneratedFiles(src.
Path
);
14136
CleanupAllGeneratedFiles(src.
Path
);
14170
CleanupAllGeneratedFiles(src.
Path
);
14208
CleanupAllGeneratedFiles(src.
Path
);
14239
options: TestOptions.DebugDll.WithCryptoKeyFile(Path.GetFileName(snk.
Path
)).WithStrongNameProvider(virtualSnProvider),
14278
CleanupAllGeneratedFiles(src.
Path
);
14299
CleanupAllGeneratedFiles(src.
Path
);
14322
CleanupAllGeneratedFiles(src.
Path
);
14391
CleanupAllGeneratedFiles(src.
Path
);
14419
CleanupAllGeneratedFiles(src.
Path
);
14487
CleanupAllGeneratedFiles(src.
Path
);
14556
CleanupAllGeneratedFiles(src.
Path
);
14637
CleanupAllGeneratedFiles(src.
Path
);
14656
VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.
Path
}, generators: new[] { generator }, analyzers: null);
14719
"/analyzerconfig:" + analyzerConfig1.
Path
,
14720
"/analyzerconfig:" + analyzerConfig2.
Path
,
14721
"/analyzerconfig:" + analyzerConfig3.
Path
,
14723
src.
Path
14787
new[] { "/t:library", "/nologo", "/warnaserror+", src.
Path
},
14807
new[] { "/t:library", "/nologo", "/nowarn:CS8785", src.
Path
},
14832
new[] { "/t:library", "/nologo", "/warnaserror+", src.
Path
},
14852
new[] { "/t:library", "/nologo", "/nowarn:CS8784", src.
Path
},
14887
VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/additionalfile:" + additionalFile.
Path
, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null);
14890
CleanupAllGeneratedFiles(src.
Path
);
14932
new[] { "/nologo", "/t:library", srcFile.
Path
},
14938
CleanupAllGeneratedFiles(srcFile.
Path
);
14961
"/analyzerconfig:" + analyzerConfig1.
Path
,
14962
"/analyzerconfig:" + analyzerConfig2.
Path
,
14963
src.
Path
14991
var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.
Path
+ "," + analyzerConfig2.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15010
output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.
Path
+ "," + analyzerConfig2.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15041
"/analyzerconfig:" + analyzerConfig.
Path
,
15042
"/analyzerconfig:" + globalConfig.
Path
,
15045
"/additionalfile:" + additionalFile.
Path
,
15046
src.
Path
});
15126
additionalFlags: configs.SelectAsArray(c => "/analyzerconfig:" + c.
Path
)
15148
VerifyOutput(dir, src, additionalFlags: new[] { "/warnaserror+", "/analyzerconfig:" + globalConfig.
Path
}, includeCurrentAssemblyAsAnalyzerReference: false);
15171
additionalFlags = additionalFlags.Append("/analyzerconfig:" + globalConfig.
Path
).ToArray();
15205
[{PathUtilities.NormalizeWithForwardSlash(src.
Path
)}]
15209
VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:0164", "/analyzerconfig:" + globalConfig.
Path
}, expectedErrorCount: 0, includeCurrentAssemblyAsAnalyzerReference: false);
15226
VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + globalConfig.
Path
}, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() });
15228
VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:Warning01", "/analyzerconfig:" + globalConfig.
Path
}, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() });
15248
additionalFlags: new[] { "/additionalfile:" + additionalFile.
Path
},
15329
additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.
Path
).ToArray();
15450
string path1 = additionalFile1.
Path
;
15451
string path2 = additionalFile2?.
Path
?? Path.Combine(srcDirectory.Path, additionalFilePath2);
15502
var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15506
VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
, "/nowarn:CS8034" }, expectedWarningCount: 0, includeCurrentAssemblyAsAnalyzerReference: false);
15509
output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
, "/warnAsError:CS8034" }, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15526
var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15530
VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
, "/analyzerConfig:" + globalconfig.
Path
}, includeCurrentAssemblyAsAnalyzerReference: false);
15567
src.
Path
});
15578
"/analyzerconfig:" + analyzerConfig.
Path
,
15579
src.
Path
});
15581
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
15619
src.
Path
});
15631
src.
Path
});
15701
src.
Path
});
15712
"/analyzerconfig:" + analyzerConfig.
Path
,
15713
src.
Path
});
15715
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
15754
src.
Path
});
15766
src.
Path
});
15832
"/analyzerconfig:" + analyzerConfig.
Path
,
15833
src.
Path
});
15871
"/analyzerconfig:" + analyzerConfig.
Path
,
15872
src.
Path
});
15911
"/analyzerconfig:" + analyzerConfig.
Path
,
15912
src.
Path
});
SarifErrorLoggerTests.cs (9)
41
var hello = Temp.CreateFile().WriteAllText(helloWorldCS).
Path
;
72
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
106
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
138
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
175
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
210
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
245
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
280
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
313
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
SarifV2ErrorLoggerTests.cs (7)
445
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
525
var sourceFile1 = sourceDir.CreateFile("source1.cs").WriteAllText(source1).
Path
;
526
var sourceFile2 = sourceDir.CreateFile("source2.cs").WriteAllText(source2).
Path
;
527
var editorconfigFile = sourceDir.CreateFile(".editorconfig").WriteAllText(editorconfigText).
Path
;
597
var sourceFile = Temp.CreateFile().WriteAllText(source).
Path
;
681
string[] arguments = new[] { "/nologo", sourceFile.
Path
, "/preferreduilang:en", $"/errorlog:{errorLogFile}{GetErrorLogQualifier(version)}" };
748
CleanupAllGeneratedFiles(sourceFile.
Path
);
TouchedFileLoggingTests.cs (10)
38
var hello = Temp.CreateFile().WriteAllText(helloWorldCS).
Path
;
66
var hello = Temp.CreateFile().WriteAllText(helloWorldCS).
Path
;
77
</configuration>").
Path
;
79
var silverlight = Temp.CreateFile().WriteAllBytes(Silverlight.System).
Path
;
80
var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).
Path
;
112
var hello = Temp.CreateFile().WriteAllText(helloWorldCS).
Path
;
113
var snkPath = Temp.CreateFile("TestKeyPair_", ".snk").WriteAllBytes(TestResources.General.snKey).
Path
;
151
public class C { }").
Path
;
160
"/doc:" + xml.
Path
,
172
expectedWrites.Add(xml.
Path
);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (6)
Emit\CompilationEmitTests.cs (1)
2000
options: TestOptions.ReleaseDll.WithCryptoKeyFile(snk.
Path
).WithPublicSign(true));
Emit\ResourceTests.cs (5)
58
lib = LoadLibraryEx(exe.
Path
, IntPtr.Zero, 0x00000002);
119
var fileVer = FileVersionInfo.GetVersionInfo(exe.
Path
);
148
lib = LoadLibraryEx(exe.
Path
, IntPtr.Zero, 0x00000002);
201
var fileVer = FileVersionInfo.GetVersionInfo(exe.
Path
);
847
lib = LoadLibraryEx(exeFile.
Path
, IntPtr.Zero, 0x00000002);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (12)
Attributes\EmitTestStrongNameProvider.cs (1)
32
var keyFile = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey).
Path
;
Attributes\InternalsVisibleToAndStrongNameTests.cs (9)
383
CSharpCompilation other = CreateCompilation(s, options: TestOptions.ReleaseDll.WithCryptoKeyFile(tempFile.
Path
), parseOptions: parseOptions);
537
[assembly: System.Reflection.AssemblyKeyFile(@""" + snk.
Path
+ @""")]
541
c = CreateCompilation(source1, options: TestOptions.SigningReleaseModule.WithCryptoKeyFile(snk.
Path
).WithPublicSign(true));
610
.WithCryptoKeyFile(snk.
Path
)
632
.WithCryptoKeyFile(pubKeyFile.
Path
)
656
.WithCryptoKeyFile(pubKeyFile.
Path
)
721
.WithCryptoKeyFile(snk.
Path
),
742
.WithCryptoKeyFile(snk.
Path
),
1517
using (var metadata = new FileStream(file.
Path
, FileMode.Open))
Semantics\ExtensionTests.cs (2)
50704
string xmlFilePath = xmlFile.
Path
;
50758
string xmlFilePath = xmlFile.
Path
;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
EditAndContinue\StatementEditingTests.cs (1)
4006
delegateDefs = MetadataReference.CreateFromImage(File.ReadAllBytes(tempAssembly.
Path
));
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (31)
InteractiveSessionReferencesTests.cs (31)
345
#r ""{c1.
Path
}""
346
#r ""{c2.
Path
}""
361
#r ""{c1.
Path
}""
363
#r ""{c2.
Path
}""
381
#r ""{c1.
Path
}""
382
#r ""{c2.
Path
}""
400
#r ""{c1.
Path
}""
402
#r ""{c2.
Path
}""
420
#r ""{c1.
Path
}""
428
#r ""{c2.
Path
}""
446
Diagnostic(ErrorCode.ERR_NoImplicitConv, "c2").WithArguments($"C [{c2.
Path
}]", $"C [{c1.
Path
}]"));
630
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
632
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
644
Assert.Equal(fileBase1.
Path
, ((PortableExecutableReference)libBaseRefAndSymbol.Key).FilePath);
688
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
690
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
702
Assert.Equal(fileBase1.
Path
, ((PortableExecutableReference)libBaseRefAndSymbol.Key).FilePath);
754
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
756
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
822
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
824
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
890
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
892
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
958
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
960
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
1026
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
1028
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
1094
var s0 = await CSharpScript.RunAsync($@"#r ""{file1.
Path
}""", ScriptOptions);
1097
var s2 = await s1.ContinueWithAsync($@"#r ""{file2.
Path
}""");
1120
var s0 = await CSharpScript.RunAsync("C c;", ScriptOptions.WithReferences(libFile.
Path
));
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (43)
CommandLineRunnerTests.cs (22)
265
""{script.
Path
}""
272
args: [$@"@""{rsp.
Path
}""", "/arg5", "--", "/arg7"],
296
args: [script.
Path
, "arg1", "arg2", "arg3"]);
313
args: [script.
Path
, "@arg1", "@arg2", "@arg3"]);
331
{script.
Path
}
339
args: [$"@{rsp.
Path
}", "/arg5", "--", "/arg7"],
362
args: ["--", script.
Path
, "@arg1", "@arg2", "@arg3"]);
448
script.
Path
539
var runner = CreateRunner([$"/loadpath:{dir1.Path}", $"/loadpaths:{dir2.Path};{dir3.Path}", main.
Path
]);
576
var runner = CreateRunner(["/r:4.dll", $"/lib:{dir1.Path}", $"/libpath:{dir2.Path}", $"/libpaths:{dir3.Path};{dir4.Path}", main.
Path
]);
676
var csi = CreateRunner(["b.csx"], responseFile: rsp.
Path
);
705
var runner = CreateRunner(["/i", init.
Path
], input:
725
var runner = CreateRunner([$@"/r:""{reference.
Path
}""", "/i", init.
Path
], input:
732
{init.
Path
}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}
740
$@"{init.
Path
}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}",
832
$@"#r ""{file1.
Path
}""
834
#r ""{file2.
Path
}""
841
> #r ""{file1.
Path
}""
843
> #r ""{file2.
Path
}""
846
{string.Format(ScriptingResources.AssemblyAlreadyLoaded, libBaseName, "0.0.0.0", fileBase1.
Path
, fileBase2.
Path
)}
InteractiveSessionReferencesTests.cs (9)
40
#r ""{libFile.
Path
}""
86
var libDRef = MetadataReference.CreateFromFile(libDFile.
Path
);
94
var r1 = swapReferences ? libBFile.
Path
: libAFile.
Path
;
95
var r2 = swapReferences ? libAFile.
Path
: libBFile.
Path
;
131
var libBRef = MetadataReference.CreateFromFile(libBFile.
Path
);
137
#r ""{libAFile.
Path
}""
143
File.Move(libBFile.
Path
, Path.Combine(dir.Path, "libB.dll"));
InteractiveSessionTests.cs (12)
1213
lib1.Emit(file1.
Path
);
1221
lib2.Emit(file2.
Path
);
1224
#r ""{file1.
Path
}""
1225
#r ""{file2.
Path
}""
1236
lib.Emit(file.
Path
);
1238
string dir = Path.Combine(Path.GetDirectoryName(file.
Path
), "subdir");
1239
string libFileName = Path.GetFileName(file.
Path
);
1254
lib.Emit(file.
Path
);
1256
string root = Path.GetPathRoot(file.
Path
);
1257
string unrooted = file.
Path
[root.Length..];
1295
var r2 = CSharpScript.Create($@"#r ""{fileMain.
Path
}""", ScriptOptions).ContinueWith($@"M.X.F").RunAsync().Result.ReturnValue;
1326
var r2 = CSharpScript.Create($@"#r ""{fileMain.
Path
}""", ScriptOptions).ContinueWith($@"M.X.F").RunAsync().Result.ReturnValue;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\SemanticErrorTests.cs (1)
22028
var comp = CreateCompilationWithMscorlib40AndDocumentationComments(string.Format(sourceTemplate, xmlFile.
Path
));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (76)
Compilation\GetUnusedImportDirectivesTests.cs (1)
212
var snkPath = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey).
Path
;
Compilation\ReferenceManagerTests.cs (10)
852
string p1 = Temp.CreateFile().WriteAllBytes(TestResources.General.MDTestLib1).
Path
;
924
string p1 = dir.CreateFile("netModule1.netmodule").WriteAllBytes(TestResources.SymbolsTests.netModule.netModule1).
Path
;
993
string p1 = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemCore).
Path
;
994
string p2 = Temp.CreateFile().CopyContentFrom(p1).
Path
;
1013
var p1 = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).
Path
;
1014
var p2 = Temp.CreateFile().WriteAllBytes(Net20.Resources.System).
Path
;
1043
var ref1 = AssemblyMetadata.CreateFromFile(exe1.
Path
).GetReference(aliases: ImmutableArray.Create("A1"));
1044
var ref2 = AssemblyMetadata.CreateFromFile(exe2.
Path
).GetReference(aliases: ImmutableArray.Create("A2"));
1270
var path1 = Temp.CreateFile().WriteAllBytes(TestResources.General.MDTestLib1).
Path
;
1271
var path2 = Temp.CreateFile().WriteAllBytes(TestResources.General.MDTestLib2).
Path
;
DocumentationComments\DocumentationCommentCompilerTests.cs (51)
4497
string xmlFilePath = xmlFile.
Path
;
4532
string xmlFilePath = xmlFile.
Path
;
4570
string xmlFilePath = xmlFile.
Path
;
4605
string xmlFilePath = xmlFile.
Path
;
4641
string xmlFilePath = xmlFile.
Path
;
4795
var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.
Path
));
4866
var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.
Path
));
4892
var xmlFilePath = xmlFile.
Path
;
4929
var xmlFilePath1 = xmlFile1.
Path
;
4932
var xmlFilePath2 = xmlFile2.
Path
;
4965
var xmlFilePath = xmlFile.
Path
;
4999
var xmlFilePath1 = xmlFile1.
Path
;
5002
var xmlFilePath2 = xmlFile2.
Path
;
5032
var xmlFilePath = xmlFile.
Path
;
5066
var xmlFilePath1 = xmlFile1.
Path
;
5069
var xmlFilePath2 = xmlFile2.
Path
;
5099
var xmlFilePath = xmlFile.
Path
;
5131
var xmlFilePath = xmlFile.
Path
;
5165
var xmlFilePath = xmlFile.
Path
;
5219
var xmlFilePath = xmlFile.
Path
;
5258
var xmlFilePath1 = xmlFile1.
Path
;
5261
var xmlFilePath2 = xmlFile2.
Path
;
5297
var xmlFilePath = xmlFile.
Path
;
5374
var xmlFilePath = xmlFile.
Path
;
5409
var xmlFilePath = xmlFile.
Path
;
5444
var xmlFilePath = xmlFile.
Path
;
5491
var xmlFilePath = xmlFile.
Path
;
5532
var xmlFilePath = xmlFile.
Path
;
5586
var xmlFilePath = xmlFile.
Path
;
5631
var xmlFilePath = xmlFile.
Path
;
5708
var xmlFilePath = xmlFile.
Path
;
5788
var xmlFilePath = xmlFile.
Path
;
5859
var xmlFilePath = xmlFile.
Path
;
5903
var xmlFilePath = xmlFile.
Path
;
5941
var xmlFilePath = xmlFile.
Path
;
5982
var xmlFilePath = xmlFile.
Path
;
6018
var xmlFilePath = xmlFile.
Path
;
6060
var xmlFilePath = xmlFile.
Path
;
6130
var xmlFilePath = xmlFile.
Path
;
6299
var xmlFilePath = xmlFile.
Path
;
7019
var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.
Path
));
7037
Assert.Equal(string.Format(expectedTemplate, TestHelpers.AsXmlCommentText(xmlFile.
Path
)), actual);
8268
var xmlFilePath = xmlFile.
Path
;
8358
string fullPath = xmlFile.
Path
;
8382
/// <include file='file://" + xmlFile.
Path
+ @"' path='hello'/>
8389
@"<include file='file://" + xmlFile.
Path
+ @"' path='hello'/>").
8390
WithArguments("file://" + xmlFile.
Path
, "hello", "File not found.").WithLocation(2, 5));
8400
string xmlFilePath = Path.GetFileName(xmlFile.
Path
);
8401
string dirPath = Path.GetDirectoryName(xmlFile.
Path
);
8452
/// <include file='" + xmlFile.
Path
+ @"' path='hello'/>
8500
var xmlFilePath = xmlFile.
Path
;
DocumentationComments\DocumentationModeTests.cs (1)
369
var xmlFilePath = xmlFile.
Path
;
Symbols\CompilationCreationTests.cs (9)
2677
var data = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemData).
Path
;
2678
var core = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemCore).
Path
;
2679
var xml = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemXml).
Path
;
2680
var system = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).
Path
;
2722
var data = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemData).
Path
;
2723
var core = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemCore).
Path
;
2724
var system = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).
Path
;
2774
var csClasses01 = Temp.CreateFile().WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01).
Path
;
2775
var csInterfaces01 = Temp.CreateFile().WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSInterfaces01).
Path
;
Symbols\Metadata\PE\TypeForwarders.cs (2)
1585
var result = ProcessUtilities.RunAndGetOutput(asmB.
Path
);
1593
result = ProcessUtilities.RunAndGetOutput(asmB2.
Path
);
Symbols\SymbolErrorTests.cs (2)
7131
ilBytes = ReadFromFile(reference.
Path
);
7200
ilBytes = ReadFromFile(reference.
Path
);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
2031
return MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.
Path
));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
EditAndContinue\EditAndContinueLanguageServiceTests.cs (5)
378
loader: new WorkspaceFileTextLoader(workspace.Services.SolutionServices, sourceFile.
Path
, Encoding.UTF8),
379
filePath: sourceFile.
Path
));
384
var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source1, sourceFilePath: sourceFile.
Path
);
390
File.WriteAllText(sourceFile.
Path
, "class C1 { void M() { System.Console.WriteLine(\"b\"); } }", Encoding.UTF8);
403
Assert.Equal(sourceFile.
Path
, key);
Emit\CompilationOutputFilesTests.cs (2)
40
var outputs = new CompilationOutputFiles(dllFile.
Path
, pdbFile.
Path
);
Utilities\SymbolEquivalenceComparerTests.cs (1)
1937
var bytes = File.ReadAllBytes(tempAssembly.
Path
);
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
154
=> projectDirectory?.CreateFile(fileName).WriteAllText(content, Encoding.UTF8).
Path
?? Path.Combine(TempRoot.Root, fileName);
Microsoft.CodeAnalysis.Features.UnitTests (98)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (88)
66
var sourceTreeA1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesA1, sourceBytesA1.Length, encodingA, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileA.
Path
);
67
var sourceTreeB1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesB1, sourceBytesB1.Length, encodingB, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileB.
Path
);
68
var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.
Path
);
90
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.
Path
, encodingA),
91
filePath: sourceFileA.
Path
));
97
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileB.
Path
, encodingB),
98
filePath: sourceFileB.
Path
));
104
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileC.
Path
, encodingC),
105
filePath: sourceFileC.
Path
));
111
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileE.
Path
, encodingE),
112
filePath: sourceFileE.
Path
));
133
filePath: sourceFileD.
Path
));
151
solution = solution.WithDocumentTextLoader(documentIdB, new WorkspaceFileTextLoader(solution.Services, sourceFileB.
Path
, encodingB), PreservationMode.PreserveValue);
205
solution = solution.WithProjectOutputFilePath(document.Project.Id, moduleFile.
Path
);
206
_mockCompilationOutputs.Add(document.Project.Id, new CompilationOutputFiles(moduleFile.
Path
));
281
AddTestDocument(source1, sourceFile.
Path
, out var documentId).Project.Solution;
305
$"test: {sourceFile.
Path
}: (2,0)-(2,22): Error ENC2012: {string.Format(FeaturesResources.EditAndContinueDisallowedByProject, ["test", "*optimized*"])}"
367
AddTestDocument(source, sourceFile1.
Path
, out var documentId).Project.Solution;
460
AddTestDocument(source, sourceFile1.
Path
, out var documentId).Project.Solution;
539
AddTestDocument(source, sourceFile1.
Path
, out var documentId).Project.Solution;
607
AddTestDocument(source, sourceFile.
Path
).Project.Solution;
668
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
714
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
762
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
797
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
835
solution = solution.WithProjectOutputFilePath(projectId, moduleFile.
Path
).AddDocument(documentInfo);
837
_mockCompilationOutputs.Add(projectId, new CompilationOutputFiles(moduleFile.
Path
));
910
var sourceFilePath = dir.CreateFile(sourceFileName).WriteAllText(source, Encoding.UTF8).
Path
;
1007
using var stream = File.OpenRead(moduleFile.
Path
);
1022
_mockCompilationOutputs.Add(projectId, new CompilationOutputFiles(moduleFile.
Path
));
1043
[$"proj: <no location>: Error ENC1001: {string.Format(FeaturesResources.ErrorReadingFile, moduleFile.
Path
, expectedErrorMessage)}"],
1095
AddDocument("a.cs", CreateText(source1), filePath: sourceFile.
Path
);
1100
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
1126
[$"proj: {document2.FilePath}: (0,0)-(0,0): Error ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.
Path
)}"],
1150
AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.
Path
);
1155
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
, checksumAlgorithm: SourceHashAlgorithms.Default);
1164
using var fileLock = File.Open(sourceFile.
Path
, FileMode.Open, FileAccess.Read, FileShare.None);
1175
[$"test: {document1.FilePath}: (0,0)-(0,0): Error ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.
Path
)}"],
1211
AddDocument("test.cs", CreateText(sourceA), filePath: sourceFileA.
Path
);
1217
EmitAndLoadLibraryToDebuggee(project.Id, sourceA, sourceFilePath: sourceFileA.
Path
);
1227
var documentB = project.AddTestDocument(sourceB, path: sourceFileB.
Path
);
1276
AddTestDocument(sourceA, sourceFileA.
Path
).Project.
1277
AddTestDocument(sourceB, sourceFileA.
Path
, out var documentBId).Project.Solution;
1307
AddTestDocument(source1, sourceFile1.
Path
, out var documentBId).Project.Solution;
1318
solution = solution.AddTestDocument(projectId, source2, sourceFile2.
Path
, out var document2Id).Project.Solution;
1368
var moduleId = EmitLibrary(project.Id, source1, sourceFilePath: sourceFile.
Path
);
1375
var document0 = project.AddTestDocument(source0, path: sourceFile.
Path
);
1524
AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.
Path
);
1527
var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source1, sourceFilePath: sourceFile.
Path
, encoding: encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256);
1752
var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.
Path
);
1758
var document1 = project.AddTestDocument(source1, path: sourceFile.
Path
);
1795
moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.
Path
);
1841
AddDocument("test.cs", CreateText(source1), filePath: sourceFile.
Path
);
1846
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
1885
AddDocument("test.cs", CreateText(source1), filePath: sourceFile.
Path
);
1890
var moduleId = EmitLibrary(project.Id, source1, sourceFilePath: sourceFile.
Path
);
2533
.AddTestDocument(sourceA1, path: sourceFileA.
Path
, out var documentAId).Project.Solution;
2542
.AddTestDocument(sourceB1, path: sourceFileB.
Path
, out var documentBId).Project.Solution
2574
.AddTestDocument(sourceA1, path: sourceFileA.
Path
, out var documentAId).Project.Solution
2576
.AddTestDocument(sourceB1, path: sourceFileB.
Path
, out var documentBId).Project.Solution;
2619
.AddTestDocument(sourceA1, path: sourceFileA.
Path
, out var documentAId).Project.Solution;
2623
var mvidA = EmitAndLoadLibraryToDebuggee(projectAId, sourceA1, sourceFilePath: sourceFileA.
Path
, assemblyName: "A");
2624
var mvidB = EmitAndLoadLibraryToDebuggee(projectBId, sourceB1, sourceFilePath: sourceFileB.
Path
, assemblyName: "B");
2635
sourceFileA.
Path
,
2640
sourceFileB.
Path
,
2650
AddTestDocument("class B { virtual int F() => 1; }", path: sourceFileB.
Path
, out var documentBId).Project.Solution;
2955
AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.
Path
);
2964
Assert.Equal(sourceFile.
Path
, filePath);
2972
var moduleId = EmitAndLoadLibraryToDebuggee(documentId.ProjectId, source1, sourceFilePath: sourceFile.
Path
);
3001
solution = solution.WithDocumentText(documentId, CreateTextFromFile(sourceFile.
Path
));
3040
AddDocument("test.cs", CreateText(source2), filePath: sourceFile.
Path
);
3047
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
3085
$"test: {document3.FilePath}: (0,0)-(0,0): Warning ENC1008: {string.Format(FeaturesResources.Changing_source_file_0_in_a_stale_project_has_no_effect_until_the_project_is_rebuit, sourceFile.
Path
)}"
3116
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
3139
var document1 = project.AddDocument("test.cs", sourceText1, filePath: sourceFile.
Path
);
3174
AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.
Path
);
3179
var moduleId = EmitLibrary(project.Id, sourceOnDisk, sourceFilePath: sourceFile.
Path
);
3356
_mockCompilationOutputs.Add(document1.Project.Id, new CompilationOutputFiles(moduleFile.
Path
, pdbFile.
Path
));
4151
_mockCompilationOutputs.Add(projectA.Id, new CompilationOutputFiles(moduleFileA.
Path
, pdbFileA.
Path
));
4152
_mockCompilationOutputs.Add(projectB.Id, new CompilationOutputFiles(moduleFileB.
Path
, pdbFileB.
Path
));
4285
var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).
Path
;
4385
var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).
Path
;
5488
var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.
Path
, assemblyName: "Proj");
5494
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.
Path
, Encoding.UTF8),
5495
filePath: sourceFileA.
Path
));
EditAndContinue\UnitTestingHotReloadServiceTests.cs (3)
35
var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.
Path
, assemblyName: "Proj");
43
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.
Path
, Encoding.UTF8),
44
filePath: sourceFileA.
Path
));
EditAndContinue\WatchHotReloadServiceTests.cs (7)
56
var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.
Path
, assemblyName: "Proj");
62
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.
Path
, Encoding.UTF8),
63
filePath: sourceFileA.
Path
));
112
[$"P: {sourceFileA.
Path
}: (0,17)-(0,18): Error ENC0110: {string.Format(FeaturesResources.Changing_the_signature_of_0_requires_restarting_the_application_because_it_is_not_supported_by_the_runtime, FeaturesResources.method)}"],
130
[$"{sourceFileA.
Path
}: (0,72)-(0,73): Error CS1002: {CSharpResources.ERR_SemicolonExpected}"],
145
$"{sourceFileA.
Path
}: (0,21)-(0,28): Error CS0103: {string.Format(CSharpResources.ERR_NameNotInContext, "Unknown")}",
146
$"{sourceFileA.
Path
}: (0,51)-(0,52): Warning CS0219: {string.Format(CSharpResources.WRN_UnreferencedVarAssg, "x")}",
Microsoft.CodeAnalysis.LanguageServer.UnitTests (7)
ExportProviderBuilderTests.cs (2)
143
var fileInfo = new FileInfo(tempFile.
Path
);
146
return tempFile.
Path
;
VirtualProjectXmlProviderTests.cs (5)
71
var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.
Path
, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None);
96
var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.
Path
, logger, CancellationToken.None);
128
var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.
Path
, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None);
179
var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.
Path
, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None);
183
Assert.Equal(appFile.
Path
, diagnostic.Location.Path);
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (23)
MetadataShadowCopyProviderTests.cs (23)
87
var sc1 = _provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
88
var sc2 = _provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
90
Assert.Equal(dll.
Path
, sc1.PrimaryModule.OriginalPath);
91
Assert.NotEqual(dll.
Path
, sc1.PrimaryModule.FullPath);
95
Assert.Equal(File.ReadAllBytes(dll.
Path
), File.ReadAllBytes(sc1.PrimaryModule.FullPath));
96
Assert.Equal(File.ReadAllBytes(doc.
Path
), File.ReadAllBytes(sc1.DocumentationFile.FullPath));
104
_provider.SuppressShadowCopy(dll.
Path
);
106
var sc1 = _provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
126
var sc1 = _provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
127
Assert.NotEqual(dll.
Path
, sc1.PrimaryModule.FullPath);
139
string path0 = dir.CreateFile("MultiModule.dll").WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).
Path
;
140
string path1 = dir.CreateFile("mod2.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod2).
Path
;
141
string path2 = dir.CreateFile("mod3.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod3).
Path
;
185
var f0 = Temp.CreateFile().WriteAllText("bogus").
Path
;
188
string f1 = Temp.CreateFile().WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).
Path
;
199
var sc1 = _provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
200
var sc2 = _provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
202
var md1 = _provider.GetMetadata(dll.
Path
, MetadataImageKind.Assembly);
212
var sc3a = _provider.GetMetadataShadowCopy(dll2.
Path
, MetadataImageKind.Module);
229
var sc = provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
235
sc = provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
241
sc = provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
247
sc = provider.GetMetadataShadowCopy(dll.
Path
, MetadataImageKind.Assembly);
Microsoft.CodeAnalysis.Scripting.UnitTests (6)
RuntimeMetadataReferenceResolverTests.cs (6)
31
packageResolver: new PackageResolver(ImmutableDictionary<string, ImmutableArray<string>>.Empty.Add("nuget:N/1.0", ImmutableArray.Create(assembly1.
Path
, assembly2.
Path
))),
37
AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly1.
Path
, assembly2.
Path
);
43
AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly2.
Path
);
58
AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly2.
Path
);
Microsoft.CodeAnalysis.Test.Utilities (10)
AssemblyLoadTestFixture.cs (3)
403
", MetadataReference.CreateFromFile(delta1InAnalyzerReferencesDelta1.
Path
), compilerReference);
547
var fileInfo = new FileInfo(tempFile.
Path
);
550
return tempFile.
Path
;
Metadata\IlasmUtilities.cs (3)
80
string sourceFileName = Path.GetFileNameWithoutExtension(sourceFile.
Path
);
84
Path.ChangeExtension(Path.GetFileName(sourceFile.
Path
), "dll"));
111
var arguments = $"\"{sourceFile.
Path
}\" -DLL {(autoInherit ? "" : "-noautoinherit")} -out=\"{assemblyPath}\"";
TempFiles\DisposableFile.cs (4)
29
if (
Path
!= null)
33
File.Delete(
Path
);
40
DeleteFileOnClose(
Path
);
48
{1}: {2}",
Path
, ex.GetType().Name, ex.Message), ex);
Microsoft.CodeAnalysis.UnitTests (106)
AnalyzerAssemblyLoaderTests.cs (26)
574
var deltaFile = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
575
var gammaFile = tempDir.CreateDirectory("b").CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).
Path
;
686
var deltaFile1 = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
688
var gammaFile = tempSubDir.CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).
Path
;
689
var deltaFile2 = tempSubDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
728
var deltaFile = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
729
var gammaFile = tempDir.CreateDirectory("b").CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).
Path
;
980
var unregisteredDeltaPath = dir1.CopyFile(testFixture.Delta2).
Path
;
981
var epsilonPath = dir1.CopyFile(testFixture.Epsilon).
Path
;
984
var registeredDeltaPath = dir2.CopyFile(testFixture.Delta2).
Path
;
1038
var epsilonFile = tempDir1.CreateFile("Epsilon.dll").CopyContentFrom(testFixture.Epsilon).
Path
;
1039
var delta1File = tempDir1.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
1040
var delta2File = tempDir2.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta2).
Path
;
1278
var deltaNewFilePath = dir.CopyFile(deltaFilePath).
Path
;
1292
var assemblyFilePath = dir.CreateFile(assemblyName + ".dll").WriteAllBytes(array).
Path
;
1423
var destFile = tempRoot.CreateDirectory().CreateOrOpenFile($"{assembly.GetName().Name}.dll").
Path
;
1458
var deltaCopy = tempDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
1483
var deltaCopy = tempDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
1518
var delta1File = tempDir1.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).
Path
;
1519
var delta2File = tempDir2.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta2).
Path
;
1520
var gammaFile = tempDir3.CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).
Path
;
1574
var path = tempFile.
Path
;
1609
var analyzerPath = tempDir.CreateFile("AnalyzerWithLoc.dll").CopyContentFrom(testFixture.AnalyzerWithLoc).
Path
;
1610
var analyzerResourcesPath = tempDir.CreateDirectory("en-GB").CreateFile("AnalyzerWithLoc.resources.dll").CopyContentFrom(testFixture.AnalyzerWithLocResourceEnGB).
Path
;
1632
var analyzerPath = tempDir.CreateFile("AnalyzerWithLoc.dll").CopyContentFrom(testFixture.AnalyzerWithLoc).
Path
;
1633
var analyzerResourcesPath = tempDir.CreateDirectory("es").CreateFile("AnalyzerWithLoc.resources.dll").CopyContentFrom(testFixture.AnalyzerWithLocResourceEnGB).
Path
;
Analyzers\AnalyzerFileReferenceTests.cs (4)
199
var textFile = directory.CreateFile("Goo.txt").WriteAllText("I am the very model of a modern major general.").
Path
;
231
var textFile = directory.CreateFile("Goo.txt").WriteAllText("I am the very model of a modern major general.").
Path
;
319
args: new[] { "/nologo", $@"/analyzer:""{_testFixture.AnalyzerWithLaterFakeCompilerDependency}""", "/nostdlib", $@"/r:""{corlib}""", "/out:something.dll", source.
Path
},
348
args: new[] { "/nologo", $@"/analyzer:""{_testFixture.AnalyzerWithFakeCompilerDependency}""", $@"/analyzer:""{_testFixture.AnalyzerWithFakeCompilerDependency}""", "/nostdlib", $@"/r:""{corlib}""", "/out:something.dll", source.
Path
},
AssemblyUtilitiesTests.cs (12)
46
var assemblyFile = directory.CreateFile("FakeAssembly.dll").
Path
;
58
var assemblyFile = directory.CreateFile("FakeAssembly.dll").
Path
;
59
var satelliteFile = directory.CreateFile("FakeAssembly.resources.dll").
Path
;
71
var assemblyFile = directory.CreateFile("FakeAssembly.dll").
Path
;
72
var satelliteFile = directory.CreateDirectory("de").CreateFile("FakeAssembly.resources.dll").
Path
;
84
var assemblyFile = directory.CreateFile("FakeAssembly.dll").
Path
;
85
var satelliteFile = directory.CreateDirectory("de").CreateDirectory("FakeAssembly.resources").CreateFile("FakeAssembly.resources.dll").
Path
;
97
var assemblyFile = directory.CreateFile("FakeAssembly.dll").
Path
;
98
var satelliteFileDE = directory.CreateDirectory("de").CreateFile("FakeAssembly.resources.dll").
Path
;
99
var satelliteFileFR = directory.CreateDirectory("fr").CreateFile("FakeAssembly.resources.dll").
Path
;
111
var assemblyFile = directory.CreateFile("FakeAssembly.dll").
Path
;
112
var satelliteFile = directory.CreateDirectory("de").CreateDirectory("OtherAssembly.resources").CreateFile("FakeAssembly.resources.dll").
Path
;
CommonCommandLineParserTests.cs (14)
45
return RuleSet.LoadEffectiveRuleSetFromFile(file.
Path
);
48
return RuleSetProcessor.LoadFromFile(file.
Path
);
474
var ruleSet = RuleSet.LoadEffectiveRuleSetFromFile(file.
Path
);
989
RuleSet.LoadEffectiveRuleSetFromFile(file.
Path
);
994
Assert.Contains(string.Format(CodeAnalysisResources.InvalidRuleSetInclude, newFile.
Path
, string.Format(CodeAnalysisResources.RuleSetBadAttributeValue, "Action", "Default")), e.Message, StringComparison.Ordinal);
1014
var includePaths = RuleSet.GetEffectiveIncludesFromFile(file.
Path
);
1017
Assert.Equal(expected: file.
Path
, actual: includePaths[0]);
1051
var includePaths = RuleSet.GetEffectiveIncludesFromFile(file.
Path
);
1054
Assert.Equal(expected: file.
Path
, actual: includePaths[0]);
1055
Assert.Equal(expected: include.
Path
, actual: includePaths[1]);
1103
var includePaths = RuleSet.GetEffectiveIncludesFromFile(file.
Path
);
1106
Assert.Equal(expected: file.
Path
, actual: includePaths[0]);
1107
Assert.Equal(expected: include1.
Path
, actual: includePaths[1]);
1108
Assert.Equal(expected: include2.
Path
, actual: includePaths[2]);
FileSystem\RelativePathResolverTests.cs (2)
167
var f1 = dir1.CreateFile("f.dll").
Path
;
168
var f2 = dir2.CreateFile("f.dll").
Path
;
MetadataReferences\AssemblyIdentityComparerTests.cs (1)
632
policyPath: appConfig.
Path
);
MetadataReferences\AssemblyMetadataTests.cs (2)
59
var mm = dir.CreateFile("MultiModule.dll").WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).
Path
;
142
var metadata = AssemblyMetadata.CreateFromFile(invalidModuleName.
Path
);
MetadataReferences\AssemblyPortabilityPolicyTests.cs (28)
75
var stream = new FileStream(appConfig.
Path
, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
80
Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
));
89
Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
));
105
Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
));
125
var stream = new FileStream(appConfig.
Path
, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
127
AssertIsEnabled(appConfig.
Path
, platform: false, nonPlatform: true, fusionOnly: true);
142
<linkedConfiguration href=""file://" + appConfig2.
Path
+ @"""/>
161
AssertIsEnabled(appConfig1.
Path
, platform: false, nonPlatform: true);
175
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
183
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
193
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
209
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
227
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
245
AssertIsEnabled(appConfig.
Path
, platform: false, nonPlatform: true);
263
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: false);
281
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: false);
300
AssertIsEnabled(appConfig.
Path
, platform: false, nonPlatform: false);
320
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: false);
344
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
364
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
381
AssertIsEnabled(appConfig.
Path
, platform: true, nonPlatform: true);
389
var policy = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
);
402
var policy1 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
);
403
var policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
);
408
policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
);
413
policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
);
427
policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.
Path
);
432
policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig2.
Path
);
MetadataReferences\MetadataReferenceTests.cs (12)
96
var stream = File.OpenRead(file.
Path
);
110
File.Delete(file.
Path
);
163
var r = MetadataReference.CreateFromFile(file.
Path
,
166
Assert.Equal(file.
Path
, r.FilePath);
167
Assert.Equal(file.
Path
, r.Display);
173
Assert.Equal(props, MetadataReference.CreateFromFile(file.
Path
, props).Properties);
176
File.Delete(file.
Path
);
187
var r = MetadataReference.CreateFromFile(file.
Path
, MetadataReferenceProperties.Module);
189
Assert.Equal(file.
Path
, r.FilePath);
190
Assert.Equal(file.
Path
, r.Display);
196
Assert.Equal(props, MetadataReference.CreateFromFile(file.
Path
, props).Properties);
199
File.Delete(file.
Path
);
ShadowCopyAnalyzerPathResolverTests.cs (1)
36
var analyzerPath = TempRoot.CreateDirectory().CreateFile("analyzer.dll").
Path
;
Text\StringTextDecodingTests.cs (4)
218
string path = Temp.CreateFile().WriteAllBytes(encoding.GetBytes(expectedText)).
Path
;
306
File.WriteAllText(tmpFile.
Path
, expectedText, encoding);
308
using (FileStream fs = new FileStream(tmpFile.
Path
, FileMode.Open, FileAccess.Read))
322
using (FileStream fs = new FileStream(tmpFile.
Path
, FileMode.Open, FileAccess.Read))
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
VisualStudioMSBuildWorkspaceTests.cs (1)
3223
var expectedEditorConfigPath = SolutionDirectory.CreateOrOpenFile(".editorconfig").
Path
;
Microsoft.CodeAnalysis.Workspaces.UnitTests (9)
CommandLineProject\CommandLineProjectWorkspaceTests.cs (1)
40
Assert.Equal(tempFile.
Path
, gooDoc.FilePath);
SolutionTests\SolutionTests.cs (8)
1626
solution = solution.AddDocument(DocumentInfo.Create(fileDocumentId, "d.cs", loader: new FileTextLoader(fileD.
Path
, defaultEncoding: null), filePath: fileD.
Path
));
3330
.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.
Path
, Encoding.UTF8));
3379
.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.
Path
, Encoding.UTF8));
3446
.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.
Path
, Encoding.UTF8));
4556
var loader = new TestSmallFileTextLoader(file.
Path
, Encoding.UTF8);
4558
var textLength = FileUtilities.GetFileLength(file.
Path
);
4560
var expected = string.Format(WorkspacesResources.File_0_size_of_1_exceeds_maximum_allowed_size_of_2, file.
Path
, textLength, 1);
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (27)
PersistentStorage\AbstractPersistentStorageTests.cs (3)
978
var info = SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create(), solutionFile.
Path
);
987
filePath: nullPaths ? null : projectFile.
Path
));
992
filePath: nullPaths ? null : documentFile.
Path
));
ProjectSystemShim\CPS\AnalyzersTests.cs (5)
39
project.SetOptions([$"/ruleset:{ruleSetFile.
Path
}"]);
64
project.SetOptions([$"/ruleset:{ruleSetFile.
Path
}"]);
67
project.SetOptions([$"/ruleset:{ruleSetFile.
Path
}"]);
81
project.SetOptions([$"/ruleset:{ruleSetFile.
Path
}"]);
85
Assert.Equal(ruleSetFile.
Path
, environment.Workspace.TryGetRuleSetPathForProject(projectId));
ProjectSystemShim\CPS\CSharpCompilerOptionsTests.cs (1)
162
var newFilePath = Temp.CreateFile().
Path
;
ProjectSystemShim\CPS\CSharpReferencesTests.cs (1)
135
var analyzerAssemblyFullPath = tempRoot.CreateFile().
Path
;
ProjectSystemShim\LegacyProject\AnalyzersTests.cs (14)
44
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
59
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
62
Assert.Equal(ruleSetFile.
Path
, environment.Workspace.TryGetRuleSetPathForProject(projectId));
79
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
111
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
135
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
150
var pathWithExtraBackslashes = ruleSetFile.
Path
.Replace(@"\", @"\\");
156
Assert.Equal(expected: ruleSetFile.
Path
, actual: projectRuleSetFile);
179
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
215
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
244
/ruleset:"{ruleSetFile.
Path
}"
251
((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.
Path
);
260
File.WriteAllText(ruleSetFile.
Path
, ruleSetSource.Replace("Error", "Warning"));
261
await environment.RaiseFileChangeAsync(ruleSetFile.
Path
);
ProjectSystemShim\VisualStudioCompilationOutputFilesTests.cs (3)
38
var debugDirPdbPath = exactPdbPath ? pdbFile.
Path
: "a/y/z/lib.pdb";
48
var outputs = new CompilationOutputFilesWithImplicitPdbPath(dllFile.
Path
);
93
var outputs = new CompilationOutputFilesWithImplicitPdbPath(dllFile.
Path
);
Roslyn.VisualStudio.Next.UnitTests (11)
Remote\SnapshotSerializationTests.cs (9)
427
var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.
Path
)));
448
var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.
Path
)));
485
var analyzer1 = new AnalyzerFileReference(file1.
Path
, TestAnalyzerAssemblyLoader.LoadNotImplemented);
486
var analyzer2 = new AnalyzerFileReference(file2.
Path
, TestAnalyzerAssemblyLoader.LoadNotImplemented);
494
AssertEx.Equal([file1.
Path
, file2.
Path
], recovered.GetProject(project.Id).AnalyzerReferences.Select(r => r.FullPath));
567
var tempCorlibXml = tempDir.CreateFile(Path.ChangeExtension(tempCorlib.
Path
, "xml"));
585
.AddMetadataReference(MetadataReference.CreateFromFile(tempCorlib.
Path
))
703
return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.
Path
)));
Services\ServiceHubServicesTests.cs (2)
375
p1, VersionStamp.Create(), "p1", "p1", LanguageNames.CSharp, outputFilePath: file.
Path
,
379
metadataReferences: [MetadataReference.CreateFromFile(file.
Path
)])
VBCSCompiler.UnitTests (28)
AnalyzerConsistencyCheckerTests.cs (11)
72
var emitResult = comp.Emit(file.
Path
);
120
new CommandLineAnalyzerReference(mvidAlpha1.
Path
),
121
new CommandLineAnalyzerReference(mvidAlpha2.
Path
));
145
ImmutableArray.Create(new CommandLineAnalyzerReference(mvidAlpha1.
Path
)),
150
File.Delete(mvidAlpha1.
Path
);
152
Assert.Equal(mvidAlpha1.
Path
, mvidAlpha2.
Path
);
155
ImmutableArray.Create(new CommandLineAnalyzerReference(mvidAlpha2.
Path
)),
165
Assert.Contains(mvidAlpha1.
Path
, errorMessage);
166
Assert.Contains(mvidAlpha2.
Path
, errorMessage);
240
var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(compFile.
Path
));
CompilerServerTests.cs (15)
223
var srcFile = tempDir.CreateFile("test.cs").WriteAllText(source).
Path
;
264
var result = ProcessUtilities.Run(file.
Path
, "", Path.GetDirectoryName(file.
Path
));
341
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
363
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("♕").
Path
;
387
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("♕").
Path
;
1148
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1170
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText(@"♕").
Path
;
1197
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1219
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText(@"♕").
Path
;
1304
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1328
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1394
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("").
Path
;
1428
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("").
Path
;
1464
var serverExe = dir.CopyFile(compilerServerExecutable).
Path
;
TouchedFileLoggingTests.cs (2)
58
var source1 = Temp.CreateFile().WriteAllText(HelloWorldCS).
Path
;
109
var source1 = Temp.CreateFile().WriteAllText(HelloWorldVB).
Path
;