1251 references to Path
InteractiveHost.UnitTests (37)
AbstractInteractiveHostTests.cs (1)
206return (file.Path, image);
InteractiveHostCoreInitTests.cs (2)
57var dllDir = Path.GetDirectoryName(dll.Path)!; 85await Host.AddReferenceAsync(Path.GetFileName(dll.Path));
InteractiveHostDesktopInitTests.cs (2)
30var dllDir = Path.GetDirectoryName(dll.Path)!; 58await Host.AddReferenceAsync(Path.GetFileName(dll.Path));
InteractiveHostDesktopTests.cs (32)
182var file = Temp.CreateFile().WriteAllText(MethodWithInfiniteLoop + "\r\nfoo();").Path; 201var file = Temp.CreateFile().WriteAllText("1 1").Path; 236").Path; 272await Host.ExecuteFileAsync(file.Path); 275Assert.True(errorOut.StartsWith(file.Path + "(1,7):", StringComparison.Ordinal), "Error output should start with file name, line and column"); 463Assert.True(await LoadReference(file1.Path)); 464Assert.True(await LoadReference(file2.Path)); 508#r ""{file.Path}"" 520#r ""{file.Path}"" 551#r ""{file1.Path}"" 552#r ""{file2.Path}"" 562Assert.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. 586#r ""{file1.Path}"" 587#r ""{file2.Path}"" 704rspFile.WriteAllText($"/lib:{directory1.Path} /r:Assembly2.dll {initFile.Path}"); 706await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform)); 722{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))} 742rspFile.WriteAllText($"{initFile.Path}"); 744await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform)); 748@$"{initFile.Path}(1,1): error CS0006: {string.Format(CSharpResources.ERR_NoMetadataFile, "Assembly.dll")}", error); 769await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform)); 802$@"{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))} 817{initFile.Path} 820await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform)); 826AssertEx.AssertEqualToleratingWhitespaceDifferences($@"{initFile.Path}(1,3): error CS1002: {CSharpResources.ERR_SemicolonExpected} 830{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))} 847await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform)); 852$@"{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))} 915#r """ + dll.Path + @""" 944await Execute($@"#r ""{libFile.Path}"""); 1027await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, culture, uiCulture, Host.OptionsOpt!.Platform)); 1037{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))}
Microsoft.Build.Tasks.CodeAnalysis.UnitTests (30)
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
TestUtilities\DotNetSdkTestBase.cs (2)
191Project.Path, 233Project.Path,
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (388)
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 (354)
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); 2251AssertEx.Equal(File.ReadAllBytes(sl.Path), blob); 2256CleanupAllGeneratedFiles(src.Path); 2280AssertEx.Equal(File.ReadAllBytes(sl.Path), blob); 2284CleanupAllGeneratedFiles(src.Path); 2309CleanupAllGeneratedFiles(src.Path); 2429expectedEmbeddedMap.Add(src.Path, embed_cs); 2434expectedEmbeddedMap.Add(src2.Path, embed2_cs); 2439expectedEmbeddedMap.Add(txt.Path, embed_xyz); 2462CleanupAllGeneratedFiles(src.Path); 2780CleanupAllGeneratedFiles(file.Path); 2802CleanupAllGeneratedFiles(file.Path); 2827var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory); 2829Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath); 2853var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + "\"" + file.Path + "\"", "a.cs" }, WorkingDirectory); 2855Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath); 2882parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory); 2885Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath); 2890Assert.Equal(file.Path, (string)err.Arguments[0]); 2922CleanupAllGeneratedFiles(file.Path); 2950var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs", "/ruleset:" + ruleSetFile.Path }); 2957CleanupAllGeneratedFiles(file.Path); 2987"/ruleset:" + ruleSetFile.Path, "/warnaserror+", "/nowarn:8032" }); 2998"/warnaserror+", "/ruleset:" + ruleSetFile.Path, "/nowarn:8032" }); 3005CleanupAllGeneratedFiles(file.Path); 3506"/ruleset:" + ruleSetFile.Path, "/warn:0" }); 3517"/warn:0", "/ruleset:" + ruleSetFile.Path }); 3524CleanupAllGeneratedFiles(file.Path); 3677CleanupAllGeneratedFiles(file.Path); 3697CleanupAllGeneratedFiles(file.Path); 4320var srcDirectory = Path.GetDirectoryName(srcFile.Path); 4331var silverlight = Temp.CreateFile().WriteAllBytes(Silverlight.System).Path; 4332var net4_0dll = Temp.CreateFile().WriteAllBytes(Net461.Resources.System).Path; 4340"/appconfig:" + appConfigFile.Path, 4341srcFile.Path }).Run(outWriter); 4345CleanupAllGeneratedFiles(srcFile.Path); 4346CleanupAllGeneratedFiles(appConfigFile.Path); 4353var srcDirectory = Path.GetDirectoryName(srcFile.Path); 4360srcFile.Path }).Run(outWriter); 4364CleanupAllGeneratedFiles(srcFile.Path); 4480var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/modulename:hocusPocus ", "/out:" + exeName + " ", file1.Path }); 4505CleanupAllGeneratedFiles(file1.Path); 4749CleanupAllGeneratedFiles(src.Path); 4768CleanupAllGeneratedFiles(src.Path); 4776var filePath = tempFolder.CreateFile("temp").Path; 4796CleanupAllGeneratedFiles(src.Path); 5884public class Mod { }").Path; 5889public class Mod { }").Path; 5894class Test { static void Main() {} }").Path; 5931string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"public static class Extensions { public static bool EB(this bool b) { return b; } }").Path; 5932string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").Path; 5951string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Mod { }").Path; 5952string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").Path; 6131var srcFile = Temp.CreateFile().WriteAllText("\u265A").Path; 6135var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.Path, expectedRetCode: 1); 6140CleanupAllGeneratedFiles(tempOut.Path); 6146var srcFile = Temp.CreateFile().WriteAllText("\u265A").Path; 6150var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /utf8output /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.Path, expectedRetCode: 1); 6155CleanupAllGeneratedFiles(tempOut.Path); 6175CleanupAllGeneratedFiles(aCs.Path); 6189CleanupAllGeneratedFiles(aCs.Path); 6203CleanupAllGeneratedFiles(aCs.Path); 6303var kfile = "/keyfile:" + snkFile.Path; 6308parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698a.Path, "CS1698b.cs" }, WorkingDirectory); 6311parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698b.Path, "/out:" + cs1698a.Path, "CS1698.cs" }, WorkingDirectory); 6321CleanupAllGeneratedFiles(snkFile.Path); 6322CleanupAllGeneratedFiles(cs1698a.Path); 6323CleanupAllGeneratedFiles(cs1698b.Path); 6324CleanupAllGeneratedFiles(cs1698.Path); 6330var binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).Path; 6415").Path; 6420").Path; 6439").Path; 6448").Path; 6453").Path; 6461").Path; 6467").Path; 6514").Path; 6519").Path; 6555").Path; 6561").Path; 6596").Path; 6602").Path; 6946CleanupAllGeneratedFiles(file.Path); 6970CleanupAllGeneratedFiles(file.Path); 6993CleanupAllGeneratedFiles(file.Path); 7021CleanupAllGeneratedFiles(file.Path); 7094CleanupAllGeneratedFiles(file1.Path); 7095CleanupAllGeneratedFiles(file2.Path); 7117CleanupAllGeneratedFiles(file.Path); 7217CleanupAllGeneratedFiles(file.Path); 7245CleanupAllGeneratedFiles(file.Path); 7273CleanupAllGeneratedFiles(file.Path); 7299CleanupAllGeneratedFiles(file.Path); 7325CleanupAllGeneratedFiles(file.Path); 7489CleanupAllGeneratedFiles(file.Path); 7528CleanupAllGeneratedFiles(file.Path); 7797Path.GetFileName(sourceFile.Path), 7807string.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.Path)), 7808Path.GetFileName(sourceFile.Path), 7850}").Path; 7854").Path; 7897}").Path; 7901").Path; 7931}").Path; 7935").Path; 7965}").Path; 7969").Path; 8005outWriter.ToString().Replace(Path.GetFileName(src.Path), "{FILE}").Trim()); 8014CleanupAllGeneratedFiles(src.Path); 8020return Temp.CreateFile().WriteAllBytes(cscRsp).Path; 8159string OriginalSource = src.Path; 8169CleanupAllGeneratedFiles(src.Path); 8229CleanupAllGeneratedFiles(src.Path); 8272CleanupAllGeneratedFiles(src.Path); 8273CleanupAllGeneratedFiles(xml.Path); 8343CleanupAllGeneratedFiles(src.Path); 8344CleanupAllGeneratedFiles(xml.Path); 8383}").Path; 8520}").Path; 8559").Path; 8583").Path; 8617").Path; 8636string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").Path; 8637string badres = Temp.CreateFile().WriteAllBytes(TestResources.DiagnosticTests.badresfile).Path; 8661string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").Path; 8662string badres = Temp.CreateFile().WriteAllBytes(new byte[] { 0, 0 }).Path; 8690}").Path; 8712} ").Path; 8756using (var stream = File.OpenWrite(exe.Path)) 8763using (var stream = File.OpenWrite(pdb.Path)) 8769int exitCode1 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source1.Path }).Run(outWriter); 8772ValidateZeroes(exe.Path, oldSize); 8773ValidateZeroes(pdb.Path, oldSize); 8775int exitCode2 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source2.Path }).Run(outWriter); 8778using (var peFile = File.OpenRead(exe.Path)) 8780PdbValidation.ValidateDebugDirectory(peFile, null, pdb.Path, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false); 8783Assert.True(new FileInfo(exe.Path).Length < oldSize); 8784Assert.True(new FileInfo(pdb.Path).Length < oldSize); 8786int exitCode3 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source3.Path }).Run(outWriter); 8789using (var peFile = File.OpenRead(exe.Path)) 8791PdbValidation.ValidateDebugDirectory(peFile, null, pdb.Path, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false); 8827var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8828var fsPdb = new FileStream(libPdb.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8831int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/debug:full", libSrc.Path }).Run(outWriter); 8839AssertEx.Equal(new byte[] { 0x4D, 0x5A }, ReadBytes(libDll.Path, 2)); 8842AssertEx.Equal(new byte[] { 0x4D, 0x69 }, ReadBytes(libPdb.Path, 2)); 8867var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8868var fsPdb = new FileStream(libPdb.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8877var output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $"/target:library /debug:portable \"{libSrc.Path}\"", startFolder: dir.ToString()); 8893using (var fsNewDll = File.OpenRead(libDll.Path)) 8899AssertEx.Equal(new[] { (byte)'B', (byte)'S', (byte)'J', (byte)'B' }, ReadBytes(libPdb.Path, 4)); 8908File.Delete(libSrc.Path); 8909File.Delete(libDll.Path); 8910File.Delete(libPdb.Path); 8933File.SetAttributes(libDll.Path, FileAttributes.ReadOnly); 8935var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete); 8938int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter); 8939Assert.Contains($"error CS2012: Cannot open '{libDll.Path}' for writing", outWriter.ToString()); 8941AssertEx.Equal(new[] { (byte)'D', (byte)'L', (byte)'L' }, ReadBytes(libDll.Path, 3)); 8957int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter); 9161} ").Path; 9205string sourcePath = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(source).Path; 9230var sourcePath = Temp.CreateFile(directory: WorkingDirectory, extension: ".cs").WriteAllText(source).Path; 9303commandLineArgs = new[] { @"tmpDir\a.cs", tempFile.Path }; 9314commandLineArgs = new[] { tempFile.Path, @"tmpDir\*.cs" }; 9329commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, "tmpDir\a.cs" }; 9334commandLineArgs = new[] { tempFile.Path, @"tmpDi\r*a?.cs" }; 9343commandLineArgs = new[] { tempFile.Path, currentDrive + @":a.cs" }; 9349commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, @":a.cs" }; 9354CleanupAllGeneratedFiles(tempFile.Path); 9427var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9433new[] { "/reportanalyzer", "/t:library", srcFile.Path }, 9444CleanupAllGeneratedFiles(srcFile.Path); 9485var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9487var args = new List<string>() { "/reportanalyzer", "/t:library", "/a:" + typeof(DoNothingGenerator).Assembly.Location, srcFile.Path }; 9509CleanupAllGeneratedFiles(srcFile.Path); 9518var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9527new[] { "/reportanalyzer", "/t:library", srcFile.Path }, 9543CleanupAllGeneratedFiles(srcFile.Path); 9558workingDirectory: Path.GetDirectoryName(srcFile.Path), 9559args: new[] { "/errorlog:" + errorLog.Path, "/warnaserror+", "/nologo", "/t:library", srcFile.Path }, 9569CleanupAllGeneratedFiles(srcFile.Path); 9570CleanupAllGeneratedFiles(errorLog.Path); 9578var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9581var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path }, 9595CleanupAllGeneratedFiles(srcFile.Path); 9603var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9606var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", $"/warnaserror:{AnalyzerExecutor.AnalyzerExceptionDiagnosticId}", srcFile.Path }, 9617CleanupAllGeneratedFiles(srcFile.Path); 9625var srcDirectory = Path.GetDirectoryName(srcFile.Path); 9628var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path }, 9639CleanupAllGeneratedFiles(srcFile.Path); 9732").Path; 9783DefaultParse(new[] { "/lib:" + invalidPath, sourceFile.Path }, WorkingDirectory).Errors.Verify( 9786DefaultParse(new[] { "/lib:" + nonExistentPath, sourceFile.Path }, WorkingDirectory).Errors.Verify( 9791DefaultParse(new[] { sourceFile.Path }, WorkingDirectory, additionalReferenceDirectories: invalidPath).Errors.Verify( 9794DefaultParse(new[] { sourceFile.Path }, WorkingDirectory, additionalReferenceDirectories: nonExistentPath).Errors.Verify( 9798CleanupAllGeneratedFiles(sourceFile.Path); 9824string filePath = Temp.CreateFile().WriteAllText(@"class C {}").Path; 9997string filePath = Temp.CreateFile().WriteAllText(source).Path; 10047string filePath = Temp.CreateFile().WriteAllText(source).Path; 10118CleanupAllGeneratedFiles(src.Path); 10177CleanupAllGeneratedFiles(src.Path); 10243CleanupAllGeneratedFiles(src.Path); 10350CleanupAllGeneratedFiles(src.Path); 10353void 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); 10447CleanupAllGeneratedFiles(src.Path); 10450void 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); 10484CleanupAllGeneratedFiles(src.Path); 10524CleanupAllGeneratedFiles(src.Path); 10555sourceFile.Path 10652CleanupAllGeneratedFiles(file.Path); 10764CleanupAllGeneratedFiles(file.Path); 10907CleanupAllGeneratedFiles(file.Path); 11105CleanupAllGeneratedFiles(file.Path); 11189CleanupAllGeneratedFiles(file.Path); 11293CleanupAllGeneratedFiles(file.Path); 11392CleanupAllGeneratedFiles(src.Path); 11740var output = ProcessUtilities.RunAndGetOutput(csc32exe.Path, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir32.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir32.Path); 11743output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir64.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir64.Path); 12014var cscPath = dir.CopyFile(s_CSharpCompilerExecutable).Path; 12490string filePath = Temp.CreateFile().WriteAllText("").Path; 12510string filePath = Temp.CreateFile().WriteAllText("").Path; 12573CleanupAllGeneratedFiles(srcFile.Path); 12635CleanupAllGeneratedFiles(srcFile.Path); 12691CleanupAllGeneratedFiles(srcFile.Path); 12778CleanupAllGeneratedFiles(sourceFile.Path); 12879CleanupAllGeneratedFiles(sourceFile.Path); 12989CleanupAllGeneratedFiles(sourceFile.Path); 13012CleanupAllGeneratedFiles(srcFile.Path); 13038CleanupAllGeneratedFiles(srcFile.Path); 13105CleanupAllGeneratedFiles(srcFile.Path); 13133CleanupAllGeneratedFiles(srcFile.Path); 13393"/analyzerconfig:" + analyzerConfig.Path, 13394src.Path }; 13413arguments = arguments.Append($"/ruleset:{rulesetFile.Path}"); 13419Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 13511additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray(); 13561additionalArgs = additionalArgs.Append("/ruleset:" + rulesetFile.Path).ToArray(); 13649"/analyzerconfig:" + analyzerConfig.Path, 13650src.Path }; 13664Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 13709output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 13718output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 13726output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 13748var args = new[] { "/nologo", "/t:library", "/preferreduilang:en", src.Path }; 13787var args = new[] { "/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.Path }; 13878additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray(); 13926CleanupAllGeneratedFiles(src.Path); 13981CleanupAllGeneratedFiles(src.Path); 14012CleanupAllGeneratedFiles(src.Path); 14049<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"" /> 14095CleanupAllGeneratedFiles(src.Path); 14125CleanupAllGeneratedFiles(src.Path); 14159CleanupAllGeneratedFiles(src.Path); 14197CleanupAllGeneratedFiles(src.Path); 14228options: TestOptions.DebugDll.WithCryptoKeyFile(Path.GetFileName(snk.Path)).WithStrongNameProvider(virtualSnProvider), 14267CleanupAllGeneratedFiles(src.Path); 14288CleanupAllGeneratedFiles(src.Path); 14311CleanupAllGeneratedFiles(src.Path); 14380CleanupAllGeneratedFiles(src.Path); 14408CleanupAllGeneratedFiles(src.Path); 14476CleanupAllGeneratedFiles(src.Path); 14545CleanupAllGeneratedFiles(src.Path); 14626CleanupAllGeneratedFiles(src.Path); 14645VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.Path }, generators: new[] { generator }, analyzers: null); 14708"/analyzerconfig:" + analyzerConfig1.Path, 14709"/analyzerconfig:" + analyzerConfig2.Path, 14710"/analyzerconfig:" + analyzerConfig3.Path, 14712src.Path 14776new[] { "/t:library", "/nologo", "/warnaserror+", src.Path }, 14796new[] { "/t:library", "/nologo", "/nowarn:CS8785", src.Path }, 14821new[] { "/t:library", "/nologo", "/warnaserror+", src.Path }, 14841new[] { "/t:library", "/nologo", "/nowarn:CS8784", src.Path }, 14876VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/additionalfile:" + additionalFile.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null); 14879CleanupAllGeneratedFiles(src.Path); 14921new[] { "/nologo", "/t:library", srcFile.Path }, 14927CleanupAllGeneratedFiles(srcFile.Path); 14950"/analyzerconfig:" + analyzerConfig1.Path, 14951"/analyzerconfig:" + analyzerConfig2.Path, 14952src.Path 14980var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.Path + "," + analyzerConfig2.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 14999output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.Path + "," + analyzerConfig2.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15030"/analyzerconfig:" + analyzerConfig.Path, 15031"/analyzerconfig:" + globalConfig.Path, 15034"/additionalfile:" + additionalFile.Path, 15035src.Path }); 15137VerifyOutput(dir, src, additionalFlags: new[] { "/warnaserror+", "/analyzerconfig:" + globalConfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false); 15160additionalFlags = additionalFlags.Append("/analyzerconfig:" + globalConfig.Path).ToArray(); 15194[{PathUtilities.NormalizeWithForwardSlash(src.Path)}] 15198VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:0164", "/analyzerconfig:" + globalConfig.Path }, expectedErrorCount: 0, includeCurrentAssemblyAsAnalyzerReference: false); 15215VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + globalConfig.Path }, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() }); 15217VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:Warning01", "/analyzerconfig:" + globalConfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() }); 15237additionalFlags: new[] { "/additionalfile:" + additionalFile.Path }, 15318additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray(); 15439string path1 = additionalFile1.Path; 15440string path2 = additionalFile2?.Path ?? Path.Combine(srcDirectory.Path, additionalFilePath2); 15491var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15495VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path, "/nowarn:CS8034" }, expectedWarningCount: 0, includeCurrentAssemblyAsAnalyzerReference: false); 15498output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path, "/warnAsError:CS8034" }, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15515var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false); 15519VerifyOutput(dir, src, additionalFlags: new[] { "/analyzer:" + notAnalyzer.Path, "/analyzerConfig:" + globalconfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false); 15556src.Path }); 15567"/analyzerconfig:" + analyzerConfig.Path, 15568src.Path }); 15570Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 15608src.Path }); 15620src.Path }); 15690src.Path }); 15701"/analyzerconfig:" + analyzerConfig.Path, 15702src.Path }); 15704Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)); 15743src.Path }); 15755src.Path }); 15821"/analyzerconfig:" + analyzerConfig.Path, 15822src.Path }); 15860"/analyzerconfig:" + analyzerConfig.Path, 15861src.Path }); 15900"/analyzerconfig:" + analyzerConfig.Path, 15901src.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 (10)
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))
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
EditAndContinue\StatementEditingTests.cs (1)
3724delegateDefs = MetadataReference.CreateFromImage(File.ReadAllBytes(tempAssembly.Path));
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (31)
InteractiveSessionReferencesTests.cs (31)
347#r ""{c1.Path}"" 348#r ""{c2.Path}"" 363#r ""{c1.Path}"" 365#r ""{c2.Path}"" 383#r ""{c1.Path}"" 384#r ""{c2.Path}"" 402#r ""{c1.Path}"" 404#r ""{c2.Path}"" 422#r ""{c1.Path}"" 430#r ""{c2.Path}"" 448Diagnostic(ErrorCode.ERR_NoImplicitConv, "c2").WithArguments($"C [{c2.Path}]", $"C [{c1.Path}]")); 632var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 634var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 646Assert.Equal(fileBase1.Path, ((PortableExecutableReference)libBaseRefAndSymbol.Key).FilePath); 690var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 692var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 704Assert.Equal(fileBase1.Path, ((PortableExecutableReference)libBaseRefAndSymbol.Key).FilePath); 756var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 758var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 824var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 826var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 892var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 894var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 960var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 962var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 1028var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 1030var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 1096var s0 = await CSharpScript.RunAsync($@"#r ""{file1.Path}""", ScriptOptions); 1099var s2 = await s1.ContinueWithAsync($@"#r ""{file2.Path}"""); 1122var s0 = await CSharpScript.RunAsync("C c;", ScriptOptions.WithReferences(libFile.Path));
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (43)
CommandLineRunnerTests.cs (22)
269""{script.Path}"" 276args: [$@"@""{rsp.Path}""", "/arg5", "--", "/arg7"], 300args: [script.Path, "arg1", "arg2", "arg3"]); 317args: [script.Path, "@arg1", "@arg2", "@arg3"]); 335{script.Path} 343args: [$"@{rsp.Path}", "/arg5", "--", "/arg7"], 366args: ["--", script.Path, "@arg1", "@arg2", "@arg3"]); 452script.Path 543var runner = CreateRunner([$"/loadpath:{dir1.Path}", $"/loadpaths:{dir2.Path};{dir3.Path}", main.Path]); 580var runner = CreateRunner(["/r:4.dll", $"/lib:{dir1.Path}", $"/libpath:{dir2.Path}", $"/libpaths:{dir3.Path};{dir4.Path}", main.Path]); 680var csi = CreateRunner(["b.csx"], responseFile: rsp.Path); 709var runner = CreateRunner(["/i", init.Path], input: 729var runner = CreateRunner([$@"/r:""{reference.Path}""", "/i", init.Path], input: 736{init.Path}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected} 744$@"{init.Path}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}", 836$@"#r ""{file1.Path}"" 838#r ""{file2.Path}"" 845> #r ""{file1.Path}"" 847> #r ""{file2.Path}"" 850{string.Format(ScriptingResources.AssemblyAlreadyLoaded, libBaseName, "0.0.0.0", fileBase1.Path, fileBase2.Path)}
InteractiveSessionReferencesTests.cs (9)
42#r ""{libFile.Path}"" 88var libDRef = MetadataReference.CreateFromFile(libDFile.Path); 96var r1 = swapReferences ? libBFile.Path : libAFile.Path; 97var r2 = swapReferences ? libAFile.Path : libBFile.Path; 133var libBRef = MetadataReference.CreateFromFile(libBFile.Path); 139#r ""{libAFile.Path}"" 145File.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)
1562var result = ProcessUtilities.RunAndGetOutput(asmB.Path); 1570result = 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)
1992return MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path));
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
EditAndContinue\EditAndContinueLanguageServiceTests.cs (5)
366loader: new WorkspaceFileTextLoader(workspace.Services.SolutionServices, sourceFile.Path, Encoding.UTF8), 367filePath: sourceFile.Path)); 372var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source1, sourceFilePath: sourceFile.Path); 378File.WriteAllText(sourceFile.Path, source2, Encoding.UTF8); 391Assert.Equal(sourceFile.Path, key);
Emit\CompilationOutputFilesTests.cs (2)
40var outputs = new CompilationOutputFiles(dllFile.Path, pdbFile.Path);
Utilities\SymbolEquivalenceComparerTests.cs (1)
1827var 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 (83)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (73)
68var sourceTreeA1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesA1, sourceBytesA1.Length, encodingA, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileA.Path); 69var sourceTreeB1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesB1, sourceBytesB1.Length, encodingB, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileB.Path); 70var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.Path); 92loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, encodingA), 93filePath: sourceFileA.Path)); 99loader: new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB), 100filePath: sourceFileB.Path)); 106loader: new WorkspaceFileTextLoader(solution.Services, sourceFileC.Path, encodingC), 107filePath: sourceFileC.Path)); 113loader: new WorkspaceFileTextLoader(solution.Services, sourceFileE.Path, encodingE), 114filePath: sourceFileE.Path)); 135filePath: sourceFileD.Path)); 153solution = solution.WithDocumentTextLoader(documentIdB, new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB), PreservationMode.PreserveValue); 207solution = solution.WithProjectOutputFilePath(document.Project.Id, moduleFile.Path); 208_mockCompilationOutputs.Add(document.Project.Id, new CompilationOutputFiles(moduleFile.Path)); 319solution = solution.WithProjectOutputFilePath(projectId, moduleFile.Path).AddDocument(documentInfo); 321_mockCompilationOutputs.Add(projectId, new CompilationOutputFiles(moduleFile.Path)); 394var sourceFilePath = dir.CreateFile(sourceFileName).WriteAllText(source, Encoding.UTF8).Path; 491using var stream = File.OpenRead(moduleFile.Path); 507_mockCompilationOutputs.Add(projectId, new CompilationOutputFiles(moduleFile.Path)); 528[$"proj: <no location>: Error ENC1001: {string.Format(FeaturesResources.ErrorReadingFile, moduleFile.Path, expectedErrorMessage)}"], 578AddDocument("a.cs", CreateText(source1), filePath: sourceFile.Path); 583var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path); 609[$"proj: {document2.FilePath}: (0,0)-(0,0): Error ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.Path)}"], 632AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path); 637var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path, checksumAlgorithm: SourceHashAlgorithms.Default); 646using var fileLock = File.Open(sourceFile.Path, FileMode.Open, FileAccess.Read, FileShare.None); 657[$"test: {document1.FilePath}: (0,0)-(0,0): Error ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.Path)}"], 691AddDocument("test.cs", CreateText(sourceA), filePath: sourceFileA.Path); 697EmitAndLoadLibraryToDebuggee(project.Id, sourceA, sourceFilePath: sourceFileA.Path); 707var documentB = project.AddTestDocument(sourceB, path: sourceFileB.Path); 756AddTestDocument(sourceA, sourceFileA.Path).Project. 757AddTestDocument(sourceB, sourceFileA.Path, out var documentBId).Project.Solution; 787AddTestDocument(source1, sourceFile1.Path, out var documentBId).Project.Solution; 798solution = solution.AddTestDocument(projectId, source2, sourceFile2.Path, out var document2Id).Project.Solution; 848var moduleId = EmitLibrary(project.Id, source1, sourceFilePath: sourceFile.Path); 855var document0 = project.AddTestDocument(source0, path: sourceFile.Path); 1003AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path); 1006var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source1, sourceFilePath: sourceFile.Path, encoding: encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256); 1231var moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.Path); 1237var document1 = project.AddTestDocument(source1, path: sourceFile.Path); 1272moduleId = EmitAndLoadLibraryToDebuggee(projectId, source0, sourceFilePath: sourceFile.Path); 1335AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path); 1340var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path); 1378AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path); 1383var moduleId = EmitLibrary(project.Id, source1, sourceFilePath: sourceFile.Path); 1994var mvidA = EmitAndLoadLibraryToDebuggee(projectAId, sourceA1, sourceFilePath: sourceFileA.Path, assemblyName: "A"); 1995var mvidB = EmitAndLoadLibraryToDebuggee(projectBId, sourceB1, sourceFilePath: sourceFileB.Path, assemblyName: "B"); 2006sourceFileA.Path, 2011sourceFileB.Path, 2021AddTestDocument(sourceB2, path: sourceFileB.Path); 2329AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.Path); 2338Assert.Equal(sourceFile.Path, filePath); 2346var moduleId = EmitAndLoadLibraryToDebuggee(documentId.ProjectId, source1, sourceFilePath: sourceFile.Path); 2375solution = solution.WithDocumentText(documentId, CreateTextFromFile(sourceFile.Path)); 2416AddDocument("test.cs", CreateText(source2), filePath: sourceFile.Path); 2423var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path); 2461$"{project.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)}" 2492var moduleId = EmitAndLoadLibraryToDebuggee(project.Id, source1, sourceFilePath: sourceFile.Path); 2515var document1 = project.AddDocument("test.cs", sourceText1, filePath: sourceFile.Path); 2550AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.Path); 2555var moduleId = EmitLibrary(project.Id, sourceOnDisk, sourceFilePath: sourceFile.Path); 2734_mockCompilationOutputs.Add(document1.Project.Id, new CompilationOutputFiles(moduleFile.Path, pdbFile.Path)); 3544_mockCompilationOutputs.Add(projectA.Id, new CompilationOutputFiles(moduleFileA.Path, pdbFileA.Path)); 3545_mockCompilationOutputs.Add(projectB.Id, new CompilationOutputFiles(moduleFileB.Path, pdbFileB.Path)); 3678var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).Path; 3775var sourcePath = dir.CreateFile("Lib.cs").WriteAllText(source1, Encoding.UTF8).Path; 4864var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.Path, assemblyName: "Proj"); 4870loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8), 4871filePath: sourceFileA.Path));
EditAndContinue\UnitTestingHotReloadServiceTests.cs (3)
39var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.Path, assemblyName: "Proj"); 47loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8), 48filePath: sourceFileA.Path));
EditAndContinue\WatchHotReloadServiceTests.cs (7)
66var moduleId = EmitLibrary(projectP.Id, source1, sourceFileA.Path, assemblyName: "Proj"); 72loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8), 73filePath: sourceFileA.Path)); 125[$"P: {sourceFileA.Path}: (0,17)-(0,18): Error ENC0110: {string.Format(FeaturesResources.Changing_the_signature_of_0_requires_restarting_the_application_because_it_is_not_supported_by_the_runtime, FeaturesResources.method)}"], 146[$"{sourceFileA.Path}: (0,72)-(0,73): Error CS1002: {CSharpResources.ERR_SemicolonExpected}"], 161$"{sourceFileA.Path}: (0,21)-(0,28): Error CS0103: {string.Format(CSharpResources.ERR_NameNotInContext, "Unknown")}", 162$"{sourceFileA.Path}: (0,51)-(0,52): Warning CS0219: {string.Format(CSharpResources.WRN_UnreferencedVarAssg, "x")}",
Microsoft.CodeAnalysis.LanguageServer.UnitTests (7)
ExportProviderBuilderTests.cs (2)
143var fileInfo = new FileInfo(tempFile.Path); 146return tempFile.Path;
VirtualProjectXmlProviderTests.cs (5)
73var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None); 98var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, logger, CancellationToken.None); 130var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None); 181var contentNullable = await projectProvider.GetVirtualProjectContentAsync(appFile.Path, LoggerFactory.CreateLogger<VirtualProjectXmlProviderTests>(), CancellationToken.None); 185Assert.Equal(appFile.Path, diagnostic.Location.Path);
Microsoft.CodeAnalysis.Scripting.Desktop.UnitTests (23)
MetadataShadowCopyProviderTests.cs (23)
88var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 89var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 91Assert.Equal(dll.Path, sc1.PrimaryModule.OriginalPath); 92Assert.NotEqual(dll.Path, sc1.PrimaryModule.FullPath); 96Assert.Equal(File.ReadAllBytes(dll.Path), File.ReadAllBytes(sc1.PrimaryModule.FullPath)); 97Assert.Equal(File.ReadAllBytes(doc.Path), File.ReadAllBytes(sc1.DocumentationFile.FullPath)); 105_provider.SuppressShadowCopy(dll.Path); 107var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 127var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 128Assert.NotEqual(dll.Path, sc1.PrimaryModule.FullPath); 140string path0 = dir.CreateFile("MultiModule.dll").WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).Path; 141string path1 = dir.CreateFile("mod2.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod2).Path; 142string path2 = dir.CreateFile("mod3.netmodule").WriteAllBytes(TestResources.SymbolsTests.MultiModule.mod3).Path; 186var f0 = Temp.CreateFile().WriteAllText("bogus").Path; 189string f1 = Temp.CreateFile().WriteAllBytes(TestResources.SymbolsTests.MultiModule.MultiModuleDll).Path; 200var sc1 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 201var sc2 = _provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 203var md1 = _provider.GetMetadata(dll.Path, MetadataImageKind.Assembly); 213var sc3a = _provider.GetMetadataShadowCopy(dll2.Path, MetadataImageKind.Module); 230var sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 236sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 242sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly); 248sc = provider.GetMetadataShadowCopy(dll.Path, MetadataImageKind.Assembly);
Microsoft.CodeAnalysis.Scripting.UnitTests (6)
RuntimeMetadataReferenceResolverTests.cs (6)
32packageResolver: new PackageResolver(ImmutableDictionary<string, ImmutableArray<string>>.Empty.Add("nuget:N/1.0", ImmutableArray.Create(assembly1.Path, assembly2.Path))), 38AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly1.Path, assembly2.Path); 44AssertEx.SetEqual(actualReferences.SelectAsArray(r => r.FilePath), assembly2.Path); 59AssertEx.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 (106)
AnalyzerAssemblyLoaderTests.cs (26)
576var deltaFile = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 577var gammaFile = tempDir.CreateDirectory("b").CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 688var deltaFile1 = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 690var gammaFile = tempSubDir.CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 691var deltaFile2 = tempSubDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 730var deltaFile = tempDir.CreateDirectory("a").CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 731var gammaFile = tempDir.CreateDirectory("b").CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 982var unregisteredDeltaPath = dir1.CopyFile(testFixture.Delta2).Path; 983var epsilonPath = dir1.CopyFile(testFixture.Epsilon).Path; 986var registeredDeltaPath = dir2.CopyFile(testFixture.Delta2).Path; 1040var epsilonFile = tempDir1.CreateFile("Epsilon.dll").CopyContentFrom(testFixture.Epsilon).Path; 1041var delta1File = tempDir1.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1042var delta2File = tempDir2.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta2).Path; 1280var deltaNewFilePath = dir.CopyFile(deltaFilePath).Path; 1294var assemblyFilePath = dir.CreateFile(assemblyName + ".dll").WriteAllBytes(array).Path; 1425var destFile = tempRoot.CreateDirectory().CreateOrOpenFile($"{assembly.GetName().Name}.dll").Path; 1460var deltaCopy = tempDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1485var deltaCopy = tempDir.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1520var delta1File = tempDir1.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta1).Path; 1521var delta2File = tempDir2.CreateFile("Delta.dll").CopyContentFrom(testFixture.Delta2).Path; 1522var gammaFile = tempDir3.CreateFile("Gamma.dll").CopyContentFrom(testFixture.Gamma).Path; 1576var path = tempFile.Path; 1611var analyzerPath = tempDir.CreateFile("AnalyzerWithLoc.dll").CopyContentFrom(testFixture.AnalyzerWithLoc).Path; 1612var analyzerResourcesPath = tempDir.CreateDirectory("en-GB").CreateFile("AnalyzerWithLoc.resources.dll").CopyContentFrom(testFixture.AnalyzerWithLocResourceEnGB).Path; 1634var analyzerPath = tempDir.CreateFile("AnalyzerWithLoc.dll").CopyContentFrom(testFixture.AnalyzerWithLoc).Path; 1635var analyzerResourcesPath = tempDir.CreateDirectory("es").CreateFile("AnalyzerWithLoc.resources.dll").CopyContentFrom(testFixture.AnalyzerWithLocResourceEnGB).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)
25").Path 28Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /warnaserror+ /warnaserror- /out:" & tempBinary.Path & " " & src & " > " & tempLog.Path, expectedRetCode:=0) 42CleanupAllGeneratedFiles(tempBinary.Path) 43CleanupAllGeneratedFiles(tempLog.Path) 57</text>.Value).Path 59Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /nowarn:41008 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 89</text>.Value).Path 91Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /nowarn:41008 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 121</text>.Value).Path 123Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /warnaserror-:42025 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 142CleanupAllGeneratedFiles(tempOut.Path) 156</text>.Value).Path 158Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /optionstrict:custom /warnaserror-:42025 /warnaserror+ " & src & " > " & tempOut.Path, expectedRetCode:=1) 177CleanupAllGeneratedFiles(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)
81"/analyzerconfig:" + analyzerConfig.Path, 82src.Path}) 84Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)) 118"/analyzerconfig:" + analyzerConfig.Path, 121"/additionalfile:" + additionalFile.Path, 122src.Path}) 124Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)) 176"/analyzerconfig:" + analyzerConfig.Path, 177src.Path}) 179Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths)) 185$"vbc : warning InvalidSeverityInAnalyzerConfig: The diagnostic 'bc42024' was given an invalid severity 'garbage' in the analyzer config file at '{analyzerConfig.Path}'. 186{src.Path}(4) : warning BC42024: Unused local variable: 'x'. 213"/analyzerconfig:" + analyzerConfig1.Path, 214"/analyzerconfig:" + analyzerConfig2.Path, 215src.Path 239Dim cmd = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.Path}) 258Dim cmd = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.Path}) 286</text>.Value).Path 332</text>.Value).Path 358").Path 470</text>.Value).Path 511</text>.Value).Path 529</text>.Value).Path 547</text>.Value).Path 588</text>.Value).Path 609Dim src As String = Temp.CreateFile().WriteAllText("♚", New System.Text.UTF8Encoding(False)).Path 613Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /t:library " & src & " > " & tempOut.Path, expectedRetCode:=1) 628Dim src As String = Temp.CreateFile().WriteAllText("♚", New System.Text.UTF8Encoding(False)).Path 632Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /utf8output /nologo /preferreduilang:en /t:library " & src & " > " & tempOut.Path, expectedRetCode:=1) 758</text>.Value).Path 780</text>.Value).Path 929/imports:System.Text</text>.Value).Path 991Dim tmpFileName As String = Temp.CreateFile().WriteAllBytes(New Byte() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}).Path 1010End Module").Path 1011Dim badres = Temp.CreateFile().WriteAllBytes(New Byte() {0, 0}).Path 2378CleanupAllGeneratedFiles(file1.Path) 2379CleanupAllGeneratedFiles(file2.Path) 2380CleanupAllGeneratedFiles(file3.Path) 2381CleanupAllGeneratedFiles(file4.Path) 2382CleanupAllGeneratedFiles(file5.Path) 2442CleanupAllGeneratedFiles(file1.Path) 2443CleanupAllGeneratedFiles(file2.Path) 2444CleanupAllGeneratedFiles(file3.Path) 2445CleanupAllGeneratedFiles(file4.Path) 2446CleanupAllGeneratedFiles(file5.Path) 2447CleanupAllGeneratedFiles(file6.Path) 2593CleanupAllGeneratedFiles(file.Path) 2610CleanupAllGeneratedFiles(file.Path) 2632CleanupAllGeneratedFiles(file.Path) 2656Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path}) 2666CleanupAllGeneratedFiles(file.Path) 2690"/ruleset:" & ruleSetFile.Path, "/warnaserror", "/nowarn:42376" 2704"/warnaserror+", "/ruleset:" & ruleSetFile.Path, "/nowarn:42376" 2713CleanupAllGeneratedFiles(file.Path) 2740"/ruleset:" & ruleSetFile.Path, "/nowarn" 2755"/nowarn", "/ruleset:" & ruleSetFile.Path 2765CleanupAllGeneratedFiles(file.Path) 2790Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path}) 2799CleanupAllGeneratedFiles(file.Path) 2823Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory) 2825Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath) 2848Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + """" + file.Path + """", "a.cs"}, _baseDirectory) 2850Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath) 2876parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory) 2879Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath) 2884Assert.Equal(file.Path, DirectCast(err.Arguments(0), String)) 3188AssertEx.Equal(File.ReadAllBytes(sl.Path), blob) 3192CleanupAllGeneratedFiles(src.Path) 3217AssertEx.Equal(File.ReadAllBytes(sl.Path), blob) 3220CleanupAllGeneratedFiles(src.Path) 3353expectedEmbeddedMap.Add(src.Path, embed_vb) 3357expectedEmbeddedMap.Add(src2.Path, embed2_vb) 3361expectedEmbeddedMap.Add(txt.Path, embed_xyz) 3380CleanupAllGeneratedFiles(src.Path) 3612CleanupAllGeneratedFiles(file.Path) 4103CleanupAllGeneratedFiles(src.Path) 4153CleanupAllGeneratedFiles(src.Path) 4154CleanupAllGeneratedFiles(xml.Path) 4234CleanupAllGeneratedFiles(src.Path) 4235CleanupAllGeneratedFiles(xml.Path) 4254CleanupAllGeneratedFiles(src.Path) 4273CleanupAllGeneratedFiles(src.Path) 4292CleanupAllGeneratedFiles(src.Path) 4311CleanupAllGeneratedFiles(src.Path) 4330CleanupAllGeneratedFiles(src.Path) 4349CleanupAllGeneratedFiles(src.Path) 4932Dim binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).Path 5009CleanupAllGeneratedFiles(src.Path) 5026CleanupAllGeneratedFiles(src.Path) 5033Dim filePath = tempFolder.CreateFile("temp.dll").Path 5054CleanupAllGeneratedFiles(src.Path) 5148CleanupAllGeneratedFiles(src.Path) 5180CleanupAllGeneratedFiles(src.Path) 5254File.Delete(sysRuntime.Path) 5260File.Delete(msCorLib.Path) 5262CleanupAllGeneratedFiles(src.Path) 5307File.Delete(msCorLib.Path) 5308CleanupAllGeneratedFiles(src.Path) 5341CleanupAllGeneratedFiles(src.Path) 5364CleanupAllGeneratedFiles(file.Path) 5767CleanupAllGeneratedFiles(file1.Path) 5768CleanupAllGeneratedFiles(file2.Path) 5952CleanupAllGeneratedFiles(file.Path) 6003CleanupAllGeneratedFiles(file.Path) 6042CleanupAllGeneratedFiles(file.Path) 6090CleanupAllGeneratedFiles(file.Path) 6134CleanupAllGeneratedFiles(file.Path) 6182CleanupAllGeneratedFiles(file.Path) 6228CleanupAllGeneratedFiles(file.Path) 6270CleanupAllGeneratedFiles(file.Path) 6274Return result.Value.Replace("PATH", file.Path).Replace("VERSION (HASH)", s_compilerVersion).Replace(vbLf, vbCrLf) 6306CleanupAllGeneratedFiles(file.Path) 6340CleanupAllGeneratedFiles(file.Path) 6374CleanupAllGeneratedFiles(file.Path) 6406CleanupAllGeneratedFiles(file.Path) 6438CleanupAllGeneratedFiles(file.Path) 6486CleanupAllGeneratedFiles(file.Path) 6823Path.GetFileName(sourceFile.Path) 6831String.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.Path)), 6832Path.GetFileName(sourceFile.Path) 6856CleanupAllGeneratedFiles(sourceFile.Path) 6871Dim source As String = folder.CreateFile("src.vb").WriteAllText("").Path 6872Dim ref As String = folder.CreateFile("ref.dll").WriteAllText("").Path 6904</text>.Value).Path 6908</text>.Value).Path 6952</text>.Value).Path 6956</text>.Value).Path 6986</text>.Value).Path 6990</text>.Value).Path 7020</text>.Value).Path 7024</text>.Value).Path 7049</text>.Value).Path 7054</text>.Value).Path 7073</text>.Value).Path 7241</text>.Value).Path 7262</text>.Value).Path 7299</text>.Value).Path 7454</text>.Value).Path 7552CleanupAllGeneratedFiles(src.Path) 7608file.Path & "(4) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. 7641" & file.Path & "(35) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level. 7649CleanupAllGeneratedFiles(file.Path) 7713CleanupAllGeneratedFiles(file.Path) 7732CleanupAllGeneratedFiles(file.Path) 7921sourceFile.Path 7996CleanupAllGeneratedFiles(file.Path) 8122CleanupAllGeneratedFiles(file.Path) 8277CleanupAllGeneratedFiles(file.Path) 8500CleanupAllGeneratedFiles(file.Path) 8577CleanupAllGeneratedFiles(file.Path) 8639CleanupAllGeneratedFiles(file.Path) 8688CleanupAllGeneratedFiles(src.Path) 8938</text>.Value).Path 8995</text>.Value).Path 9018</text>.Value).Path 9042</text>.Value).Path 9063</text>.Value).Path 9085</text>.Value).Path 9090</text>.Value).Path 9094</text>.Value).Path 9146CleanupAllGeneratedFiles(file.Path) 9560CleanupAllGeneratedFiles(sourceFile.Path) 9666Dim vbcPath = dir.CopyFile(s_basicCompilerExecutable).Path 9726End Class").Path 9732Dim filePath = Temp.CreateFile().WriteAllText("").Path 9789CleanupAllGeneratedFiles(file.Path) 9841CleanupAllGeneratedFiles(file.Path) 9867CleanupAllGeneratedFiles(file.Path) 9933CleanupAllGeneratedFiles(file.Path) 9961CleanupAllGeneratedFiles(file.Path) 10039additionalFlags = additionalFlags.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray() 10096additionalFlags = additionalFlags.Append("/ruleset:" + ruleSetFile.Path).ToArray() 10169Dim args = {"/nologo", "/t:library", "/preferreduilang:en", src.Path} 10209Dim args = {"/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.Path} 10288additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray() 10331Dim globalOption = "/analyzerconfig:" + globalConfig.Path 10332Dim specificOption = "/analyzerconfig:" + analyzerConfig.Path 10362additionalFlags = additionalFlags.Append("/analyzerconfig:" & globalConfig.Path).ToArray() 10394VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference:=False, additionalFlags:={"/warnaserror+", "/analyzerconfig:" + globalConfig.Path}) 10416additionalFlags:={"/additionalfile:" & additionalFile.Path}, 10491additionalArgs = additionalArgs.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray() 10563CleanupAllGeneratedFiles(src.Path) 10585CleanupAllGeneratedFiles(src.Path) 10612CleanupAllGeneratedFiles(src.Path) 10628CleanupAllGeneratedFiles(src.Path) 10703CleanupAllGeneratedFiles(src.Path) 10743"/analyzerconfig:" + analyzerConfig.Path, 10744src.Path}) 10786"/analyzerconfig:" + analyzerConfig.Path, 10787src.Path}) 10831"/analyzerconfig:" + analyzerConfig.Path, 10832src.Path}) 10879"/analyzerconfig:" + analyzerConfig.Path, 10880src.Path})
SarifErrorLoggerTests.vb (4)
47Dim hello = Temp.CreateFile().WriteAllText(helloWorldVB).Path 82Dim sourceFilePath = Temp.CreateFile().WriteAllText(source).Path 123Dim sourceFilePath = Temp.CreateFile().WriteAllText(source).Path 161Dim 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)
450<assembly: System.Reflection.AssemblyKeyFile("]]><%= snk.Path %><![CDATA[")> 457c = CreateCompilationWithMscorlib40(source1, options:=TestOptions.ReleaseModule.WithCryptoKeyFile(snk.Path).WithPublicSign(True), parseOptions:=parseOptions) 505options:=TestOptions.ReleaseDll.WithCryptoKeyFile(tmp.Path).WithStrongNameProvider(New DesktopStrongNameProvider()), 509Diagnostic(ERRID.ERR_PublicKeyFileFailure).WithArguments(tmp.Path, CodeAnalysisResources.InvalidPublicKey)) 1454Using peStream = New FileStream(file.Path, FileMode.Open) 2042Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2050Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2058Dim options = TestOptions.SigningReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2066Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2104Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2129Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True) 2143Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True).WithDelaySign(True) 2168Dim options = TestOptions.ReleaseDll.WithCryptoKeyFile(snk.Path).WithPublicSign(True).WithDelaySign(False)
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (2)
CommandLineRunnerTests.vb (2)
61Dim runner = CreateRunner(args:={}, input:="#r """ & file1.Path & """" & vbCrLf & "? New C1().Goo()") 66> #r """ & file1.Path & """
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Semantics\FieldInitializerBindingTests.vb (1)
1397reference = 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)
351Dim proj2AssemblyName = IO.Path.GetFileNameWithoutExtension(proj2ILFile.Path) 352Dim proj2Ref = MetadataReference.CreateFromImage(ReadFromFile(proj2ILFile.Path)) 402Dim proj1Ref = MetadataReference.CreateFromImage(ReadFromFile(proj1ILFile.Path)) 482Dim proj2AssemblyName = IO.Path.GetFileNameWithoutExtension(proj2ILFile.Path) 483Dim proj2Ref = MetadataReference.CreateFromImage(ReadFromFile(proj2ILFile.Path)) 526Dim proj1Ref = MetadataReference.CreateFromImage(ReadFromFile(proj1ILFile.Path)) 623Dim ilRef = MetadataReference.CreateFromImage(ReadFromFile(reference.Path)) 709Dim 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)
3872reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3956reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4051reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4109reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4178reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4247reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4332reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4397reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
SymbolsTests\Source\OverridesTests.vb (15)
2752reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3080reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3182reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3445reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3559reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3669reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3778reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 3890reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4000reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4108reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 4779reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5001reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5162reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5430reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path)) 5967reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
SymbolsTests\Source\TypeTests.vb (6)
3156ilBytes = ReadFromFile(reference.Path) 3222ilBytes = ReadFromFile(reference.Path) 3329ilBytes = ReadFromFile(reference.Path) 3336ilBytes = ReadFromFile(reference.Path) 3343ilBytes = ReadFromFile(reference.Path) 3374ilBytes = ReadFromFile(reference.Path)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
BasicTestBase.vb (1)
392reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
CompilationTestUtils.vb (1)
405ilImage = ImmutableArray.Create(File.ReadAllBytes(reference.Path))
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
VisualStudioMSBuildWorkspaceTests.cs (1)
3219var 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)); 3327.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8)); 3376.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8)); 3443.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8)); 4548var loader = new TestSmallFileTextLoader(file.Path, Encoding.UTF8); 4550var textLength = FileUtilities.GetFileLength(file.Path); 4552var 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)
980var info = SolutionInfo.Create(SolutionId.CreateNewId(), VersionStamp.Create(), solutionFile.Path); 989filePath: nullPaths ? null : projectFile.Path)); 994filePath: nullPaths ? null : documentFile.Path));
ProjectSystemShim\CPS\AnalyzersTests.cs (5)
39project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 63project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 66project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 80project.SetOptions([$"/ruleset:{ruleSetFile.Path}"]); 84Assert.Equal(ruleSetFile.Path, environment.Workspace.TryGetRuleSetPathForProject(projectId));
ProjectSystemShim\CPS\CSharpCompilerOptionsTests.cs (1)
163var newFilePath = Temp.CreateFile().Path;
ProjectSystemShim\CPS\CSharpReferencesTests.cs (1)
135var analyzerAssemblyFullPath = tempRoot.CreateFile().Path;
ProjectSystemShim\LegacyProject\AnalyzersTests.cs (14)
43((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 58((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 61Assert.Equal(ruleSetFile.Path, environment.Workspace.TryGetRuleSetPathForProject(projectId)); 77((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 108((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 131((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 146var pathWithExtraBackslashes = ruleSetFile.Path.Replace(@"\", @"\\"); 152Assert.Equal(expected: ruleSetFile.Path, actual: projectRuleSetFile); 174((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 209((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 236await CSharpHelpers.CreateCSharpCPSProjectAsync(environment, "Test", binOutputPath: @"C:\test.dll", $"/ruleset:\"{ruleSetFile.Path}\""); 242((IAnalyzerHost)project).SetRuleSetFile(ruleSetFile.Path); 251File.WriteAllText(ruleSetFile.Path, ruleSetSource.Replace("Error", "Warning")); 252await environment.RaiseFileChangeAsync(ruleSetFile.Path);
ProjectSystemShim\VisualStudioCompilationOutputFilesTests.cs (3)
40var debugDirPdbPath = exactPdbPath ? pdbFile.Path : "a/y/z/lib.pdb"; 50var outputs = new CompilationOutputFilesWithImplicitPdbPath(dllFile.Path); 95var 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")); 583.AddMetadataReference(MetadataReference.CreateFromFile(tempCorlib.Path)) 701return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.Path)));
Services\ServiceHubServicesTests.cs (2)
374p1, VersionStamp.Create(), "p1", "p1", LanguageNames.CSharp, outputFilePath: file.Path, 378metadataReferences: [MetadataReference.CreateFromFile(file.Path)])
VBCSCompiler.UnitTests (28)
AnalyzerConsistencyCheckerTests.cs (11)
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); 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;