1272 references to Path
InteractiveHost.UnitTests (37)
AbstractInteractiveHostTests.cs (1)
209return (file.Path, image);
InteractiveHostCoreInitTests.cs (2)
58var dllDir = Path.GetDirectoryName(dll.Path)!; 86await Host.AddReferenceAsync(Path.GetFileName(dll.Path));
InteractiveHostDesktopInitTests.cs (2)
31var dllDir = Path.GetDirectoryName(dll.Path)!; 59await Host.AddReferenceAsync(Path.GetFileName(dll.Path));
InteractiveHostDesktopTests.cs (32)
183var file = Temp.CreateFile().WriteAllText(MethodWithInfiniteLoop + "\r\nfoo();").Path; 202var file = Temp.CreateFile().WriteAllText("1 1").Path; 237").Path; 273await Host.ExecuteFileAsync(file.Path); 276Assert.True(errorOut.StartsWith(file.Path + "(1,7):", StringComparison.Ordinal), "Error output should start with file name, line and column"); 464Assert.True(await LoadReference(file1.Path)); 465Assert.True(await LoadReference(file2.Path)); 509#r ""{file.Path}"" 521#r ""{file.Path}"" 552#r ""{file1.Path}"" 553#r ""{file2.Path}"" 563Assert.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}"" 705rspFile.WriteAllText($"/lib:{directory1.Path} /r:Assembly2.dll {initFile.Path}"); 707await 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))} 743rspFile.WriteAllText($"{initFile.Path}"); 745await 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); 770await 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} 821await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform)); 827AssertEx.AssertEqualToleratingWhitespaceDifferences($@"{initFile.Path}(1,3): error CS1002: {CSharpResources.ERR_SemicolonExpected} 831{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))} 848await 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 + @""" 945await Execute($@"#r ""{libFile.Path}"""); 1028await 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)
47File.WriteAllText(file.Path, ""); 52SourcePath = file.Path, 65File.WriteAllText(file.Path, "test"); 71SourcePath = file.Path, 76AssertEx.AssertEqualToleratingWhitespaceDifferences($$"""Copying reference assembly from "{{file.Path}}" to "{{dest}}".""", engine.Log); 85File.WriteAllText(source.Path, "test"); 87File.WriteAllText(dest.Path, "dest"); 92SourcePath = source.Path, 93DestinationPath = dest.Path, 99Could not extract the MVID from "{{source.Path}}". Are you sure it is a reference assembly? 100Copying reference assembly from "{{source.Path}}" to "{{dest}}". 104Assert.Equal("test", File.ReadAllText(dest.Path)); 112File.WriteAllBytes(source.Path, TestResources.General.MVID1); 113var sourceTimestamp = File.GetLastWriteTimeUtc(source.Path).ToString("O"); 116File.WriteAllBytes(dest.Path, TestResources.General.MVID2); 117var destTimestamp = File.GetLastWriteTimeUtc(dest.Path).ToString("O"); 123SourcePath = source.Path, 124DestinationPath = dest.Path, 130Source 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"). 131Copying reference assembly from "{{source.Path}}" to "{{dest.Path}}".
DotNetSdkTests.cs (6)
42<Compile Include=""{libFile.Path}"" Link=""Lib.cs"" /> 433editorConfigFile2.Path 494globalConfigFile.Path, 495globalConfigFile2.Path 561globalConfigFile.Path, 562globalConfigFile2.Path
IntegrationTests.cs (2)
98return ProcessUtilities.Run(file.Path, "", Path.GetDirectoryName(file.Path));
TestUtilities\DotNetSdkTestBase.cs (2)
191Project.Path, 233Project.Path,
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (389)
CommandLineIVTTests.cs (8)
38source2.Path, 44var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}"; 115source2.Path, 121var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}"; 194source2.Path, 200var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}"; 279source2.Path, 285var outputFilePath = $"{Path.GetFileName(dir.Path)}{Path.DirectorySeparatorChar}{Path.GetFileName(source2.Path)}";
CommandLineTests.cs (355)
147var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.Path }); 167var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.Path }); 200"/analyzerconfig:" + analyzerConfig.Path, 201src.Path }); 203Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 243"/analyzerconfig:" + modifyPath(editorconfig.Path, doubleSlashAnalyzerConfig), 244modifyPath(src.Path, doubleSlashSource), 292"/analyzerconfig:" + analyzerConfig.Path, 295"/additionalfile:" + additionalFile.Path, 296src.Path }); 298Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 345"/analyzerconfig:" + analyzerConfig.Path, 346src.Path }); 348Assert.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, 383src.Path 401var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", src.Path }); 421var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/codepage:932", src.Path }); 454").Path; 876string tmpFileName = Temp.CreateFile().WriteAllBytes(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }).Path; 1248CleanupAllGeneratedFiles(file1.Path); 1249CleanupAllGeneratedFiles(file2.Path); 1250CleanupAllGeneratedFiles(file3.Path); 1251CleanupAllGeneratedFiles(file4.Path); 1252CleanupAllGeneratedFiles(file5.Path); 2262AssertEx.Equal(File.ReadAllBytes(sl.Path), blob); 2267CleanupAllGeneratedFiles(src.Path); 2291AssertEx.Equal(File.ReadAllBytes(sl.Path), blob); 2295CleanupAllGeneratedFiles(src.Path); 2320CleanupAllGeneratedFiles(src.Path); 2440expectedEmbeddedMap.Add(src.Path, embed_cs); 2445expectedEmbeddedMap.Add(src2.Path, embed2_cs); 2450expectedEmbeddedMap.Add(txt.Path, embed_xyz); 2473CleanupAllGeneratedFiles(src.Path); 2791CleanupAllGeneratedFiles(file.Path); 2813CleanupAllGeneratedFiles(file.Path); 2838var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory); 2840Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath); 2864var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + "\"" + file.Path + "\"", "a.cs" }, WorkingDirectory); 2866Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath); 2893parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory); 2896Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath); 2901Assert.Equal(file.Path, (string)err.Arguments[0]); 2933CleanupAllGeneratedFiles(file.Path); 2961var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs", "/ruleset:" + ruleSetFile.Path }); 2968CleanupAllGeneratedFiles(file.Path); 2998"/ruleset:" + ruleSetFile.Path, "/warnaserror+", "/nowarn:8032" }); 3009"/warnaserror+", "/ruleset:" + ruleSetFile.Path, "/nowarn:8032" }); 3016CleanupAllGeneratedFiles(file.Path); 3517"/ruleset:" + ruleSetFile.Path, "/warn:0" }); 3528"/warn:0", "/ruleset:" + ruleSetFile.Path }); 3535CleanupAllGeneratedFiles(file.Path); 3688CleanupAllGeneratedFiles(file.Path); 3708CleanupAllGeneratedFiles(file.Path); 4331var srcDirectory = Path.GetDirectoryName(srcFile.Path); 4342var silverlight = Temp.CreateFile().WriteAllBytes(Silverlight.System).Path; 4343var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path; 4351"/appconfig:" + appConfigFile.Path, 4352srcFile.Path }).Run(outWriter); 4356CleanupAllGeneratedFiles(srcFile.Path); 4357CleanupAllGeneratedFiles(appConfigFile.Path); 4364var srcDirectory = Path.GetDirectoryName(srcFile.Path); 4371srcFile.Path }).Run(outWriter); 4375CleanupAllGeneratedFiles(srcFile.Path); 4491var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/modulename:hocusPocus ", "/out:" + exeName + " ", file1.Path }); 4516CleanupAllGeneratedFiles(file1.Path); 4760CleanupAllGeneratedFiles(src.Path); 4779CleanupAllGeneratedFiles(src.Path); 4787var filePath = tempFolder.CreateFile("temp").Path; 4807CleanupAllGeneratedFiles(src.Path); 5895public class Mod { }").Path; 5900public class Mod { }").Path; 5905class Test { static void Main() {} }").Path; 5942string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"public static class Extensions { public static bool EB(this bool b) { return b; } }").Path; 5943string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").Path; 5962string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Mod { }").Path; 5963string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").Path; 6142var srcFile = Temp.CreateFile().WriteAllText("\u265A").Path; 6146var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.Path, expectedRetCode: 1); 6151CleanupAllGeneratedFiles(tempOut.Path); 6157var srcFile = Temp.CreateFile().WriteAllText("\u265A").Path; 6161var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /utf8output /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.Path, expectedRetCode: 1); 6166CleanupAllGeneratedFiles(tempOut.Path); 6186CleanupAllGeneratedFiles(aCs.Path); 6200CleanupAllGeneratedFiles(aCs.Path); 6214CleanupAllGeneratedFiles(aCs.Path); 6314var kfile = "/keyfile:" + snkFile.Path; 6319parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698a.Path, "CS1698b.cs" }, WorkingDirectory); 6322parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698b.Path, "/out:" + cs1698a.Path, "CS1698.cs" }, WorkingDirectory); 6332CleanupAllGeneratedFiles(snkFile.Path); 6333CleanupAllGeneratedFiles(cs1698a.Path); 6334CleanupAllGeneratedFiles(cs1698b.Path); 6335CleanupAllGeneratedFiles(cs1698.Path); 6341var 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; 6957CleanupAllGeneratedFiles(file.Path); 6981CleanupAllGeneratedFiles(file.Path); 7004CleanupAllGeneratedFiles(file.Path); 7032CleanupAllGeneratedFiles(file.Path); 7105CleanupAllGeneratedFiles(file1.Path); 7106CleanupAllGeneratedFiles(file2.Path); 7128CleanupAllGeneratedFiles(file.Path); 7228CleanupAllGeneratedFiles(file.Path); 7256CleanupAllGeneratedFiles(file.Path); 7284CleanupAllGeneratedFiles(file.Path); 7310CleanupAllGeneratedFiles(file.Path); 7336CleanupAllGeneratedFiles(file.Path); 7500CleanupAllGeneratedFiles(file.Path); 7539CleanupAllGeneratedFiles(file.Path); 7808Path.GetFileName(sourceFile.Path), 7818string.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.Path)), 7819Path.GetFileName(sourceFile.Path), 7861}").Path; 7865").Path; 7908}").Path; 7912").Path; 7942}").Path; 7946").Path; 7976}").Path; 7980").Path; 8016outWriter.ToString().Replace(Path.GetFileName(src.Path), "{FILE}").Trim()); 8025CleanupAllGeneratedFiles(src.Path); 8031return Temp.CreateFile().WriteAllBytes(cscRsp).Path; 8170string OriginalSource = src.Path; 8180CleanupAllGeneratedFiles(src.Path); 8240CleanupAllGeneratedFiles(src.Path); 8283CleanupAllGeneratedFiles(src.Path); 8284CleanupAllGeneratedFiles(xml.Path); 8354CleanupAllGeneratedFiles(src.Path); 8355CleanupAllGeneratedFiles(xml.Path); 8394}").Path; 8531}").Path; 8570").Path; 8594").Path; 8628").Path; 8647string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").Path; 8648string badres = Temp.CreateFile().WriteAllBytes(TestResources.DiagnosticTests.badresfile).Path; 8672string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").Path; 8673string badres = Temp.CreateFile().WriteAllBytes(new byte[] { 0, 0 }).Path; 8701}").Path; 8723} ").Path; 8767using (var stream = File.OpenWrite(exe.Path)) 8774using (var stream = File.OpenWrite(pdb.Path)) 8780int exitCode1 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source1.Path }).Run(outWriter); 8783ValidateZeroes(exe.Path, oldSize); 8784ValidateZeroes(pdb.Path, oldSize); 8786int exitCode2 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source2.Path }).Run(outWriter); 8789using (var peFile = File.OpenRead(exe.Path)) 8791PdbValidation.ValidateDebugDirectory(peFile, null, pdb.Path, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false); 8794Assert.True(new FileInfo(exe.Path).Length < oldSize); 8795Assert.True(new FileInfo(pdb.Path).Length < oldSize); 8797int exitCode3 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source3.Path }).Run(outWriter); 8800using (var peFile = File.OpenRead(exe.Path)) 8802PdbValidation.ValidateDebugDirectory(peFile, null, pdb.Path, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false); 8838var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8839var fsPdb = new FileStream(libPdb.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8842int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/debug:full", libSrc.Path }).Run(outWriter); 8850AssertEx.Equal(new byte[] { 0x4D, 0x5A }, ReadBytes(libDll.Path, 2)); 8853AssertEx.Equal(new byte[] { 0x4D, 0x69 }, ReadBytes(libPdb.Path, 2)); 8878var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8879var fsPdb = new FileStream(libPdb.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8888var output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $"/target:library /debug:portable \"{libSrc.Path}\"", startFolder: dir.ToString()); 8904using (var fsNewDll = File.OpenRead(libDll.Path)) 8910AssertEx.Equal(new[] { (byte)'B', (byte)'S', (byte)'J', (byte)'B' }, ReadBytes(libPdb.Path, 4)); 8919File.Delete(libSrc.Path); 8920File.Delete(libDll.Path); 8921File.Delete(libPdb.Path); 8944File.SetAttributes(libDll.Path, FileAttributes.ReadOnly); 8946var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8949int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter); 8950Assert.Contains($"error CS2012: Cannot open '{libDll.Path}' for writing", outWriter.ToString()); 8952AssertEx.Equal(new[] { (byte)'D', (byte)'L', (byte)'L' }, ReadBytes(libDll.Path, 3)); 8968int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter); 9172} ").Path; 9216string sourcePath = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(source).Path; 9241var sourcePath = Temp.CreateFile(directory: WorkingDirectory, extension: ".cs").WriteAllText(source).Path; 9314commandLineArgs = new[] { @"tmpDir\a.cs", tempFile.Path }; 9325commandLineArgs = new[] { tempFile.Path, @"tmpDir\*.cs" }; 9340commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, "tmpDir\a.cs" }; 9345commandLineArgs = new[] { tempFile.Path, @"tmpDi\r*a?.cs" }; 9354commandLineArgs = new[] { tempFile.Path, currentDrive + @":a.cs" }; 9360commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, @":a.cs" }; 9365CleanupAllGeneratedFiles(tempFile.Path); 9438var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9444new[] { "/reportanalyzer", "/t:library", srcFile.Path }, 9455CleanupAllGeneratedFiles(srcFile.Path); 9496var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9498var args = new List<string>() { "/reportanalyzer", "/t:library", "/a:" + typeof(DoNothingGenerator).Assembly.Location, srcFile.Path }; 9520CleanupAllGeneratedFiles(srcFile.Path); 9529var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9538new[] { "/reportanalyzer", "/t:library", srcFile.Path }, 9554CleanupAllGeneratedFiles(srcFile.Path); 9569workingDirectory: Path.GetDirectoryName(srcFile.Path), 9570args: new[] { "/errorlog:" + errorLog.Path, "/warnaserror+", "/nologo", "/t:library", srcFile.Path }, 9580CleanupAllGeneratedFiles(srcFile.Path); 9581CleanupAllGeneratedFiles(errorLog.Path); 9589var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9592var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path }, 9606CleanupAllGeneratedFiles(srcFile.Path); 9614var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9617var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", $"/warnaserror:{AnalyzerExecutor.AnalyzerExceptionDiagnosticId}", srcFile.Path }, 9628CleanupAllGeneratedFiles(srcFile.Path); 9636var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9639var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path }, 9650CleanupAllGeneratedFiles(srcFile.Path); 9743").Path; 9794DefaultParse(new[] { "/lib:" + invalidPath, sourceFile.Path }, WorkingDirectory).Errors.Verify( 9797DefaultParse(new[] { "/lib:" + nonExistentPath, sourceFile.Path }, WorkingDirectory).Errors.Verify( 9802DefaultParse(new[] { sourceFile.Path }, WorkingDirectory, additionalReferenceDirectories: invalidPath).Errors.Verify( 9805DefaultParse(new[] { sourceFile.Path }, WorkingDirectory, additionalReferenceDirectories: nonExistentPath).Errors.Verify( 9809CleanupAllGeneratedFiles(sourceFile.Path); 9835string filePath = Temp.CreateFile().WriteAllText(@"class C {}").Path; 10008string filePath = Temp.CreateFile().WriteAllText(source).Path; 10058string filePath = Temp.CreateFile().WriteAllText(source).Path; 10129CleanupAllGeneratedFiles(src.Path); 10188CleanupAllGeneratedFiles(src.Path); 10254CleanupAllGeneratedFiles(src.Path); 10361CleanupAllGeneratedFiles(src.Path); 10364void 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); 10458CleanupAllGeneratedFiles(src.Path); 10461void 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); 10495CleanupAllGeneratedFiles(src.Path); 10535CleanupAllGeneratedFiles(src.Path); 10566sourceFile.Path 10663CleanupAllGeneratedFiles(file.Path); 10775CleanupAllGeneratedFiles(file.Path); 10918CleanupAllGeneratedFiles(file.Path); 11116CleanupAllGeneratedFiles(file.Path); 11200CleanupAllGeneratedFiles(file.Path); 11304CleanupAllGeneratedFiles(file.Path); 11403CleanupAllGeneratedFiles(src.Path); 11751var output = ProcessUtilities.RunAndGetOutput(csc32exe.Path, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir32.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir32.Path); 11754output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir64.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir64.Path); 12025var cscPath = dir.CopyFile(s_CSharpCompilerExecutable).Path; 12501string filePath = Temp.CreateFile().WriteAllText("").Path; 12521string filePath = Temp.CreateFile().WriteAllText("").Path; 12584CleanupAllGeneratedFiles(srcFile.Path); 12646CleanupAllGeneratedFiles(srcFile.Path); 12702CleanupAllGeneratedFiles(srcFile.Path); 12789CleanupAllGeneratedFiles(sourceFile.Path); 12890CleanupAllGeneratedFiles(sourceFile.Path); 13000CleanupAllGeneratedFiles(sourceFile.Path); 13023CleanupAllGeneratedFiles(srcFile.Path); 13049CleanupAllGeneratedFiles(srcFile.Path); 13116CleanupAllGeneratedFiles(srcFile.Path); 13144CleanupAllGeneratedFiles(srcFile.Path); 13404"/analyzerconfig:" + analyzerConfig.Path, 13405src.Path }; 13424arguments = arguments.Append($"/ruleset:{rulesetFile.Path}"); 13430Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 13522additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray(); 13572additionalArgs = additionalArgs.Append("/ruleset:" + rulesetFile.Path).ToArray(); 13660"/analyzerconfig:" + analyzerConfig.Path, 13661src.Path }; 13675Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 13720output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 13729output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 13737output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 13759var args = new[] { "/nologo", "/t:library", "/preferreduilang:en", src.Path }; 13798var args = new[] { "/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.Path }; 13889additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray(); 13937CleanupAllGeneratedFiles(src.Path); 13992CleanupAllGeneratedFiles(src.Path); 14023CleanupAllGeneratedFiles(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"" /> 14106CleanupAllGeneratedFiles(src.Path); 14136CleanupAllGeneratedFiles(src.Path); 14170CleanupAllGeneratedFiles(src.Path); 14208CleanupAllGeneratedFiles(src.Path); 14239options: TestOptions.DebugDll.WithCryptoKeyFile(Path.GetFileName(snk.Path)).WithStrongNameProvider(virtualSnProvider), 14278CleanupAllGeneratedFiles(src.Path); 14299CleanupAllGeneratedFiles(src.Path); 14322CleanupAllGeneratedFiles(src.Path); 14391CleanupAllGeneratedFiles(src.Path); 14419CleanupAllGeneratedFiles(src.Path); 14487CleanupAllGeneratedFiles(src.Path); 14556CleanupAllGeneratedFiles(src.Path); 14637CleanupAllGeneratedFiles(src.Path); 14656VerifyOutput(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, 14723src.Path 14787new[] { "/t:library", "/nologo", "/warnaserror+", src.Path }, 14807new[] { "/t:library", "/nologo", "/nowarn:CS8785", src.Path }, 14832new[] { "/t:library", "/nologo", "/warnaserror+", src.Path }, 14852new[] { "/t:library", "/nologo", "/nowarn:CS8784", src.Path }, 14887VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/additionalfile:" + additionalFile.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null); 14890CleanupAllGeneratedFiles(src.Path); 14932new[] { "/nologo", "/t:library", srcFile.Path }, 14938CleanupAllGeneratedFiles(srcFile.Path); 14961"/analyzerconfig:" + analyzerConfig1.Path, 14962"/analyzerconfig:" + analyzerConfig2.Path, 14963src.Path 14991var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.Path + "," + analyzerConfig2.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15010output = 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, 15046src.Path }); 15126additionalFlags: configs.SelectAsArray(c => "/analyzerconfig:" + c.Path) 15148VerifyOutput(dir, src, additionalFlags: new[] { "/warnaserror+", "/analyzerconfig:" + globalConfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false); 15171additionalFlags = additionalFlags.Append("/analyzerconfig:" + globalConfig.Path).ToArray(); 15205[{PathUtilities.NormalizeWithForwardSlash(src.Path)}] 15209VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:0164", "/analyzerconfig:" + globalConfig.Path }, expectedErrorCount: 0, includeCurrentAssemblyAsAnalyzerReference: false); 15226VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + globalConfig.Path }, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() }); 15228VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:Warning01", "/analyzerconfig:" + globalConfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() }); 15248additionalFlags: new[] { "/additionalfile:" + additionalFile.Path }, 15329additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray(); 15450string path1 = additionalFile1.Path; 15451string path2 = additionalFile2?.Path ?? Path.Combine(srcDirectory.Path, additionalFilePath2); 15502var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15506VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path, "/nowarn:CS8034" }, expectedWarningCount: 0, includeCurrentAssemblyAsAnalyzerReference: false); 15509output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path, "/warnAsError:CS8034" }, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15526var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15530VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path, "/analyzerConfig:" + globalconfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false); 15567src.Path }); 15578"/analyzerconfig:" + analyzerConfig.Path, 15579src.Path }); 15581Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 15619src.Path }); 15631src.Path }); 15701src.Path }); 15712"/analyzerconfig:" + analyzerConfig.Path, 15713src.Path }); 15715Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 15754src.Path }); 15766src.Path }); 15832"/analyzerconfig:" + analyzerConfig.Path, 15833src.Path }); 15871"/analyzerconfig:" + analyzerConfig.Path, 15872src.Path }); 15911"/analyzerconfig:" + analyzerConfig.Path, 15912src.Path });
SarifErrorLoggerTests.cs (9)
41var hello = Temp.CreateFile().WriteAllText(helloWorldCS).Path; 72var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 106var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 138var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 175var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 210var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 245var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 280var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 313var sourceFile = Temp.CreateFile().WriteAllText(source).Path;
SarifV2ErrorLoggerTests.cs (7)
445var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 525var sourceFile1 = sourceDir.CreateFile("source1.cs").WriteAllText(source1).Path; 526var sourceFile2 = sourceDir.CreateFile("source2.cs").WriteAllText(source2).Path; 527var editorconfigFile = sourceDir.CreateFile(".editorconfig").WriteAllText(editorconfigText).Path; 597var sourceFile = Temp.CreateFile().WriteAllText(source).Path; 681string[] arguments = new[] { "/nologo", sourceFile.Path, "/preferreduilang:en", $"/errorlog:{errorLogFile}{GetErrorLogQualifier(version)}" }; 748CleanupAllGeneratedFiles(sourceFile.Path);
TouchedFileLoggingTests.cs (10)
38var hello = Temp.CreateFile().WriteAllText(helloWorldCS).Path; 66var hello = Temp.CreateFile().WriteAllText(helloWorldCS).Path; 77</configuration>").Path; 79var silverlight = Temp.CreateFile().WriteAllBytes(Silverlight.System).Path; 80var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path; 112var hello = Temp.CreateFile().WriteAllText(helloWorldCS).Path; 113var snkPath = Temp.CreateFile("TestKeyPair_", ".snk").WriteAllBytes(TestResources.General.snKey).Path; 151public class C { }").Path; 160"/doc:" + xml.Path, 172expectedWrites.Add(xml.Path);
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (6)
Emit\CompilationEmitTests.cs (1)
2000options: TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(true));
Emit\ResourceTests.cs (5)
58lib = LoadLibraryEx(exe.Path, IntPtr.Zero, 0x00000002); 119var fileVer = FileVersionInfo.GetVersionInfo(exe.Path); 148lib = LoadLibraryEx(exe.Path, IntPtr.Zero, 0x00000002); 201var fileVer = FileVersionInfo.GetVersionInfo(exe.Path); 847lib = LoadLibraryEx(exeFile.Path, IntPtr.Zero, 0x00000002);
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (12)
Attributes\EmitTestStrongNameProvider.cs (1)
32var keyFile = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey).Path;
Attributes\InternalsVisibleToAndStrongNameTests.cs (9)
383CSharpCompilation other = CreateCompilation(s, options: TestOptions.ReleaseDll.WithCryptoKeyFile(tempFile.Path), parseOptions: parseOptions); 537[assembly: System.Reflection.AssemblyKeyFile(@""" + snk.Path + @""")] 541c = 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), 1517using (var metadata = new FileStream(file.Path, FileMode.Open))
Semantics\ExtensionTests.cs (2)
50262string xmlFilePath = xmlFile.Path; 50316string xmlFilePath = xmlFile.Path;
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
EditAndContinue\StatementEditingTests.cs (1)
4006delegateDefs = 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}"" 446Diagnostic(ErrorCode.ERR_NoImplicitConv, "c2").WithArguments($"C [{c2.Path}]", $"C [{c1.Path}]")); 630var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 632var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 644Assert.Equal(fileBase1.Path, ((PortableExecutableReference)libBaseRefAndSymbol.Key).FilePath); 688var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 690var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 702Assert.Equal(fileBase1.Path, ((PortableExecutableReference)libBaseRefAndSymbol.Key).FilePath); 754var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 756var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 822var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 824var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 890var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 892var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 958var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 960var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 1026var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 1028var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 1094var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 1097var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 1120var s0 = await CSharpScript.RunAsync("C c;", ScriptOptions.WithReferences(libFile.Path));
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (43)
CommandLineRunnerTests.cs (22)
265""{script.Path}"" 272args: [$@"@""{rsp.Path}""", "/arg5", "--", "/arg7"], 296args: [script.Path, "arg1", "arg2", "arg3"]); 313args: [script.Path, "@arg1", "@arg2", "@arg3"]); 331{script.Path} 339args: [$"@{rsp.Path}", "/arg5", "--", "/arg7"], 362args: ["--", script.Path, "@arg1", "@arg2", "@arg3"]); 448script.Path 539var runner = CreateRunner([$"/loadpath:{dir1.Path}", $"/loadpaths:{dir2.Path};{dir3.Path}", main.Path]); 576var runner = CreateRunner(["/r:4.dll", $"/lib:{dir1.Path}", $"/libpath:{dir2.Path}", $"/libpaths:{dir3.Path};{dir4.Path}", main.Path]); 676var csi = CreateRunner(["b.csx"], responseFile: rsp.Path); 705var runner = CreateRunner(["/i", init.Path], input: 725var 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}"" 86var libDRef = MetadataReference.CreateFromFile(libDFile.Path); 94var r1 = swapReferences ? libBFile.Path : libAFile.Path; 95var r2 = swapReferences ? libAFile.Path : libBFile.Path; 131var libBRef = MetadataReference.CreateFromFile(libBFile.Path); 137#r ""{libAFile.Path}"" 143File.Move(libBFile.Path, Path.Combine(dir.Path, "libB.dll"));
InteractiveSessionTests.cs (12)
1213lib1.Emit(file1.Path); 1221lib2.Emit(file2.Path); 1224#r ""{file1.Path}"" 1225#r ""{file2.Path}"" 1236lib.Emit(file.Path); 1238string dir = Path.Combine(Path.GetDirectoryName(file.Path), "subdir"); 1239string libFileName = Path.GetFileName(file.Path); 1254lib.Emit(file.Path); 1256string root = Path.GetPathRoot(file.Path); 1257string unrooted = file.Path[root.Length..]; 1295var r2 = CSharpScript.Create($@"#r ""{fileMain.Path}""", ScriptOptions).ContinueWith($@"M.X.F").RunAsync().Result.ReturnValue; 1326var r2 = CSharpScript.Create($@"#r ""{fileMain.Path}""", ScriptOptions).ContinueWith($@"M.X.F").RunAsync().Result.ReturnValue;
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Semantics\SemanticErrorTests.cs (1)
22028var comp = CreateCompilationWithMscorlib40AndDocumentationComments(string.Format(sourceTemplate, xmlFile.Path));
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (76)
Compilation\GetUnusedImportDirectivesTests.cs (1)
212var snkPath = Temp.CreateFile().WriteAllBytes(TestResources.General.snKey).Path;
Compilation\ReferenceManagerTests.cs (10)
852string p1 = Temp.CreateFile().WriteAllBytes(TestResources.General.MDTestLib1).Path; 924string p1 = dir.CreateFile("netModule1.netmodule").WriteAllBytes(TestResources.SymbolsTests.netModule.netModule1).Path; 993string p1 = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemCore).Path; 994string p2 = Temp.CreateFile().CopyContentFrom(p1).Path; 1013var p1 = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path; 1014var p2 = Temp.CreateFile().WriteAllBytes(Net20.Resources.System).Path; 1043var ref1 = AssemblyMetadata.CreateFromFile(exe1.Path).GetReference(aliases: ImmutableArray.Create("A1")); 1044var ref2 = AssemblyMetadata.CreateFromFile(exe2.Path).GetReference(aliases: ImmutableArray.Create("A2")); 1270var path1 = Temp.CreateFile().WriteAllBytes(TestResources.General.MDTestLib1).Path; 1271var path2 = Temp.CreateFile().WriteAllBytes(TestResources.General.MDTestLib2).Path;
DocumentationComments\DocumentationCommentCompilerTests.cs (51)
4497string xmlFilePath = xmlFile.Path; 4532string xmlFilePath = xmlFile.Path; 4570string xmlFilePath = xmlFile.Path; 4605string xmlFilePath = xmlFile.Path; 4641string xmlFilePath = xmlFile.Path; 4795var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.Path)); 4866var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.Path)); 4892var xmlFilePath = xmlFile.Path; 4929var xmlFilePath1 = xmlFile1.Path; 4932var xmlFilePath2 = xmlFile2.Path; 4965var xmlFilePath = xmlFile.Path; 4999var xmlFilePath1 = xmlFile1.Path; 5002var xmlFilePath2 = xmlFile2.Path; 5032var xmlFilePath = xmlFile.Path; 5066var xmlFilePath1 = xmlFile1.Path; 5069var xmlFilePath2 = xmlFile2.Path; 5099var xmlFilePath = xmlFile.Path; 5131var xmlFilePath = xmlFile.Path; 5165var xmlFilePath = xmlFile.Path; 5219var xmlFilePath = xmlFile.Path; 5258var xmlFilePath1 = xmlFile1.Path; 5261var xmlFilePath2 = xmlFile2.Path; 5297var xmlFilePath = xmlFile.Path; 5374var xmlFilePath = xmlFile.Path; 5409var xmlFilePath = xmlFile.Path; 5444var xmlFilePath = xmlFile.Path; 5491var xmlFilePath = xmlFile.Path; 5532var xmlFilePath = xmlFile.Path; 5586var xmlFilePath = xmlFile.Path; 5631var xmlFilePath = xmlFile.Path; 5708var xmlFilePath = xmlFile.Path; 5788var xmlFilePath = xmlFile.Path; 5859var xmlFilePath = xmlFile.Path; 5903var xmlFilePath = xmlFile.Path; 5941var xmlFilePath = xmlFile.Path; 5982var xmlFilePath = xmlFile.Path; 6018var xmlFilePath = xmlFile.Path; 6060var xmlFilePath = xmlFile.Path; 6130var xmlFilePath = xmlFile.Path; 6299var xmlFilePath = xmlFile.Path; 7019var comp = CreateCompilationUtil(string.Format(sourceTemplate, xmlFile.Path)); 7037Assert.Equal(string.Format(expectedTemplate, TestHelpers.AsXmlCommentText(xmlFile.Path)), actual); 8268var xmlFilePath = xmlFile.Path; 8358string fullPath = xmlFile.Path; 8382/// <include file='file://" + xmlFile.Path + @"' path='hello'/> 8389@"<include file='file://" + xmlFile.Path + @"' path='hello'/>"). 8390WithArguments("file://" + xmlFile.Path, "hello", "File not found.").WithLocation(2, 5)); 8400string xmlFilePath = Path.GetFileName(xmlFile.Path); 8401string dirPath = Path.GetDirectoryName(xmlFile.Path); 8452/// <include file='" + xmlFile.Path + @"' path='hello'/> 8500var xmlFilePath = xmlFile.Path;
DocumentationComments\DocumentationModeTests.cs (1)
369var xmlFilePath = xmlFile.Path;
Symbols\CompilationCreationTests.cs (9)
2677var data = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemData).Path; 2678var core = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemCore).Path; 2679var xml = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemXml).Path; 2680var system = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path; 2722var data = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemData).Path; 2723var core = Temp.CreateFile().WriteAllBytes(Net461.Resources.SystemCore).Path; 2724var system = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path; 2774var csClasses01 = Temp.CreateFile().WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSClasses01).Path; 2775var csInterfaces01 = Temp.CreateFile().WriteAllBytes(TestResources.MetadataTests.InterfaceAndClass.CSInterfaces01).Path;
Symbols\Metadata\PE\TypeForwarders.cs (2)
1585var result = ProcessUtilities.RunAndGetOutput(asmB.Path); 1593result = ProcessUtilities.RunAndGetOutput(asmB2.Path);
Symbols\SymbolErrorTests.cs (2)
7131ilBytes = ReadFromFile(reference.Path); 7200ilBytes = ReadFromFile(reference.Path);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
CSharpTestBase.cs (1)
2031return MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
EditAndContinue\EditAndContinueLanguageServiceTests.cs (5)
372loader: new WorkspaceFileTextLoader(workspace.Services.SolutionServices, sourceFile.Path, Encoding.UTF8), 373filePath: sourceFile.Path)); 378var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source1, sourceFilePath: sourceFile.Path); 384File.WriteAllText(sourceFile.Path, "class C1 { void M() { System.Console.WriteLine(\"b\"); } }", Encoding.UTF8); 397Assert.Equal(sourceFile.Path, key);
Emit\CompilationOutputFilesTests.cs (2)
40var outputs = new CompilationOutputFiles(dllFile.Path, pdbFile.Path);
Utilities\SymbolEquivalenceComparerTests.cs (1)
1937var 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 (91)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (88)
66var sourceTreeA1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesA1, sourceBytesA1.Length, encodingA, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileA.Path); 67var sourceTreeB1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesB1, sourceBytesB1.Length, encodingB, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileB.Path); 68var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.Path); 90loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, encodingA), 91filePath: sourceFileA.Path)); 97loader: new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB), 98filePath: sourceFileB.Path)); 104loader: new WorkspaceFileTextLoader(solution.Services, sourceFileC.Path, encodingC), 105filePath: sourceFileC.Path)); 111loader: new WorkspaceFileTextLoader(solution.Services, sourceFileE.Path, encodingE), 112filePath: sourceFileE.Path)); 133filePath: sourceFileD.Path)); 151solution = solution.WithDocumentTextLoader(documentIdB, new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB), PreservationMode.PreserveValue); 205solution = solution.WithProjectOutputFilePath(document.Project.Id, moduleFile.Path); 206_mockCompilationOutputs.Add(document.Project.Id, new CompilationOutputFiles(moduleFile.Path)); 281AddTestDocument(source1, sourceFile.Path, out var documentId).Project.Solution; 305$"test: {sourceFile.Path}: (2,0)-(2,22): Error ENC2012: {string.Format(FeaturesResources.EditAndContinueDisallowedByProject, ["test", "*optimized*"])}" 367AddTestDocument(source, sourceFile1.Path, out var documentId).Project.Solution; 460AddTestDocument(source, sourceFile1.Path, out var documentId).Project.Solution; 539AddTestDocument(source, sourceFile1.Path, out var documentId).Project.Solution; 607AddTestDocument(source, sourceFile.Path).Project.Solution; 668AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 714AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 762AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 797AddTestDocument(source, sourceFile.Path, out var documentId).Project.Solution; 835solution = solution.WithProjectOutputFilePath(projectId, moduleFile.Path).AddDocument(documentInfo); 837_mockCompilationOutputs.Add(projectId, new CompilationOutputFiles(moduleFile.Path)); 910var sourceFilePath = dir.CreateFile(sourceFileName).WriteAllText(source, Encoding.UTF8).Path; 1007using 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)}"], 1095AddDocument("a.cs", CreateText(source1), filePath: sourceFile.Path); 1100var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path); 1126[$"proj: {document2.FilePath}: (0,0)-(0,0): Error ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.Path)}"], 1150AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path); 1155var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path, checksumAlgorithm: SourceHashAlgorithms.Default); 1164using 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)}"], 1211AddDocument("test.cs", CreateText(sourceA), filePath: sourceFileA.Path); 1217EmitAndLoadLibraryToDebuggee(project.Id, sourceA, sourceFilePath: sourceFileA.Path); 1227var documentB = project.AddTestDocument(sourceB, path: sourceFileB.Path); 1276AddTestDocument(sourceA, sourceFileA.Path).Project. 1277AddTestDocument(sourceB, sourceFileA.Path, out var documentBId).Project.Solution; 1307AddTestDocument(source1, sourceFile1.Path, out var documentBId).Project.Solution; 1318solution = solution.AddTestDocument(projectId, source2, sourceFile2.Path, out var document2Id).Project.Solution; 1368var moduleId = EmitLibrary(project.Id, source1, sourceFilePath: sourceFile.Path); 1375var document0 = project.AddTestDocument(source0, path: sourceFile.Path); 1524AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path); 1527var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source1, sourceFilePath: sourceFile.Path, encoding: encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256); 1752var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.Path); 1758var document1 = project.AddTestDocument(source1, path: sourceFile.Path); 1795moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.Path); 1841AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path); 1846var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path); 1885AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path); 1890var 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; 2623var mvidA = EmitAndLoadLibraryToDebuggee(projectAId, sourceA1, sourceFilePath: sourceFileA.Path, assemblyName: "A"); 2624var mvidB = EmitAndLoadLibraryToDebuggee(projectBId, sourceB1, sourceFilePath: sourceFileB.Path, assemblyName: "B"); 2635sourceFileA.Path, 2640sourceFileB.Path, 2650AddTestDocument("class B { virtual int F() => 1; }", path: sourceFileB.Path, out var documentBId).Project.Solution; 2955AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.Path); 2964Assert.Equal(sourceFile.Path, filePath); 2972var moduleId = EmitAndLoadLibraryToDebuggee(documentId.ProjectId, source1, sourceFilePath: sourceFile.Path); 3001solution = solution.WithDocumentText(documentId, CreateTextFromFile(sourceFile.Path)); 3040AddDocument("test.cs", CreateText(source2), filePath: sourceFile.Path); 3047var 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)}" 3116var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path); 3139var document1 = project.AddDocument("test.cs", sourceText1, filePath: sourceFile.Path); 3174AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.Path); 3179var 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)); 4285var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).Path; 4385var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).Path; 5488var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.Path, assemblyName: "Proj"); 5494loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8), 5495filePath: sourceFileA.Path));
EditAndContinue\UnitTestingHotReloadServiceTests.cs (3)
35var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.Path, assemblyName: "Proj"); 43loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8), 44filePath: sourceFileA.Path));
Microsoft.CodeAnalysis.LanguageServer.UnitTests (7)
ExportProviderBuilderTests.cs (2)
143var fileInfo = new FileInfo(tempFile.Path); 146return tempFile.Path;
VirtualProjectXmlProviderTests.cs (5)
71var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None); 96var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, logger, CancellationToken.None); 128var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None); 179var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None); 183Assert.Equal(appFile.Path, diagnostic.Location.Path);
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (23)
MetadataShadowCopyProviderTests.cs (23)
87var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 88var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 90Assert.Equal(dll.Path, sc1.PrimaryModule.OriginalPath); 91Assert.NotEqual(dll.Path, sc1.PrimaryModule.FullPath); 95Assert.Equal(File.ReadAllBytes(dll.Path), File.ReadAllBytes(sc1.PrimaryModule.FullPath)); 96Assert.Equal(File.ReadAllBytes(doc.Path), File.ReadAllBytes(sc1.DocumentationFile.FullPath)); 104_provider.SuppressShadowCopy(dll.Path); 106var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 126var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 127Assert.NotEqual(dll.Path, sc1.PrimaryModule.FullPath); 139string path0 = dir.CreateFile("MultiModule.dll").WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).Path; 140string path1 = dir.CreateFile("mod2.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod2).Path; 141string path2 = dir.CreateFile("mod3.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod3).Path; 185var f0 = Temp.CreateFile().WriteAllText("bogus").Path; 188string f1 = Temp.CreateFile().WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).Path; 199var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 200var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 202var md1 = _provider.GetMetadata(dll.Path, MetadataImageKind.Assembly); 212var sc3a = _provider.GetMetadataShadowCopy(dll2.Path, MetadataImageKind.Module); 229var sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 235sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 241sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 247sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
Microsoft.CodeAnalysis.Scripting.UnitTests (6)
RuntimeMetadataReferenceResolverTests.cs (6)
31packageResolver: new PackageResolver(ImmutableDictionary<string, ImmutableArray<string>>.Empty.Add("nuget:N/1.0", ImmutableArray.Create(assembly1.Path, assembly2.Path))), 37AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly1.Path, assembly2.Path); 43AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly2.Path); 58AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly2.Path);
Microsoft.CodeAnalysis.Test.Utilities (15)
AssemblyLoadTestFixture.cs (3)
403", MetadataReference.CreateFromFile(delta1InAnalyzerReferencesDelta1.Path), compilerReference); 547var fileInfo = new FileInfo(tempFile.Path); 550return tempFile.Path;
Metadata\IlasmUtilities.cs (3)
80string sourceFileName = Path.GetFileNameWithoutExtension(sourceFile.Path); 84Path.ChangeExtension(Path.GetFileName(sourceFile.Path), "dll")); 111var arguments = $"\"{sourceFile.Path}\" -DLL {(autoInherit ? "" : "-noautoinherit")} -out=\"{assemblyPath}\"";
Platform\Desktop\DesktopRuntimeUtil.cs (3)
64var name = Path.GetFileName(file.Path); 66var assembly = appDomain.DefineDynamicAssembly(new AssemblyName(name), AssemblyBuilderAccess.Save, Path.GetDirectoryName(file.Path)); 71var image = CommonTestBase.ReadFromFile(file.Path);
Platform\Desktop\TestHelpers.cs (2)
88MetadataReference.CreateFromFile(immutable.Path), 89MetadataReference.CreateFromFile(analyzer.Path)
TempFiles\DisposableFile.cs (4)
29if (Path != null) 33File.Delete(Path); 40DeleteFileOnClose(Path); 48{1}: {2}", Path, ex.GetType().Name, ex.Message), ex);
Microsoft.CodeAnalysis.UnitTests (113)
AnalyzerAssemblyLoaderTests.cs (29)
574var deltaFile = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 575var gammaFile = tempDir.CreateDirectory("b").CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 611var alternatePath = tempDir.CreateDirectory("a").CreateFile("Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.dll").CopyContentFrom(externalAccessRazorPath).Path; 646var alternatePath = dir.CreateFile("Microsoft.CodeAnalysis.ExternalAccess.RazorCompiler.dll").CopyContentFrom(externalAccessRazorPath).Path; 647var deltaFile = dir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 686var deltaFile1 = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 688var gammaFile = tempSubDir.CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 689var deltaFile2 = tempSubDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 728var deltaFile = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 729var gammaFile = tempDir.CreateDirectory("b").CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 980var unregisteredDeltaPath = dir1.CopyFile(testFixture.Delta2).Path; 981var epsilonPath = dir1.CopyFile(testFixture.Epsilon).Path; 984var registeredDeltaPath = dir2.CopyFile(testFixture.Delta2).Path; 1038var epsilonFile = tempDir1.CreateFile("Epsilon.dll").CopyContentFrom(testFixture.Epsilon).Path; 1039var delta1File = tempDir1.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1040var delta2File = tempDir2.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta2).Path; 1278var deltaNewFilePath = dir.CopyFile(deltaFilePath).Path; 1292var assemblyFilePath = dir.CreateFile(assemblyName + ".dll").WriteAllBytes(array).Path; 1423var destFile = tempRoot.CreateDirectory().CreateOrOpenFile($"{assembly.GetName().Name}.dll").Path; 1458var deltaCopy = tempDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1483var deltaCopy = tempDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1518var delta1File = tempDir1.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1519var delta2File = tempDir2.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta2).Path; 1520var gammaFile = tempDir3.CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 1574var path = tempFile.Path; 1609var analyzerPath = tempDir.CreateFile("AnalyzerWithLoc.dll").CopyContentFrom(testFixture.AnalyzerWithLoc).Path; 1610var analyzerResourcesPath = tempDir.CreateDirectory("en-GB").CreateFile("AnalyzerWithLoc.resources.dll").CopyContentFrom(testFixture.AnalyzerWithLocResourceEnGB).Path; 1632var analyzerPath = tempDir.CreateFile("AnalyzerWithLoc.dll").CopyContentFrom(testFixture.AnalyzerWithLoc).Path; 1633var analyzerResourcesPath = tempDir.CreateDirectory("es").CreateFile("AnalyzerWithLoc.resources.dll").CopyContentFrom(testFixture.AnalyzerWithLocResourceEnGB).Path;
Analyzers\AnalyzerFileReferenceAppDomainTests.cs (4)
54var exception = remoteTest.LoadAnalyzer(dir.CreateDirectory("shadow").Path, analyzerFile.Path); 100MetadataReference.CreateFromFile(immutable.Path), 101MetadataReference.CreateFromFile(analyzer.Path) 112var exception = remoteTest.LoadAnalyzer(dir.CreateDirectory("shadow").Path, analyzerFile.Path);
Analyzers\AnalyzerFileReferenceTests.cs (4)
199var textFile = directory.CreateFile("Goo.txt").WriteAllText("I am the very model of a modern major general.").Path; 231var textFile = directory.CreateFile("Goo.txt").WriteAllText("I am the very model of a modern major general.").Path; 319args: new[] { "/nologo", $@"/analyzer:""{_testFixture.AnalyzerWithLaterFakeCompilerDependency}""", "/nostdlib", $@"/r:""{corlib}""", "/out:something.dll", source.Path }, 348args: new[] { "/nologo", $@"/analyzer:""{_testFixture.AnalyzerWithFakeCompilerDependency}""", $@"/analyzer:""{_testFixture.AnalyzerWithFakeCompilerDependency}""", "/nostdlib", $@"/r:""{corlib}""", "/out:something.dll", source.Path },
AssemblyUtilitiesTests.cs (12)
46var assemblyFile = directory.CreateFile("FakeAssembly.dll").Path; 58var assemblyFile = directory.CreateFile("FakeAssembly.dll").Path; 59var satelliteFile = directory.CreateFile("FakeAssembly.resources.dll").Path; 71var assemblyFile = directory.CreateFile("FakeAssembly.dll").Path; 72var satelliteFile = directory.CreateDirectory("de").CreateFile("FakeAssembly.resources.dll").Path; 84var assemblyFile = directory.CreateFile("FakeAssembly.dll").Path; 85var satelliteFile = directory.CreateDirectory("de").CreateDirectory("FakeAssembly.resources").CreateFile("FakeAssembly.resources.dll").Path; 97var assemblyFile = directory.CreateFile("FakeAssembly.dll").Path; 98var satelliteFileDE = directory.CreateDirectory("de").CreateFile("FakeAssembly.resources.dll").Path; 99var satelliteFileFR = directory.CreateDirectory("fr").CreateFile("FakeAssembly.resources.dll").Path; 111var assemblyFile = directory.CreateFile("FakeAssembly.dll").Path; 112var satelliteFile = directory.CreateDirectory("de").CreateDirectory("OtherAssembly.resources").CreateFile("FakeAssembly.resources.dll").Path;
CommonCommandLineParserTests.cs (14)
45return RuleSet.LoadEffectiveRuleSetFromFile(file.Path); 48return RuleSetProcessor.LoadFromFile(file.Path); 474var ruleSet = RuleSet.LoadEffectiveRuleSetFromFile(file.Path); 989RuleSet.LoadEffectiveRuleSetFromFile(file.Path); 994Assert.Contains(string.Format(CodeAnalysisResources.InvalidRuleSetInclude, newFile.Path, string.Format(CodeAnalysisResources.RuleSetBadAttributeValue, "Action", "Default")), e.Message, StringComparison.Ordinal); 1014var includePaths = RuleSet.GetEffectiveIncludesFromFile(file.Path); 1017Assert.Equal(expected: file.Path, actual: includePaths[0]); 1051var includePaths = RuleSet.GetEffectiveIncludesFromFile(file.Path); 1054Assert.Equal(expected: file.Path, actual: includePaths[0]); 1055Assert.Equal(expected: include.Path, actual: includePaths[1]); 1103var includePaths = RuleSet.GetEffectiveIncludesFromFile(file.Path); 1106Assert.Equal(expected: file.Path, actual: includePaths[0]); 1107Assert.Equal(expected: include1.Path, actual: includePaths[1]); 1108Assert.Equal(expected: include2.Path, actual: includePaths[2]);
FileSystem\RelativePathResolverTests.cs (2)
167var f1 = dir1.CreateFile("f.dll").Path; 168var f2 = dir2.CreateFile("f.dll").Path;
MetadataReferences\AssemblyIdentityComparerTests.cs (1)
632policyPath: appConfig.Path);
MetadataReferences\AssemblyMetadataTests.cs (2)
59var mm = dir.CreateFile("MultiModule.dll").WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).Path; 142var metadata = AssemblyMetadata.CreateFromFile(invalidModuleName.Path);
MetadataReferences\AssemblyPortabilityPolicyTests.cs (28)
75var stream = new FileStream(appConfig.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 80Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path)); 89Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path)); 105Assert.Throws<COMException>(() => FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path)); 125var stream = new FileStream(appConfig.Path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); 127AssertIsEnabled(appConfig.Path, platform: false, nonPlatform: true, fusionOnly: true); 142<linkedConfiguration href=""file://" + appConfig2.Path + @"""/> 161AssertIsEnabled(appConfig1.Path, platform: false, nonPlatform: true); 175AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 183AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 193AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 209AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 227AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 245AssertIsEnabled(appConfig.Path, platform: false, nonPlatform: true); 263AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: false); 281AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: false); 300AssertIsEnabled(appConfig.Path, platform: false, nonPlatform: false); 320AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: false); 344AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 364AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 381AssertIsEnabled(appConfig.Path, platform: true, nonPlatform: true); 389var policy = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path); 402var policy1 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path); 403var policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path); 408policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path); 413policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path); 427policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig.Path); 432policy2 = FusionAssemblyPortabilityPolicy.LoadFromFile(appConfig2.Path);
MetadataReferences\MetadataReferenceTests.cs (12)
96var stream = File.OpenRead(file.Path); 110File.Delete(file.Path); 163var r = MetadataReference.CreateFromFile(file.Path, 166Assert.Equal(file.Path, r.FilePath); 167Assert.Equal(file.Path, r.Display); 173Assert.Equal(props, MetadataReference.CreateFromFile(file.Path, props).Properties); 176File.Delete(file.Path); 187var r = MetadataReference.CreateFromFile(file.Path, MetadataReferenceProperties.Module); 189Assert.Equal(file.Path, r.FilePath); 190Assert.Equal(file.Path, r.Display); 196Assert.Equal(props, MetadataReference.CreateFromFile(file.Path, props).Properties); 199File.Delete(file.Path);
ShadowCopyAnalyzerPathResolverTests.cs (1)
36var analyzerPath = TempRoot.CreateDirectory().CreateFile("analyzer.dll").Path;
Text\StringTextDecodingTests.cs (4)
218string path = Temp.CreateFile().WriteAllBytes(encoding.GetBytes(expectedText)).Path; 306File.WriteAllText(tmpFile.Path, expectedText, encoding); 308using (FileStream fs = new FileStream(tmpFile.Path, FileMode.Open, FileAccess.Read)) 322using (FileStream fs = new FileStream(tmpFile.Path, FileMode.Open, FileAccess.Read))
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (237)
CommandLineBreakingChanges.vb (15)
26").Path 29Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /warnaserror+ /warnaserror- /out:" & tempBinary.Path & " " & src & " > " & tempLog.Path, expectedRetCode:=0) 43CleanupAllGeneratedFiles(tempBinary.Path) 44CleanupAllGeneratedFiles(tempLog.Path) 58</text>.Value).Path 60Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /nowarn:41008 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 90</text>.Value).Path 92Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /nowarn:41008 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 122</text>.Value).Path 124Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /warnaserror-:42025 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 143CleanupAllGeneratedFiles(tempOut.Path) 157</text>.Value).Path 159Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /warnaserror-:42025 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 178CleanupAllGeneratedFiles(tempOut.Path)
CommandLineIVTTests.vb (17)
40source2.Path 48{source2.Path}(3) : error BC30389: 'N1.A' is not accessible in this context because it is 'Friend'. 51{source2.Path}(3) : error BC37327: 'A' is defined in assembly 'N1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. 141source2.Path 149{source2.Path}(5) : error BC30390: 'A.Friend Sub M()' is not accessible in this context because it is 'Friend'. 152{source2.Path}(5) : error BC37327: 'Friend Sub M()' is defined in assembly 'N1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. 242source2.Path 250{source2.Path}(5) : error BC31417: 'Friend Overrides Sub M()' cannot override 'Friend Overridable Sub M()' because it is not accessible in this context. 253{source2.Path}(5) : error BC37327: 'Friend Overridable Sub M()' is defined in assembly 'N1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. 353source2.Path 361{source2.Path}(4) : error BC31109: Implementing class 'Class1.FooImpl' for interface 'Class1.IFoo' is not accessible in this context because it is 'Friend'. 364{source2.Path}(5) : error BC31109: Implementing class 'Class1.FooImpl' for interface 'Class1.IFoo' is not accessible in this context because it is 'Friend'. 367{source2.Path}(4) : error BC37327: 'Class1.FooImpl' is defined in assembly 'N1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. 370{source2.Path}(5) : error BC37327: 'Class1.FooImpl' is defined in assembly 'N1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. 471source3.Path 479{source3.Path}(5) : error BC36666: 'Friend Function N2.B.M() As N1.A' is not accessible in this context because the return type is not accessible. 482{source3.Path}(5) : error BC37327: 'Friend Function M() As A' is defined in assembly 'N2, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
CommandLineTests.vb (194)
82"/analyzerconfig:" + analyzerConfig.Path, 83src.Path}) 85Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)) 119"/analyzerconfig:" + analyzerConfig.Path, 122"/additionalfile:" + additionalFile.Path, 123src.Path}) 125Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)) 177"/analyzerconfig:" + analyzerConfig.Path, 178src.Path}) 180Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)) 186$"vbc : warning InvalidSeverityInAnalyzerConfig: The diagnostic 'bc42024' was given an invalid severity 'garbage' in the analyzer config file at '{analyzerConfig.Path}'. 187{src.Path}(4) : warning BC42024: Unused local variable: 'x'. 214"/analyzerconfig:" + analyzerConfig1.Path, 215"/analyzerconfig:" + analyzerConfig2.Path, 216src.Path 240Dim cmd = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.Path}) 259Dim cmd = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.Path}) 287</text>.Value).Path 333</text>.Value).Path 359").Path 471</text>.Value).Path 512</text>.Value).Path 530</text>.Value).Path 548</text>.Value).Path 589</text>.Value).Path 610Dim src As String = Temp.CreateFile().WriteAllText("♚", New System.Text.UTF8Encoding(False)).Path 614Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /t:library " & src & " > " & tempOut.Path, expectedRetCode:=1) 629Dim src As String = Temp.CreateFile().WriteAllText("♚", New System.Text.UTF8Encoding(False)).Path 633Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /utf8output /nologo /preferreduilang:en /t:library " & src & " > " & tempOut.Path, expectedRetCode:=1) 759</text>.Value).Path 781</text>.Value).Path 930/imports:System.Text</text>.Value).Path 992Dim tmpFileName As String = Temp.CreateFile().WriteAllBytes(New Byte() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}).Path 1011End Module").Path 1012Dim badres = Temp.CreateFile().WriteAllBytes(New Byte() {0, 0}).Path 2379CleanupAllGeneratedFiles(file1.Path) 2380CleanupAllGeneratedFiles(file2.Path) 2381CleanupAllGeneratedFiles(file3.Path) 2382CleanupAllGeneratedFiles(file4.Path) 2383CleanupAllGeneratedFiles(file5.Path) 2443CleanupAllGeneratedFiles(file1.Path) 2444CleanupAllGeneratedFiles(file2.Path) 2445CleanupAllGeneratedFiles(file3.Path) 2446CleanupAllGeneratedFiles(file4.Path) 2447CleanupAllGeneratedFiles(file5.Path) 2448CleanupAllGeneratedFiles(file6.Path) 2594CleanupAllGeneratedFiles(file.Path) 2611CleanupAllGeneratedFiles(file.Path) 2633CleanupAllGeneratedFiles(file.Path) 2657Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path}) 2667CleanupAllGeneratedFiles(file.Path) 2691"/ruleset:" & ruleSetFile.Path, "/warnaserror", "/nowarn:42376" 2705"/warnaserror+", "/ruleset:" & ruleSetFile.Path, "/nowarn:42376" 2714CleanupAllGeneratedFiles(file.Path) 2741"/ruleset:" & ruleSetFile.Path, "/nowarn" 2756"/nowarn", "/ruleset:" & ruleSetFile.Path 2766CleanupAllGeneratedFiles(file.Path) 2791Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path}) 2800CleanupAllGeneratedFiles(file.Path) 2824Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory) 2826Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath) 2849Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + """" + file.Path + """", "a.cs"}, _baseDirectory) 2851Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath) 2877parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory) 2880Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath) 2885Assert.Equal(file.Path, DirectCast(err.Arguments(0), String)) 3189AssertEx.Equal(File.ReadAllBytes(sl.Path), blob) 3193CleanupAllGeneratedFiles(src.Path) 3218AssertEx.Equal(File.ReadAllBytes(sl.Path), blob) 3221CleanupAllGeneratedFiles(src.Path) 3354expectedEmbeddedMap.Add(src.Path, embed_vb) 3358expectedEmbeddedMap.Add(src2.Path, embed2_vb) 3362expectedEmbeddedMap.Add(txt.Path, embed_xyz) 3381CleanupAllGeneratedFiles(src.Path) 3613CleanupAllGeneratedFiles(file.Path) 4104CleanupAllGeneratedFiles(src.Path) 4154CleanupAllGeneratedFiles(src.Path) 4155CleanupAllGeneratedFiles(xml.Path) 4235CleanupAllGeneratedFiles(src.Path) 4236CleanupAllGeneratedFiles(xml.Path) 4255CleanupAllGeneratedFiles(src.Path) 4274CleanupAllGeneratedFiles(src.Path) 4293CleanupAllGeneratedFiles(src.Path) 4312CleanupAllGeneratedFiles(src.Path) 4331CleanupAllGeneratedFiles(src.Path) 4350CleanupAllGeneratedFiles(src.Path) 4933Dim binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).Path 5010CleanupAllGeneratedFiles(src.Path) 5027CleanupAllGeneratedFiles(src.Path) 5034Dim filePath = tempFolder.CreateFile("temp.dll").Path 5055CleanupAllGeneratedFiles(src.Path) 5149CleanupAllGeneratedFiles(src.Path) 5181CleanupAllGeneratedFiles(src.Path) 5255File.Delete(sysRuntime.Path) 5261File.Delete(msCorLib.Path) 5263CleanupAllGeneratedFiles(src.Path) 5308File.Delete(msCorLib.Path) 5309CleanupAllGeneratedFiles(src.Path) 5342CleanupAllGeneratedFiles(src.Path) 5365CleanupAllGeneratedFiles(file.Path) 5768CleanupAllGeneratedFiles(file1.Path) 5769CleanupAllGeneratedFiles(file2.Path) 5953CleanupAllGeneratedFiles(file.Path) 6004CleanupAllGeneratedFiles(file.Path) 6043CleanupAllGeneratedFiles(file.Path) 6091CleanupAllGeneratedFiles(file.Path) 6135CleanupAllGeneratedFiles(file.Path) 6183CleanupAllGeneratedFiles(file.Path) 6229CleanupAllGeneratedFiles(file.Path) 6271CleanupAllGeneratedFiles(file.Path) 6275Return result.Value.Replace("PATH", file.Path).Replace("VERSION (HASH)", s_compilerVersion).Replace(vbLf, vbCrLf) 6307CleanupAllGeneratedFiles(file.Path) 6341CleanupAllGeneratedFiles(file.Path) 6375CleanupAllGeneratedFiles(file.Path) 6407CleanupAllGeneratedFiles(file.Path) 6439CleanupAllGeneratedFiles(file.Path) 6487CleanupAllGeneratedFiles(file.Path) 6824Path.GetFileName(sourceFile.Path) 6832String.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.Path)), 6833Path.GetFileName(sourceFile.Path) 6857CleanupAllGeneratedFiles(sourceFile.Path) 6872Dim source As String = folder.CreateFile("src.vb").WriteAllText("").Path 6873Dim ref As String = folder.CreateFile("ref.dll").WriteAllText("").Path 6905</text>.Value).Path 6909</text>.Value).Path 6953</text>.Value).Path 6957</text>.Value).Path 6987</text>.Value).Path 6991</text>.Value).Path 7021</text>.Value).Path 7025</text>.Value).Path 7050</text>.Value).Path 7055</text>.Value).Path 7074</text>.Value).Path 7242</text>.Value).Path 7263</text>.Value).Path 7300</text>.Value).Path 7455</text>.Value).Path 7553CleanupAllGeneratedFiles(src.Path) 7609file.Path & "(4) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. 7642" & file.Path & "(35) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. 7650CleanupAllGeneratedFiles(file.Path) 7714CleanupAllGeneratedFiles(file.Path) 7733CleanupAllGeneratedFiles(file.Path) 7922sourceFile.Path 7997CleanupAllGeneratedFiles(file.Path) 8123CleanupAllGeneratedFiles(file.Path) 8278CleanupAllGeneratedFiles(file.Path) 8501CleanupAllGeneratedFiles(file.Path) 8578CleanupAllGeneratedFiles(file.Path) 8640CleanupAllGeneratedFiles(file.Path) 8689CleanupAllGeneratedFiles(src.Path) 8939</text>.Value).Path 8996</text>.Value).Path 9019</text>.Value).Path 9043</text>.Value).Path 9064</text>.Value).Path 9086</text>.Value).Path 9091</text>.Value).Path 9095</text>.Value).Path 9147CleanupAllGeneratedFiles(file.Path) 9561CleanupAllGeneratedFiles(sourceFile.Path) 9667Dim vbcPath = dir.CopyFile(s_basicCompilerExecutable).Path 9727End Class").Path 9733Dim filePath = Temp.CreateFile().WriteAllText("").Path 9790CleanupAllGeneratedFiles(file.Path) 9842CleanupAllGeneratedFiles(file.Path) 9868CleanupAllGeneratedFiles(file.Path) 9934CleanupAllGeneratedFiles(file.Path) 9962CleanupAllGeneratedFiles(file.Path) 10040additionalFlags = additionalFlags.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray() 10097additionalFlags = additionalFlags.Append("/ruleset:" + ruleSetFile.Path).ToArray() 10170Dim args = {"/nologo", "/t:library", "/preferreduilang:en", src.Path} 10210Dim args = {"/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.Path} 10289additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray() 10332Dim globalOption = "/analyzerconfig:" + globalConfig.Path 10333Dim specificOption = "/analyzerconfig:" + analyzerConfig.Path 10363additionalFlags = additionalFlags.Append("/analyzerconfig:" & globalConfig.Path).ToArray() 10395VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference:=False, additionalFlags:={"/warnaserror+", "/analyzerconfig:" + globalConfig.Path}) 10417additionalFlags:={"/additionalfile:" & additionalFile.Path}, 10492additionalArgs = additionalArgs.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray() 10564CleanupAllGeneratedFiles(src.Path) 10586CleanupAllGeneratedFiles(src.Path) 10613CleanupAllGeneratedFiles(src.Path) 10629CleanupAllGeneratedFiles(src.Path) 10704CleanupAllGeneratedFiles(src.Path) 10744"/analyzerconfig:" + analyzerConfig.Path, 10745src.Path}) 10787"/analyzerconfig:" + analyzerConfig.Path, 10788src.Path}) 10832"/analyzerconfig:" + analyzerConfig.Path, 10833src.Path}) 10880"/analyzerconfig:" + analyzerConfig.Path, 10881src.Path})
SarifErrorLoggerTests.vb (4)
48Dim hello = Temp.CreateFile().WriteAllText(helloWorldVB).Path 83Dim sourceFilePath = Temp.CreateFile().WriteAllText(source).Path 124Dim sourceFilePath = Temp.CreateFile().WriteAllText(source).Path 162Dim sourceFilePath = Temp.CreateFile().WriteAllText(source).Path
TouchedFileLoggingTests.vb (7)
34Dim hello = Temp.CreateFile().WriteAllText(_helloWorldCS).Path 64Dim hello = Temp.CreateFile().WriteAllText(_helloWorldCS).Path 65Dim snkPath = Temp.CreateFile("TestKeyPair_", ".snk").WriteAllBytes(TestResources.General.snKey).Path 106]]></text>.Value).Path 114"/doc:" + xml.Path, 124expectedWrites.Add(xml.Path) 156CleanupAllGeneratedFiles(xml.Path)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (13)
Attributes\InternalsVisibleToAndStrongNameTests.vb (13)
448<assembly: System.Reflection.AssemblyKeyFile("]]><%= snk.Path %><![CDATA[")> 455c = CreateCompilationWithMscorlib40(source1, options:=TestOptions.ReleaseModule.WithCryptoKeyFile(snk.Path).WithPublicSign(True), parseOptions:=parseOptions) 503options:=TestOptions.ReleaseDll.WithCryptoKeyFile(tmp.Path).WithStrongNameProvider(New DesktopStrongNameProvider()), 507Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments(tmp.Path, CodeAnalysisResources.InvalidPublicKey)) 1452Using peStream = New FileStream(file.Path, FileMode.Open) 2040Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2048Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2056Dim options = TestOptions.SigningReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2064Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2102Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2127Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2141Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True).WithDelaySign(True) 2166Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True).WithDelaySign(False)
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (2)
CommandLineRunnerTests.vb (2)
57Dim runner = CreateRunner(args:={}, input:="#r """ & file1.Path & """" & vbCrLf & "? New C1().Goo()") 62> #r """ & file1.Path & """
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Semantics\FieldInitializerBindingTests.vb (1)
1398reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (46)
SymbolsTests\ExtensionMethods\ExtensionMethodTests.vb (6)
211Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 421Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 616Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 810Dim ILRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 1006Dim ILRef = ModuleMetadata.CreateFromImage(File.ReadAllBytes(reference.Path)).GetReference() 2234Dim ILRef = ModuleMetadata.CreateFromImage(File.ReadAllBytes(reference.Path)).GetReference()
SymbolsTests\InaccessibleOverriding.vb (8)
350Dim proj2AssemblyName = IO.Path.GetFileNameWithoutExtension(proj2ILFile.Path) 351Dim proj2Ref = MetadataReference.CreateFromImage(ReadFromFile(proj2ILFile.Path)) 401Dim proj1Ref = MetadataReference.CreateFromImage(ReadFromFile(proj1ILFile.Path)) 481Dim proj2AssemblyName = IO.Path.GetFileNameWithoutExtension(proj2ILFile.Path) 482Dim proj2Ref = MetadataReference.CreateFromImage(ReadFromFile(proj2ILFile.Path)) 525Dim proj1Ref = MetadataReference.CreateFromImage(ReadFromFile(proj1ILFile.Path)) 622Dim ilRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 708Dim ilRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path))
SymbolsTests\Metadata\PE\TypeForwarders.vb (3)
1105ilBytes = ReadFromFile(reference.Path) 1167ilBytes = ReadFromFile(reference.Path) 1286ilBytes = ReadFromFile(reference.Path)
SymbolsTests\Source\ImplementsTests.vb (8)
3865reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3949reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4044reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4102reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4171reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4240reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4325reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4390reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
SymbolsTests\Source\OverridesTests.vb (15)
2746reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3074reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3176reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3439reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3553reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3663reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3772reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3884reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3994reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4102reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4773reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4995reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5156reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5424reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5961reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
SymbolsTests\Source\TypeTests.vb (6)
3155ilBytes = ReadFromFile(reference.Path) 3221ilBytes = ReadFromFile(reference.Path) 3328ilBytes = ReadFromFile(reference.Path) 3335ilBytes = ReadFromFile(reference.Path) 3342ilBytes = ReadFromFile(reference.Path) 3373ilBytes = ReadFromFile(reference.Path)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
BasicTestBase.vb (1)
392reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
CompilationTestUtils.vb (1)
404ilImage = ImmutableArray.Create(File.ReadAllBytes(reference.Path))
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
VisualStudioMSBuildWorkspaceTests.cs (1)
3223var expectedEditorConfigPath = SolutionDirectory.CreateOrOpenFile(".editorconfig").Path;
Microsoft.CodeAnalysis.Workspaces.UnitTests (9)
CommandLineProject\CommandLineProjectWorkspaceTests.cs (1)
40Assert.Equal(tempFile.Path, gooDoc.FilePath);
SolutionTests\SolutionTests.cs (8)
1626solution = 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)); 4556var loader = new TestSmallFileTextLoader(file.Path, Encoding.UTF8); 4558var textLength = FileUtilities.GetFileLength(file.Path); 4560var 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)
978var info = SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create(), solutionFile.Path); 987filePath: nullPaths ? null : projectFile.Path)); 992filePath: nullPaths ? null : documentFile.Path));
ProjectSystemShim\CPS\AnalyzersTests.cs (5)
39project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 64project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 67project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 81project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 85Assert.Equal(ruleSetFile.Path, environment.Workspace.TryGetRuleSetPathForProject(projectId));
ProjectSystemShim\CPS\CSharpCompilerOptionsTests.cs (1)
162var newFilePath = Temp.CreateFile().Path;
ProjectSystemShim\CPS\CSharpReferencesTests.cs (1)
135var analyzerAssemblyFullPath = tempRoot.CreateFile().Path;
ProjectSystemShim\LegacyProject\AnalyzersTests.cs (14)
44((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 59((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 62Assert.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); 150var pathWithExtraBackslashes = ruleSetFile.Path.Replace(@"\", @"\\"); 156Assert.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); 260File.WriteAllText(ruleSetFile.Path, ruleSetSource.Replace("Error", "Warning")); 261await environment.RaiseFileChangeAsync(ruleSetFile.Path);
ProjectSystemShim\VisualStudioCompilationOutputFilesTests.cs (3)
38var debugDirPdbPath = exactPdbPath ? pdbFile.Path : "a/y/z/lib.pdb"; 48var outputs = new CompilationOutputFilesWithImplicitPdbPath(dllFile.Path); 93var outputs = new CompilationOutputFilesWithImplicitPdbPath(dllFile.Path);
Microsoft.VisualStudio.LanguageServices.UnitTests (1)
Diagnostics\VisualStudioDiagnosticAnalyzerProviderTests.vb (1)
55Dim hostAnalyzers = New HostDiagnosticAnalyzers(ImmutableArray.Create(Of AnalyzerReference)(New AnalyzerFileReference(analyzerFile.Path, analyzerLoader)))
Roslyn.VisualStudio.Next.UnitTests (11)
Remote\SnapshotSerializationTests.cs (9)
427var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path))); 448var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path))); 485var analyzer1 = new AnalyzerFileReference(file1.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented); 486var analyzer2 = new AnalyzerFileReference(file2.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented); 494AssertEx.Equal([file1.Path, file2.Path], recovered.GetProject(project.Id).AnalyzerReferences.Select(r => r.FullPath)); 567var tempCorlibXml = tempDir.CreateFile(Path.ChangeExtension(tempCorlib.Path, "xml")); 585.AddMetadataReference(MetadataReference.CreateFromFile(tempCorlib.Path)) 703return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.Path)));
Services\ServiceHubServicesTests.cs (2)
375p1, VersionStamp.Create(), "p1", "p1", LanguageNames.CSharp, outputFilePath: file.Path, 379metadataReferences: [MetadataReference.CreateFromFile(file.Path)])
VBCSCompiler.UnitTests (29)
AnalyzerConsistencyCheckerTests.cs (12)
72var emitResult = comp.Emit(file.Path); 120new CommandLineAnalyzerReference(mvidAlpha1.Path), 121new CommandLineAnalyzerReference(mvidAlpha2.Path)); 145ImmutableArray.Create(new CommandLineAnalyzerReference(mvidAlpha1.Path)), 150File.Delete(mvidAlpha1.Path); 152Assert.Equal(mvidAlpha1.Path, mvidAlpha2.Path); 155ImmutableArray.Create(new CommandLineAnalyzerReference(mvidAlpha2.Path)), 165Assert.Contains(mvidAlpha1.Path, errorMessage); 166Assert.Contains(mvidAlpha2.Path, errorMessage); 213Assert.True(assemblyLoader.LoadFromPath(dllFile.Path).GlobalAssemblyCache); 240var analyzerReferences = ImmutableArray.Create(new CommandLineAnalyzerReference(compFile.Path));
CompilerServerTests.cs (15)
223var srcFile = tempDir.CreateFile("test.cs").WriteAllText(source).Path; 264var result = ProcessUtilities.Run(file.Path, "", Path.GetDirectoryName(file.Path)); 341var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").Path; 363var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("♕").Path; 387var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("♕").Path; 1148var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").Path; 1170var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText(@"♕").Path; 1197var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").Path; 1219var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText(@"♕").Path; 1304var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").Path; 1328var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("♕").Path; 1394var srcFile = _tempDirectory.CreateFile("test.cs").WriteAllText("").Path; 1428var srcFile = _tempDirectory.CreateFile("test.vb").WriteAllText("").Path; 1464var serverExe = dir.CopyFile(compilerServerExecutable).Path;
TouchedFileLoggingTests.cs (2)
58var source1 = Temp.CreateFile().WriteAllText(HelloWorldCS).Path; 109var source1 = Temp.CreateFile().WriteAllText(HelloWorldVB).Path;