975 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 (36)
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
));
RuntimeHostInfoTests.cs (1)
84
File.CreateSymbolicLink(path: symlinkPath, pathToTarget: globalDotNetExe.
Path
);
SdkIntegrationTests.cs (3)
120
var binlogPath = RunBuild(projectFile.
Path
);
149
var binlogPath = RunBuild(projectFile.
Path
);
188
var binlogPath = RunBuild(projectFile.
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
);
5899
public class Mod { }").
Path
;
5904
public class Mod { }").
Path
;
5909
class Test { static void Main() {} }").
Path
;
5946
string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"public static class Extensions { public static bool EB(this bool b) { return b; } }").
Path
;
5947
string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").
Path
;
5966
string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Mod { }").
Path
;
5967
string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").
Path
;
6146
var srcFile = Temp.CreateFile().WriteAllText("\u265A").
Path
;
6150
var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.
Path
, expectedRetCode: 1);
6155
CleanupAllGeneratedFiles(tempOut.
Path
);
6161
var srcFile = Temp.CreateFile().WriteAllText("\u265A").
Path
;
6165
var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /utf8output /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.
Path
, expectedRetCode: 1);
6170
CleanupAllGeneratedFiles(tempOut.
Path
);
6190
CleanupAllGeneratedFiles(aCs.
Path
);
6204
CleanupAllGeneratedFiles(aCs.
Path
);
6218
CleanupAllGeneratedFiles(aCs.
Path
);
6318
var kfile = "/keyfile:" + snkFile.
Path
;
6323
parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698a.
Path
, "CS1698b.cs" }, WorkingDirectory);
6326
parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698b.
Path
, "/out:" + cs1698a.
Path
, "CS1698.cs" }, WorkingDirectory);
6336
CleanupAllGeneratedFiles(snkFile.
Path
);
6337
CleanupAllGeneratedFiles(cs1698a.
Path
);
6338
CleanupAllGeneratedFiles(cs1698b.
Path
);
6339
CleanupAllGeneratedFiles(cs1698.
Path
);
6345
var binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).
Path
;
6430
").
Path
;
6435
").
Path
;
6454
").
Path
;
6463
").
Path
;
6468
").
Path
;
6476
").
Path
;
6482
").
Path
;
6529
").
Path
;
6534
").
Path
;
6570
").
Path
;
6576
").
Path
;
6611
").
Path
;
6617
").
Path
;
6961
CleanupAllGeneratedFiles(file.
Path
);
6985
CleanupAllGeneratedFiles(file.
Path
);
7008
CleanupAllGeneratedFiles(file.
Path
);
7036
CleanupAllGeneratedFiles(file.
Path
);
7096
CleanupAllGeneratedFiles(file1.
Path
);
7097
CleanupAllGeneratedFiles(file2.
Path
);
7119
CleanupAllGeneratedFiles(file.
Path
);
7219
CleanupAllGeneratedFiles(file.
Path
);
7247
CleanupAllGeneratedFiles(file.
Path
);
7275
CleanupAllGeneratedFiles(file.
Path
);
7301
CleanupAllGeneratedFiles(file.
Path
);
7327
CleanupAllGeneratedFiles(file.
Path
);
7492
CleanupAllGeneratedFiles(file.
Path
);
7531
CleanupAllGeneratedFiles(file.
Path
);
7800
Path.GetFileName(sourceFile.
Path
),
7810
string.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.
Path
)),
7811
Path.GetFileName(sourceFile.
Path
),
7853
}").
Path
;
7857
").
Path
;
7900
}").
Path
;
7904
").
Path
;
7934
}").
Path
;
7938
").
Path
;
7968
}").
Path
;
7972
").
Path
;
8008
outWriter.ToString().Replace(Path.GetFileName(src.
Path
), "{FILE}").Trim());
8017
CleanupAllGeneratedFiles(src.
Path
);
8023
return Temp.CreateFile().WriteAllBytes(cscRsp).
Path
;
8163
string OriginalSource = src.
Path
;
8173
CleanupAllGeneratedFiles(src.
Path
);
8233
CleanupAllGeneratedFiles(src.
Path
);
8276
CleanupAllGeneratedFiles(src.
Path
);
8277
CleanupAllGeneratedFiles(xml.
Path
);
8347
CleanupAllGeneratedFiles(src.
Path
);
8348
CleanupAllGeneratedFiles(xml.
Path
);
8387
}").
Path
;
8524
}").
Path
;
8563
").
Path
;
8587
").
Path
;
8621
").
Path
;
8640
string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").
Path
;
8641
string badres = Temp.CreateFile().WriteAllBytes(TestResources.DiagnosticTests.badresfile).
Path
;
8665
string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").
Path
;
8666
string badres = Temp.CreateFile().WriteAllBytes(new byte[] { 0, 0 }).
Path
;
8694
}").
Path
;
8714
} ").
Path
;
8758
using (var stream = File.OpenWrite(exe.
Path
))
8765
using (var stream = File.OpenWrite(pdb.
Path
))
8771
int exitCode1 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source1.
Path
}).Run(outWriter);
8774
ValidateZeroes(exe.
Path
, oldSize);
8775
ValidateZeroes(pdb.
Path
, oldSize);
8777
int exitCode2 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source2.
Path
}).Run(outWriter);
8780
using (var peFile = File.OpenRead(exe.
Path
))
8782
PdbValidation.ValidateDebugDirectory(peFile, null, pdb.
Path
, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false);
8785
Assert.True(new FileInfo(exe.
Path
).Length < oldSize);
8786
Assert.True(new FileInfo(pdb.
Path
).Length < oldSize);
8788
int exitCode3 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source3.
Path
}).Run(outWriter);
8791
using (var peFile = File.OpenRead(exe.
Path
))
8793
PdbValidation.ValidateDebugDirectory(peFile, null, pdb.
Path
, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false);
8829
var fsDll = new FileStream(libDll.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8830
var fsPdb = new FileStream(libPdb.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8833
int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/debug:full", libSrc.
Path
}).Run(outWriter);
8841
AssertEx.Equal(new byte[] { 0x4D, 0x5A }, ReadBytes(libDll.
Path
, 2));
8844
AssertEx.Equal(new byte[] { 0x4D, 0x69 }, ReadBytes(libPdb.
Path
, 2));
8869
var fsDll = new FileStream(libDll.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8870
var fsPdb = new FileStream(libPdb.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8879
var output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $"/target:library /debug:portable \"{libSrc.
Path
}\"", startFolder: dir.ToString());
8895
using (var fsNewDll = File.OpenRead(libDll.
Path
))
8901
AssertEx.Equal(new[] { (byte)'B', (byte)'S', (byte)'J', (byte)'B' }, ReadBytes(libPdb.
Path
, 4));
8910
File.Delete(libSrc.
Path
);
8911
File.Delete(libDll.
Path
);
8912
File.Delete(libPdb.
Path
);
8935
File.SetAttributes(libDll.
Path
, FileAttributes.ReadOnly);
8937
var fsDll = new FileStream(libDll.
Path
, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8940
int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.
Path
}).Run(outWriter);
8941
Assert.Contains($"error CS2012: Cannot open '{libDll.
Path
}' for writing", outWriter.ToString());
8943
AssertEx.Equal(new[] { (byte)'D', (byte)'L', (byte)'L' }, ReadBytes(libDll.
Path
, 3));
8959
int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.
Path
}).Run(outWriter);
9163
} ").
Path
;
9207
string sourcePath = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(source).
Path
;
9232
var sourcePath = Temp.CreateFile(directory: WorkingDirectory, extension: ".cs").WriteAllText(source).
Path
;
9305
commandLineArgs = new[] { @"tmpDir\a.cs", tempFile.
Path
};
9316
commandLineArgs = new[] { tempFile.
Path
, @"tmpDir\*.cs" };
9331
commandLineArgs = new[] { "/preferreduilang:en", tempFile.
Path
, "tmpDir\a.cs" };
9336
commandLineArgs = new[] { tempFile.
Path
, @"tmpDi\r*a?.cs" };
9345
commandLineArgs = new[] { tempFile.
Path
, currentDrive + @":a.cs" };
9351
commandLineArgs = new[] { "/preferreduilang:en", tempFile.
Path
, @":a.cs" };
9356
CleanupAllGeneratedFiles(tempFile.
Path
);
9429
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9435
new[] { "/reportanalyzer", "/t:library", srcFile.
Path
},
9446
CleanupAllGeneratedFiles(srcFile.
Path
);
9487
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9489
var args = new List<string>() { "/reportanalyzer", "/t:library", "/a:" + typeof(DoNothingGenerator).Assembly.Location, srcFile.
Path
};
9511
CleanupAllGeneratedFiles(srcFile.
Path
);
9520
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9529
new[] { "/reportanalyzer", "/t:library", srcFile.
Path
},
9545
CleanupAllGeneratedFiles(srcFile.
Path
);
9560
workingDirectory: Path.GetDirectoryName(srcFile.
Path
),
9561
args: new[] { "/errorlog:" + errorLog.
Path
, "/warnaserror+", "/nologo", "/t:library", srcFile.
Path
},
9571
CleanupAllGeneratedFiles(srcFile.
Path
);
9572
CleanupAllGeneratedFiles(errorLog.
Path
);
9580
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9583
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.
Path
},
9597
CleanupAllGeneratedFiles(srcFile.
Path
);
9605
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9608
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", $"/warnaserror:{AnalyzerExecutor.AnalyzerExceptionDiagnosticId}", srcFile.
Path
},
9619
CleanupAllGeneratedFiles(srcFile.
Path
);
9627
var srcDirectory = Path.GetDirectoryName(srcFile.
Path
);
9630
var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.
Path
},
9641
CleanupAllGeneratedFiles(srcFile.
Path
);
9734
").
Path
;
9785
DefaultParse(new[] { "/lib:" + invalidPath, sourceFile.
Path
}, WorkingDirectory).Errors.Verify(
9788
DefaultParse(new[] { "/lib:" + nonExistentPath, sourceFile.
Path
}, WorkingDirectory).Errors.Verify(
9793
DefaultParse(new[] { sourceFile.
Path
}, WorkingDirectory, additionalReferenceDirectories: invalidPath).Errors.Verify(
9796
DefaultParse(new[] { sourceFile.
Path
}, WorkingDirectory, additionalReferenceDirectories: nonExistentPath).Errors.Verify(
9800
CleanupAllGeneratedFiles(sourceFile.
Path
);
9826
string filePath = Temp.CreateFile().WriteAllText(@"class C {}").
Path
;
9999
string filePath = Temp.CreateFile().WriteAllText(source).
Path
;
10049
string filePath = Temp.CreateFile().WriteAllText(source).
Path
;
10120
CleanupAllGeneratedFiles(src.
Path
);
10179
CleanupAllGeneratedFiles(src.
Path
);
10245
CleanupAllGeneratedFiles(src.
Path
);
10352
CleanupAllGeneratedFiles(src.
Path
);
10355
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);
10449
CleanupAllGeneratedFiles(src.
Path
);
10452
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);
10486
CleanupAllGeneratedFiles(src.
Path
);
10526
CleanupAllGeneratedFiles(src.
Path
);
10557
sourceFile.
Path
10654
CleanupAllGeneratedFiles(file.
Path
);
10766
CleanupAllGeneratedFiles(file.
Path
);
10909
CleanupAllGeneratedFiles(file.
Path
);
11107
CleanupAllGeneratedFiles(file.
Path
);
11191
CleanupAllGeneratedFiles(file.
Path
);
11295
CleanupAllGeneratedFiles(file.
Path
);
11394
CleanupAllGeneratedFiles(src.
Path
);
11743
var output = ProcessUtilities.RunAndGetOutput(csc32exe.
Path
, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir32.Path}""=X:\ ""{sourceFile.
Path
}""", expectedRetCode: 0, startFolder: dir32.Path);
11746
output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir64.Path}""=X:\ ""{sourceFile.
Path
}""", expectedRetCode: 0, startFolder: dir64.Path);
12017
var cscPath = dir.CopyFile(s_CSharpCompilerExecutable).
Path
;
12494
string filePath = Temp.CreateFile().WriteAllText("").
Path
;
12514
string filePath = Temp.CreateFile().WriteAllText("").
Path
;
12577
CleanupAllGeneratedFiles(srcFile.
Path
);
12639
CleanupAllGeneratedFiles(srcFile.
Path
);
12695
CleanupAllGeneratedFiles(srcFile.
Path
);
12782
CleanupAllGeneratedFiles(sourceFile.
Path
);
12883
CleanupAllGeneratedFiles(sourceFile.
Path
);
12993
CleanupAllGeneratedFiles(sourceFile.
Path
);
13016
CleanupAllGeneratedFiles(srcFile.
Path
);
13042
CleanupAllGeneratedFiles(srcFile.
Path
);
13109
CleanupAllGeneratedFiles(srcFile.
Path
);
13137
CleanupAllGeneratedFiles(srcFile.
Path
);
13397
"/analyzerconfig:" + analyzerConfig.
Path
,
13398
src.
Path
};
13417
arguments = arguments.Append($"/ruleset:{rulesetFile.
Path
}");
13423
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
13515
additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.
Path
).ToArray();
13565
additionalArgs = additionalArgs.Append("/ruleset:" + rulesetFile.
Path
).ToArray();
13653
"/analyzerconfig:" + analyzerConfig.
Path
,
13654
src.
Path
};
13668
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
13713
output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13722
output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13730
output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13752
var args = new[] { "/nologo", "/t:library", "/preferreduilang:en", src.
Path
};
13791
var args = new[] { "/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.
Path
};
13882
additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.
Path
}").ToArray();
13930
CleanupAllGeneratedFiles(src.
Path
);
13985
CleanupAllGeneratedFiles(src.
Path
);
14016
CleanupAllGeneratedFiles(src.
Path
);
14053
<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"" />
14099
CleanupAllGeneratedFiles(src.
Path
);
14129
CleanupAllGeneratedFiles(src.
Path
);
14163
CleanupAllGeneratedFiles(src.
Path
);
14201
CleanupAllGeneratedFiles(src.
Path
);
14232
options: TestOptions.DebugDll.WithCryptoKeyFile(Path.GetFileName(snk.
Path
)).WithStrongNameProvider(virtualSnProvider),
14271
CleanupAllGeneratedFiles(src.
Path
);
14292
CleanupAllGeneratedFiles(src.
Path
);
14315
CleanupAllGeneratedFiles(src.
Path
);
14384
CleanupAllGeneratedFiles(src.
Path
);
14412
CleanupAllGeneratedFiles(src.
Path
);
14480
CleanupAllGeneratedFiles(src.
Path
);
14549
CleanupAllGeneratedFiles(src.
Path
);
14630
CleanupAllGeneratedFiles(src.
Path
);
14649
VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.
Path
}, generators: new[] { generator }, analyzers: null);
14712
"/analyzerconfig:" + analyzerConfig1.
Path
,
14713
"/analyzerconfig:" + analyzerConfig2.
Path
,
14714
"/analyzerconfig:" + analyzerConfig3.
Path
,
14716
src.
Path
14780
new[] { "/t:library", "/nologo", "/warnaserror+", src.
Path
},
14800
new[] { "/t:library", "/nologo", "/nowarn:CS8785", src.
Path
},
14825
new[] { "/t:library", "/nologo", "/warnaserror+", src.
Path
},
14845
new[] { "/t:library", "/nologo", "/nowarn:CS8784", src.
Path
},
14880
VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/additionalfile:" + additionalFile.
Path
, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null);
14883
CleanupAllGeneratedFiles(src.
Path
);
14925
new[] { "/nologo", "/t:library", srcFile.
Path
},
14931
CleanupAllGeneratedFiles(srcFile.
Path
);
14954
"/analyzerconfig:" + analyzerConfig1.
Path
,
14955
"/analyzerconfig:" + analyzerConfig2.
Path
,
14956
src.
Path
14984
var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.
Path
+ "," + analyzerConfig2.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15003
output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.
Path
+ "," + analyzerConfig2.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15034
"/analyzerconfig:" + analyzerConfig.
Path
,
15035
"/analyzerconfig:" + globalConfig.
Path
,
15038
"/additionalfile:" + additionalFile.
Path
,
15039
src.
Path
});
15119
additionalFlags: configs.SelectAsArray(c => "/analyzerconfig:" + c.
Path
)
15141
VerifyOutput(dir, src, additionalFlags: new[] { "/warnaserror+", "/analyzerconfig:" + globalConfig.
Path
}, includeCurrentAssemblyAsAnalyzerReference: false);
15164
additionalFlags = additionalFlags.Append("/analyzerconfig:" + globalConfig.
Path
).ToArray();
15198
[{PathUtilities.NormalizeWithForwardSlash(src.
Path
)}]
15202
VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:0164", "/analyzerconfig:" + globalConfig.
Path
}, expectedErrorCount: 0, includeCurrentAssemblyAsAnalyzerReference: false);
15219
VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + globalConfig.
Path
}, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() });
15221
VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:Warning01", "/analyzerconfig:" + globalConfig.
Path
}, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() });
15241
additionalFlags: new[] { "/additionalfile:" + additionalFile.
Path
},
15322
additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.
Path
).ToArray();
15443
string path1 = additionalFile1.
Path
;
15444
string path2 = additionalFile2?.
Path
?? Path.Combine(srcDirectory.Path, additionalFilePath2);
15495
var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15499
VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
, "/nowarn:CS8034" }, expectedWarningCount: 0, includeCurrentAssemblyAsAnalyzerReference: false);
15502
output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
, "/warnAsError:CS8034" }, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15519
var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
}, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
15523
VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.
Path
, "/analyzerConfig:" + globalconfig.
Path
}, includeCurrentAssemblyAsAnalyzerReference: false);
15560
src.
Path
});
15571
"/analyzerconfig:" + analyzerConfig.
Path
,
15572
src.
Path
});
15574
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
15612
src.
Path
});
15624
src.
Path
});
15694
src.
Path
});
15705
"/analyzerconfig:" + analyzerConfig.
Path
,
15706
src.
Path
});
15708
Assert.Equal(analyzerConfig.
Path
, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
15747
src.
Path
});
15759
src.
Path
});
15825
"/analyzerconfig:" + analyzerConfig.
Path
,
15826
src.
Path
});
15864
"/analyzerconfig:" + analyzerConfig.
Path
,
15865
src.
Path
});
15904
"/analyzerconfig:" + analyzerConfig.
Path
,
15905
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)
51111
string xmlFilePath = xmlFile.
Path
;
51165
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)
262
""{script.
Path
}""
269
args: [$@"@""{rsp.
Path
}""", "/arg5", "--", "/arg7"],
293
args: [script.
Path
, "arg1", "arg2", "arg3"]);
310
args: [script.
Path
, "@arg1", "@arg2", "@arg3"]);
328
{script.
Path
}
336
args: [$"@{rsp.
Path
}", "/arg5", "--", "/arg7"],
359
args: ["--", script.
Path
, "@arg1", "@arg2", "@arg3"]);
445
script.
Path
536
var runner = CreateRunner([$"/loadpath:{dir1.Path}", $"/loadpaths:{dir2.Path};{dir3.Path}", main.
Path
]);
573
var runner = CreateRunner(["/r:4.dll", $"/lib:{dir1.Path}", $"/libpath:{dir2.Path}", $"/libpaths:{dir3.Path};{dir4.Path}", main.
Path
]);
673
var csi = CreateRunner(["b.csx"], responseFile: rsp.
Path
);
702
var runner = CreateRunner(["/i", init.
Path
], input:
722
var runner = CreateRunner([$@"/r:""{reference.
Path
}""", "/i", init.
Path
], input:
729
{init.
Path
}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}
737
$@"{init.
Path
}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}",
829
$@"#r ""{file1.
Path
}""
831
#r ""{file2.
Path
}""
838
> #r ""{file1.
Path
}""
840
> #r ""{file2.
Path
}""
843
{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)
22075
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)
1599
var result = ProcessUtilities.RunAndGetOutput(asmB.
Path
);
1607
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)
2057
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.ExternalAccess.HotReload.UnitTests (14)
HotReloadServiceTests.cs (14)
51
AddTestDocument(source: null, sourceFileA.
Path
, out var documentIdA).Project.Solution;
98
[$"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)}"],
116
[$"{sourceFileA.
Path
}: (0,72)-(0,73): Error CS1002: {CSharpResources.ERR_SemicolonExpected}"],
131
$"{sourceFileA.
Path
}: (0,21)-(0,28): Error CS0103: {string.Format(CSharpResources.ERR_NameNotInContext, "Unknown")}",
132
$"{sourceFileA.
Path
}: (0,51)-(0,52): Warning CS0219: {string.Format(CSharpResources.WRN_UnreferencedVarAssg, "x")}",
228
.AddAdditionalTestDocument(source: null, additionalFileA.
Path
, out var documentIdA)
266
var syntaxTree = context.Compilation.SyntaxTrees.Single(t => t.FilePath == sourceFile.
Path
);
274
.AddTestDocument(source: null, sourceFile.
Path
).Project
275
.AddAnalyzerConfigTestDocument([("content", source1)], configFile.
Path
, out var configId).Project.Solution
309
AddTestDocument(source: null, sourceFileA.
Path
, out var documentIdA).Project.Solution;
311
EmitLibrary(projectId, source1, sourceFileA.
Path
, assemblyName: "Proj");
331
$"P: {sourceFileA.
Path
}: (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, sourceFileA.
Path
)}",
358
.AddAdditionalTestDocument(source: null, additionalFileA.
Path
, out var documentIdA)
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 (91)
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
));
142
solution = solution.WithDocumentTextLoader(documentIdB, new WorkspaceFileTextLoader(solution.Services, sourceFileB.
Path
, encodingB), PreservationMode.PreserveValue);
196
solution = solution.WithProjectOutputFilePath(document.Project.Id, moduleFile.
Path
);
197
_mockCompilationOutputs.Add(document.Project.Id, new CompilationOutputFiles(moduleFile.
Path
));
272
AddTestDocument(source1, sourceFile.
Path
, out var documentId).Project.Solution;
296
$"test: {sourceFile.
Path
}: (2,0)-(2,22): Error ENC2012: {string.Format(FeaturesResources.EditAndContinueDisallowedByProject, ["test", "*optimized*"])}"
358
AddTestDocument(source, sourceFile1.
Path
, out var documentId).Project.Solution;
451
AddTestDocument(source, sourceFile1.
Path
, out var documentId).Project.Solution;
530
AddTestDocument(source, sourceFile1.
Path
, out var documentId).Project.Solution;
598
AddTestDocument(source, sourceFile.
Path
).Project.Solution;
659
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
705
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
753
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
788
AddTestDocument(source, sourceFile.
Path
, out var documentId).Project.Solution;
826
solution = solution.WithProjectOutputFilePath(projectId, moduleFile.
Path
).AddDocument(documentInfo);
828
_mockCompilationOutputs.Add(projectId, new CompilationOutputFiles(moduleFile.
Path
));
904
var sourceFilePath = dir.CreateFile(sourceFileName).WriteAllText(source, Encoding.UTF8).
Path
;
1000
using var stream = File.OpenRead(moduleFile.
Path
);
1015
_mockCompilationOutputs.Add(projectId, new CompilationOutputFiles(moduleFile.
Path
));
1036
[$"proj: <no location>: Error ENC1001: {string.Format(FeaturesResources.ErrorReadingFile, moduleFile.
Path
, expectedErrorMessage)}"],
1088
AddDocument("a.cs", CreateText(source1), filePath: sourceFile.
Path
);
1093
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
1119
[$"proj: {document2.FilePath}: (0,0)-(0,0): Error ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.
Path
)}"],
1143
AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.
Path
);
1148
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
, checksumAlgorithm: SourceHashAlgorithms.Default);
1157
using var fileLock = File.Open(sourceFile.
Path
, FileMode.Open, FileAccess.Read, FileShare.None);
1168
[$"test: {document1.FilePath}: (0,0)-(0,0): Error ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.
Path
)}"],
1204
AddDocument("test.cs", CreateText(sourceA), filePath: sourceFileA.
Path
);
1210
EmitAndLoadLibraryToDebuggee(project.Id, sourceA, sourceFilePath: sourceFileA.
Path
);
1220
var documentB = project.AddTestDocument(sourceB, path: sourceFileB.
Path
);
1269
AddTestDocument(sourceA, sourceFileA.
Path
).Project.
1270
AddTestDocument(sourceB, sourceFileA.
Path
, out var documentBId).Project.Solution;
1300
AddTestDocument(source1, sourceFile1.
Path
, out var documentBId).Project.Solution;
1311
solution = solution.AddTestDocument(projectId, source2, sourceFile2.
Path
, out var document2Id).Project.Solution;
1361
var moduleId = EmitLibrary(project.Id, source1, sourceFilePath: sourceFile.
Path
);
1368
var document0 = project.AddTestDocument(source0, path: sourceFile.
Path
);
1517
AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.
Path
);
1520
var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source1, sourceFilePath: sourceFile.
Path
, encoding: encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256);
1745
var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.
Path
);
1751
var document1 = project.AddTestDocument(source1, path: sourceFile.
Path
);
1788
moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.
Path
);
1834
AddDocument("test.cs", CreateText(source1), filePath: sourceFile.
Path
);
1839
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
1878
AddDocument("test.cs", CreateText(source1), filePath: sourceFile.
Path
);
1883
var moduleId = EmitLibrary(project.Id, source1, sourceFilePath: sourceFile.
Path
);
2526
.AddTestDocument(sourceA1, path: sourceFileA.
Path
, out var documentAId).Project.Solution;
2535
.AddTestDocument(sourceB1, path: sourceFileB.
Path
, out var documentBId).Project.Solution
2567
.AddTestDocument(sourceA1, path: sourceFileA.
Path
, out var documentAId).Project.Solution
2569
.AddTestDocument(sourceB1, path: sourceFileB.
Path
, out var documentBId).Project.Solution;
2612
.AddTestDocument(sourceA1, path: sourceFileA.
Path
, out var documentAId).Project.Solution;
2616
var mvidA = EmitAndLoadLibraryToDebuggee(projectAId, sourceA1, sourceFilePath: sourceFileA.
Path
, assemblyName: "A");
2617
var mvidB = EmitAndLoadLibraryToDebuggee(projectBId, sourceB1, sourceFilePath: sourceFileB.
Path
, assemblyName: "B");
2628
sourceFileA.
Path
,
2633
sourceFileB.
Path
,
2643
AddTestDocument("class B { virtual int F() => 1; }", path: sourceFileB.
Path
, out var documentBId).Project.Solution;
2986
AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.
Path
);
2995
Assert.Equal(sourceFile.
Path
, filePath);
3003
var moduleId = EmitAndLoadLibraryToDebuggee(documentId.ProjectId, source1, sourceFilePath: sourceFile.
Path
);
3032
solution = solution.WithDocumentText(documentId, CreateTextFromFile(sourceFile.
Path
));
3071
AddDocument("test.cs", CreateText(source2), filePath: sourceFile.
Path
);
3078
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
3116
$"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
)}"
3147
var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.
Path
);
3170
var document1 = project.AddDocument("test.cs", sourceText1, filePath: sourceFile.
Path
);
3205
AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.
Path
);
3210
var moduleId = EmitLibrary(project.Id, sourceOnDisk, sourceFilePath: sourceFile.
Path
);
3387
_mockCompilationOutputs.Add(document1.Project.Id, new CompilationOutputFiles(moduleFile.
Path
, pdbFile.
Path
));
4182
_mockCompilationOutputs.Add(projectA.Id, new CompilationOutputFiles(moduleFileA.
Path
, pdbFileA.
Path
));
4183
_mockCompilationOutputs.Add(projectB.Id, new CompilationOutputFiles(moduleFileB.
Path
, pdbFileB.
Path
));
4316
var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).
Path
;
4416
var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).
Path
;
5519
var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.
Path
, assemblyName: "Proj");
5525
loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.
Path
, Encoding.UTF8),
5526
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
));
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)
190
var srcFile = tempDir.CreateFile("test.cs").WriteAllText(source).
Path
;
231
var result = ProcessUtilities.Run(file.
Path
, "", Path.GetDirectoryName(file.
Path
));
308
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
330
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("♕").
Path
;
354
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("♕").
Path
;
1115
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1137
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText(@"♕").
Path
;
1164
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1186
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText(@"♕").
Path
;
1271
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1295
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").
Path
;
1361
var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("").
Path
;
1395
var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("").
Path
;
1431
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
;