1162 references to Path
InteractiveHost.UnitTests (35)
InteractiveHostDesktopTests.cs (30)
184var file = Temp.CreateFile().WriteAllText(MethodWithInfiniteLoop + "\r\nfoo();").Path;
203var file = Temp.CreateFile().WriteAllText("1 1").Path;
238").Path;
274await Host.ExecuteFileAsync(file.Path);
277Assert.True(errorOut.StartsWith(file.Path + "(1,7):", StringComparison.Ordinal), "Error output should start with file name, line and column");
465Assert.True(await LoadReference(file1.Path));
466Assert.True(await LoadReference(file2.Path));
510#r ""{file.Path}""
522#r ""{file.Path}""
553#r ""{file1.Path}""
554#r ""{file2.Path}""
564Assert.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.
588#r ""{file1.Path}""
589#r ""{file2.Path}""
706rspFile.WriteAllText($"/lib:{directory1.Path} /r:Assembly2.dll {initFile.Path}");
708await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, culture: CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
724{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))}
744rspFile.WriteAllText($"{initFile.Path}");
746await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, culture: CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
750@$"{initFile.Path}(1,1): error CS0006: {string.Format(CSharpResources.ERR_NoMetadataFile, "Assembly.dll")}", error);
771await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
804$@"{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))}
819{initFile.Path}
822await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
828AssertEx.AssertEqualToleratingWhitespaceDifferences($@"{initFile.Path}(1,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}
832{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))}
849await Host.ResetAsync(new InteractiveHostOptions(Host.OptionsOpt!.HostPath, rspFile.Path, CultureInfo.InvariantCulture, Host.OptionsOpt!.Platform));
854$@"{string.Format(InteractiveHostResources.Loading_context_from_0, Path.GetFileName(rspFile.Path))}
917#r """ + dll.Path + @"""
946await Execute($@"#r ""{libFile.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}}".
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (343)
CommandLineTests.cs (320)
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));
235"/analyzerconfig:" + analyzerConfig.Path,
238"/additionalfile:" + additionalFile.Path,
239src.Path });
241Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
288"/analyzerconfig:" + analyzerConfig.Path,
289src.Path });
291Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
297$@"warning InvalidSeverityInAnalyzerConfig: The diagnostic 'cs0169' was given an invalid severity 'garbage' in the analyzer config file at '{analyzerConfig.Path}'.
324"/analyzerconfig:" + analyzerConfig1.Path,
325"/analyzerconfig:" + analyzerConfig2.Path,
326src.Path
344var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", src.Path });
364var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/codepage:932", src.Path });
397").Path;
819string tmpFileName = Temp.CreateFile().WriteAllBytes(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }).Path;
1205CleanupAllGeneratedFiles(file1.Path);
1206CleanupAllGeneratedFiles(file2.Path);
1207CleanupAllGeneratedFiles(file3.Path);
1208CleanupAllGeneratedFiles(file4.Path);
1209CleanupAllGeneratedFiles(file5.Path);
2198AssertEx.Equal(File.ReadAllBytes(sl.Path), blob);
2203CleanupAllGeneratedFiles(src.Path);
2227AssertEx.Equal(File.ReadAllBytes(sl.Path), blob);
2231CleanupAllGeneratedFiles(src.Path);
2256CleanupAllGeneratedFiles(src.Path);
2376expectedEmbeddedMap.Add(src.Path, embed_cs);
2381expectedEmbeddedMap.Add(src2.Path, embed2_cs);
2386expectedEmbeddedMap.Add(txt.Path, embed_xyz);
2409CleanupAllGeneratedFiles(src.Path);
2674CleanupAllGeneratedFiles(file.Path);
2696CleanupAllGeneratedFiles(file.Path);
2721var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory);
2723Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath);
2747var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + "\"" + file.Path + "\"", "a.cs" }, WorkingDirectory);
2749Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath);
2776parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory);
2779Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath);
2784Assert.Equal(file.Path, (string)err.Arguments[0]);
2816CleanupAllGeneratedFiles(file.Path);
2844var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs", "/ruleset:" + ruleSetFile.Path });
2851CleanupAllGeneratedFiles(file.Path);
2881"/ruleset:" + ruleSetFile.Path, "/warnaserror+", "/nowarn:8032" });
2892"/warnaserror+", "/ruleset:" + ruleSetFile.Path, "/nowarn:8032" });
2899CleanupAllGeneratedFiles(file.Path);
3400"/ruleset:" + ruleSetFile.Path, "/warn:0" });
3411"/warn:0", "/ruleset:" + ruleSetFile.Path });
3418CleanupAllGeneratedFiles(file.Path);
4139var srcDirectory = Path.GetDirectoryName(srcFile.Path);
4150var silverlight = Temp.CreateFile().WriteAllBytes(ProprietaryTestResources.silverlight_v5_0_5_0.System_v5_0_5_0_silverlight).Path;
4151var net4_0dll = Temp.CreateFile().WriteAllBytes(ResourcesNet451.System).Path;
4159"/appconfig:" + appConfigFile.Path,
4160srcFile.Path }).Run(outWriter);
4164CleanupAllGeneratedFiles(srcFile.Path);
4165CleanupAllGeneratedFiles(appConfigFile.Path);
4172var srcDirectory = Path.GetDirectoryName(srcFile.Path);
4179srcFile.Path }).Run(outWriter);
4183CleanupAllGeneratedFiles(srcFile.Path);
4299var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/modulename:hocusPocus ", "/out:" + exeName + " ", file1.Path });
4324CleanupAllGeneratedFiles(file1.Path);
4568CleanupAllGeneratedFiles(src.Path);
4586CleanupAllGeneratedFiles(src.Path);
5674public class Mod { }").Path;
5679public class Mod { }").Path;
5684class Test { static void Main() {} }").Path;
5721string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"public static class Extensions { public static bool EB(this bool b) { return b; } }").Path;
5722string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").Path;
5741string source1 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Mod { }").Path;
5742string source2 = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class C { static void Main() {} }").Path;
5921var srcFile = Temp.CreateFile().WriteAllText("\u265A").Path;
5925var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.Path, expectedRetCode: 1);
5930CleanupAllGeneratedFiles(tempOut.Path);
5936var srcFile = Temp.CreateFile().WriteAllText("\u265A").Path;
5940var output = ProcessUtilities.RunAndGetOutput("cmd", "/C \"" + s_CSharpCompilerExecutable + "\" /utf8output /nologo /preferreduilang:en /t:library " + srcFile + " > " + tempOut.Path, expectedRetCode: 1);
5945CleanupAllGeneratedFiles(tempOut.Path);
5965CleanupAllGeneratedFiles(aCs.Path);
5979CleanupAllGeneratedFiles(aCs.Path);
5993CleanupAllGeneratedFiles(aCs.Path);
6093var kfile = "/keyfile:" + snkFile.Path;
6098parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698a.Path, "CS1698b.cs" }, WorkingDirectory);
6101parsedArgs = DefaultParse(new[] { "/t:library", kfile, "/r:" + cs1698b.Path, "/out:" + cs1698a.Path, "CS1698.cs" }, WorkingDirectory);
6111CleanupAllGeneratedFiles(snkFile.Path);
6112CleanupAllGeneratedFiles(cs1698a.Path);
6113CleanupAllGeneratedFiles(cs1698b.Path);
6114CleanupAllGeneratedFiles(cs1698.Path);
6120var binaryPath = Temp.CreateFile().WriteAllBytes(ResourcesNet451.mscorlib).Path;
6157var source = folder.CreateFile("src.vb").WriteAllText("").Path;
6158var _ref = folder.CreateFile("ref.dll").WriteAllText("").Path;
6205").Path;
6210").Path;
6229").Path;
6238").Path;
6243").Path;
6251").Path;
6257").Path;
6304").Path;
6309").Path;
6345").Path;
6351").Path;
6386").Path;
6392").Path;
6736CleanupAllGeneratedFiles(file.Path);
6760CleanupAllGeneratedFiles(file.Path);
6783CleanupAllGeneratedFiles(file.Path);
6811CleanupAllGeneratedFiles(file.Path);
6884CleanupAllGeneratedFiles(file1.Path);
6885CleanupAllGeneratedFiles(file2.Path);
6907CleanupAllGeneratedFiles(file.Path);
7007CleanupAllGeneratedFiles(file.Path);
7035CleanupAllGeneratedFiles(file.Path);
7063CleanupAllGeneratedFiles(file.Path);
7089CleanupAllGeneratedFiles(file.Path);
7115CleanupAllGeneratedFiles(file.Path);
7279CleanupAllGeneratedFiles(file.Path);
7318CleanupAllGeneratedFiles(file.Path);
7587Path.GetFileName(sourceFile.Path),
7597string.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.Path)),
7598Path.GetFileName(sourceFile.Path),
7640}").Path;
7644").Path;
7687}").Path;
7691").Path;
7721}").Path;
7725").Path;
7755}").Path;
7759").Path;
7795outWriter.ToString().Replace(Path.GetFileName(src.Path), "{FILE}").Trim());
7804CleanupAllGeneratedFiles(src.Path);
7810return Temp.CreateFile().WriteAllBytes(cscRsp).Path;
7949string OriginalSource = src.Path;
7959CleanupAllGeneratedFiles(src.Path);
8019CleanupAllGeneratedFiles(src.Path);
8062CleanupAllGeneratedFiles(src.Path);
8063CleanupAllGeneratedFiles(xml.Path);
8133CleanupAllGeneratedFiles(src.Path);
8134CleanupAllGeneratedFiles(xml.Path);
8173}").Path;
8310}").Path;
8349").Path;
8373").Path;
8407").Path;
8426string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").Path;
8427string badres = Temp.CreateFile().WriteAllBytes(TestResources.DiagnosticTests.badresfile).Path;
8451string source = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(@"class Test { static void Main() {} }").Path;
8452string badres = Temp.CreateFile().WriteAllBytes(new byte[] { 0, 0 }).Path;
8480}").Path;
8502} ").Path;
8546using (var stream = File.OpenWrite(exe.Path))
8553using (var stream = File.OpenWrite(pdb.Path))
8559int exitCode1 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source1.Path }).Run(outWriter);
8562ValidateZeroes(exe.Path, oldSize);
8563ValidateZeroes(pdb.Path, oldSize);
8565int exitCode2 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source2.Path }).Run(outWriter);
8568using (var peFile = File.OpenRead(exe.Path))
8570PdbValidation.ValidateDebugDirectory(peFile, null, pdb.Path, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false);
8573Assert.True(new FileInfo(exe.Path).Length < oldSize);
8574Assert.True(new FileInfo(pdb.Path).Length < oldSize);
8576int exitCode3 = CreateCSharpCompiler(null, dir.Path, new[] { "/debug:full", "/out:Program.exe", source3.Path }).Run(outWriter);
8579using (var peFile = File.OpenRead(exe.Path))
8581PdbValidation.ValidateDebugDirectory(peFile, null, pdb.Path, hashAlgorithm: default, hasEmbeddedPdb: false, isDeterministic: false);
8617var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8618var fsPdb = new FileStream(libPdb.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8621int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/debug:full", libSrc.Path }).Run(outWriter);
8629AssertEx.Equal(new byte[] { 0x4D, 0x5A }, ReadBytes(libDll.Path, 2));
8632AssertEx.Equal(new byte[] { 0x4D, 0x69 }, ReadBytes(libPdb.Path, 2));
8657var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8658var fsPdb = new FileStream(libPdb.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8667var output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $"/target:library /debug:portable \"{libSrc.Path}\"", startFolder: dir.ToString());
8683using (var fsNewDll = File.OpenRead(libDll.Path))
8689AssertEx.Equal(new[] { (byte)'B', (byte)'S', (byte)'J', (byte)'B' }, ReadBytes(libPdb.Path, 4));
8698File.Delete(libSrc.Path);
8699File.Delete(libDll.Path);
8700File.Delete(libPdb.Path);
8723File.SetAttributes(libDll.Path, FileAttributes.ReadOnly);
8725var fsDll = new FileStream(libDll.Path, FileMode.Open, FileAccess.Read, FileShare.Read | FileShare.Delete);
8728int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter);
8729Assert.Contains($"error CS2012: Cannot open '{libDll.Path}' for writing", outWriter.ToString());
8731AssertEx.Equal(new[] { (byte)'D', (byte)'L', (byte)'L' }, ReadBytes(libDll.Path, 3));
8747int exitCode = CreateCSharpCompiler(null, dir.Path, new[] { "/target:library", "/preferreduilang:en", libSrc.Path }).Run(outWriter);
8951} ").Path;
8995string sourcePath = Temp.CreateFile(prefix: "", extension: ".cs").WriteAllText(source).Path;
9020var sourcePath = Temp.CreateFile(directory: WorkingDirectory, extension: ".cs").WriteAllText(source).Path;
9093commandLineArgs = new[] { @"tmpDir\a.cs", tempFile.Path };
9104commandLineArgs = new[] { tempFile.Path, @"tmpDir\*.cs" };
9119commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, "tmpDir\a.cs" };
9124commandLineArgs = new[] { tempFile.Path, @"tmpDi\r*a?.cs" };
9133commandLineArgs = new[] { tempFile.Path, currentDrive + @":a.cs" };
9139commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, @":a.cs" };
9144CleanupAllGeneratedFiles(tempFile.Path);
9217var srcDirectory = Path.GetDirectoryName(srcFile.Path);
9223new[] { "/reportanalyzer", "/t:library", srcFile.Path },
9233CleanupAllGeneratedFiles(srcFile.Path);
9274var srcDirectory = Path.GetDirectoryName(srcFile.Path);
9276var args = new List<string>() { "/reportanalyzer", "/t:library", "/a:" + typeof(DoNothingGenerator).Assembly.Location, srcFile.Path };
9298CleanupAllGeneratedFiles(srcFile.Path);
9307var srcDirectory = Path.GetDirectoryName(srcFile.Path);
9316new[] { "/reportanalyzer", "/t:library", srcFile.Path },
9332CleanupAllGeneratedFiles(srcFile.Path);
9347workingDirectory: Path.GetDirectoryName(srcFile.Path),
9348args: new[] { "/errorlog:" + errorLog.Path, "/warnaserror+", "/nologo", "/t:library", srcFile.Path },
9358CleanupAllGeneratedFiles(srcFile.Path);
9359CleanupAllGeneratedFiles(errorLog.Path);
9367var srcDirectory = Path.GetDirectoryName(srcFile.Path);
9370var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path },
9384CleanupAllGeneratedFiles(srcFile.Path);
9392var srcDirectory = Path.GetDirectoryName(srcFile.Path);
9395var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", $"/warnaserror:{AnalyzerExecutor.AnalyzerExceptionDiagnosticId}", srcFile.Path },
9406CleanupAllGeneratedFiles(srcFile.Path);
9414var srcDirectory = Path.GetDirectoryName(srcFile.Path);
9417var csc = CreateCSharpCompiler(null, WorkingDirectory, new[] { "/t:library", srcFile.Path },
9428CleanupAllGeneratedFiles(srcFile.Path);
9521").Path;
9572DefaultParse(new[] { "/lib:" + invalidPath, sourceFile.Path }, WorkingDirectory).Errors.Verify(
9575DefaultParse(new[] { "/lib:" + nonExistentPath, sourceFile.Path }, WorkingDirectory).Errors.Verify(
9580DefaultParse(new[] { sourceFile.Path }, WorkingDirectory, additionalReferenceDirectories: invalidPath).Errors.Verify(
9583DefaultParse(new[] { sourceFile.Path }, WorkingDirectory, additionalReferenceDirectories: nonExistentPath).Errors.Verify(
9587CleanupAllGeneratedFiles(sourceFile.Path);
9613string filePath = Temp.CreateFile().WriteAllText(@"class C {}").Path;
9786string filePath = Temp.CreateFile().WriteAllText(source).Path;
9836string filePath = Temp.CreateFile().WriteAllText(source).Path;
9906CleanupAllGeneratedFiles(src.Path);
9964CleanupAllGeneratedFiles(src.Path);
10029CleanupAllGeneratedFiles(src.Path);
10134CleanupAllGeneratedFiles(src.Path);
10137void 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);
10230CleanupAllGeneratedFiles(src.Path);
10233void 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);
10266CleanupAllGeneratedFiles(src.Path);
10299sourceFile.Path
10396CleanupAllGeneratedFiles(file.Path);
10508CleanupAllGeneratedFiles(file.Path);
10651CleanupAllGeneratedFiles(file.Path);
10849CleanupAllGeneratedFiles(file.Path);
10933CleanupAllGeneratedFiles(file.Path);
11037CleanupAllGeneratedFiles(file.Path);
11136CleanupAllGeneratedFiles(src.Path);
11484var output = ProcessUtilities.RunAndGetOutput(csc32exe.Path, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir32.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir32.Path);
11487output = ProcessUtilities.RunAndGetOutput(s_CSharpCompilerExecutable, $@"/nologo /debug:full /deterministic /out:Program.exe /pathmap:""{dir64.Path}""=X:\ ""{sourceFile.Path}""", expectedRetCode: 0, startFolder: dir64.Path);
11758var cscPath = dir.CopyFile(s_CSharpCompilerExecutable).Path;
12171string filePath = Temp.CreateFile().WriteAllText("").Path;
12191string filePath = Temp.CreateFile().WriteAllText("").Path;
12254CleanupAllGeneratedFiles(srcFile.Path);
12316CleanupAllGeneratedFiles(srcFile.Path);
12372CleanupAllGeneratedFiles(srcFile.Path);
12395CleanupAllGeneratedFiles(srcFile.Path);
12421CleanupAllGeneratedFiles(srcFile.Path);
12488CleanupAllGeneratedFiles(srcFile.Path);
12516CleanupAllGeneratedFiles(srcFile.Path);
12758"/analyzerconfig:" + analyzerConfig.Path,
12759src.Path };
12778arguments = arguments.Append($"/ruleset:{rulesetFile.Path}");
12784Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
12876additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray();
12926additionalArgs = additionalArgs.Append("/ruleset:" + rulesetFile.Path).ToArray();
13010"/analyzerconfig:" + analyzerConfig.Path,
13011src.Path };
13025Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
13070output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13079output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13087output = VerifyOutput(dir, src, additionalFlags: new[] { "/nullable", "/analyzerconfig:" + analyzerConfig.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
13108var args = new[] { "/nologo", "/t:library", "/preferreduilang:en", src.Path };
13146var args = new[] { "/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.Path };
13200additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray();
13248CleanupAllGeneratedFiles(src.Path);
13303CleanupAllGeneratedFiles(src.Path);
13334CleanupAllGeneratedFiles(src.Path);
13371<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"" />
13417CleanupAllGeneratedFiles(src.Path);
13447CleanupAllGeneratedFiles(src.Path);
13481CleanupAllGeneratedFiles(src.Path);
13519CleanupAllGeneratedFiles(src.Path);
13550options: TestOptions.DebugDll.WithCryptoKeyFile(Path.GetFileName(snk.Path)).WithStrongNameProvider(virtualSnProvider),
13589CleanupAllGeneratedFiles(src.Path);
13610CleanupAllGeneratedFiles(src.Path);
13633CleanupAllGeneratedFiles(src.Path);
13702CleanupAllGeneratedFiles(src.Path);
13730CleanupAllGeneratedFiles(src.Path);
13749VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.Path }, generators: new[] { generator }, analyzers: null);
13812"/analyzerconfig:" + analyzerConfig1.Path,
13813"/analyzerconfig:" + analyzerConfig2.Path,
13814"/analyzerconfig:" + analyzerConfig3.Path,
13816src.Path
13880new[] { "/t:library", "/nologo", "/warnaserror+", src.Path },
13900new[] { "/t:library", "/nologo", "/nowarn:CS8785", src.Path },
13925new[] { "/t:library", "/nologo", "/warnaserror+", src.Path },
13945new[] { "/t:library", "/nologo", "/nowarn:CS8784", src.Path },
13980VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference: false, additionalFlags: new[] { "/additionalfile:" + additionalFile.Path, "/langversion:preview", "/out:embed.exe" }, generators: new[] { generator }, analyzers: null);
13983CleanupAllGeneratedFiles(src.Path);
14025new[] { "/nologo", "/t:library", srcFile.Path },
14031CleanupAllGeneratedFiles(srcFile.Path);
14054"/analyzerconfig:" + analyzerConfig1.Path,
14055"/analyzerconfig:" + analyzerConfig2.Path,
14056src.Path
14084var output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.Path + "," + analyzerConfig2.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
14103output = VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + analyzerConfig.Path + "," + analyzerConfig2.Path }, expectedWarningCount: 1, includeCurrentAssemblyAsAnalyzerReference: false);
14134"/analyzerconfig:" + analyzerConfig.Path,
14135"/analyzerconfig:" + globalConfig.Path,
14138"/additionalfile:" + additionalFile.Path,
14139src.Path });
14219additionalFlags: configs.SelectAsArray(c => "/analyzerconfig:" + c.Path)
14241VerifyOutput(dir, src, additionalFlags: new[] { "/warnaserror+", "/analyzerconfig:" + globalConfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false);
14264additionalFlags = additionalFlags.Append("/analyzerconfig:" + globalConfig.Path).ToArray();
14298[{PathUtilities.NormalizeWithForwardSlash(src.Path)}]
14302VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:0164", "/analyzerconfig:" + globalConfig.Path }, expectedErrorCount: 0, includeCurrentAssemblyAsAnalyzerReference: false);
14319VerifyOutput(dir, src, additionalFlags: new[] { "/analyzerconfig:" + globalConfig.Path }, expectedErrorCount: 1, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() });
14321VerifyOutput(dir, src, additionalFlags: new[] { "/nowarn:Warning01", "/analyzerconfig:" + globalConfig.Path }, includeCurrentAssemblyAsAnalyzerReference: false, analyzers: new[] { new WarningDiagnosticAnalyzer() });
14341additionalFlags: new[] { "/additionalfile:" + additionalFile.Path },
14422additionalArgs = additionalArgs.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray();
14543string path1 = additionalFile1.Path;
14544string path2 = additionalFile2?.Path ?? Path.Combine(srcDirectory.Path, additionalFilePath2);
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (6)
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (10)
Microsoft.CodeAnalysis.CSharp.Scripting.Desktop.UnitTests (31)
Microsoft.CodeAnalysis.CSharp.Scripting.UnitTests (43)
CommandLineRunnerTests.cs (22)
340""{script.Path}""
347args: new[] { $@"@""{rsp.Path}""", "/arg5", "--", "/arg7" },
371args: new[] { script.Path, "arg1", "arg2", "arg3" });
388args: new[] { script.Path, "@arg1", "@arg2", "@arg3" });
406{script.Path}
414args: new[] { $"@{rsp.Path}", "/arg5", "--", "/arg7" },
437args: new[] { "--", script.Path, "@arg1", "@arg2", "@arg3" });
523script.Path
614var runner = CreateRunner(new[] { $"/loadpath:{dir1.Path}", $"/loadpaths:{dir2.Path};{dir3.Path}", main.Path });
651var runner = CreateRunner(new[] { "/r:4.dll", $"/lib:{dir1.Path}", $"/libpath:{dir2.Path}", $"/libpaths:{dir3.Path};{dir4.Path}", main.Path });
751var csi = CreateRunner(new[] { "b.csx" }, responseFile: rsp.Path);
780var runner = CreateRunner(new[] { "/i", init.Path }, input:
800var runner = CreateRunner(new[] { $@"/r:""{reference.Path}""", "/i", init.Path }, input:
807{init.Path}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}
815$@"{init.Path}(2,3): error CS1002: {CSharpResources.ERR_SemicolonExpected}",
907$@"#r ""{file1.Path}""
909#r ""{file2.Path}""
916> #r ""{file1.Path}""
918> #r ""{file2.Path}""
921{string.Format(ScriptingResources.AssemblyAlreadyLoaded, libBaseName, "0.0.0.0", fileBase1.Path, fileBase2.Path)}
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (76)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (82)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (79)
513var sourceTreeA1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesA1, sourceBytesA1.Length, encodingA, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileA.Path);
514var sourceTreeB1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesB1, sourceBytesB1.Length, encodingB, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileB.Path);
515var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.Path);
536loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, encodingA),
537filePath: sourceFileA.Path));
543loader: new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB),
544filePath: sourceFileB.Path));
550loader: new WorkspaceFileTextLoader(solution.Services, sourceFileC.Path, encodingC),
551filePath: sourceFileC.Path));
557loader: new WorkspaceFileTextLoader(solution.Services, sourceFileE.Path, encodingE),
558filePath: sourceFileE.Path));
579filePath: sourceFileD.Path));
597solution = solution.WithDocumentTextLoader(documentIdB, new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB), PreservationMode.PreserveValue);
604AssertEx.Equal(new[] { $"{projectPId}: Warning ENC1005: {string.Format(FeaturesResources.DocumentIsOutOfSyncWithDebuggee, sourceFileB.Path)}" }, InspectDiagnostics(emitDiagnostics));
648solution = solution.WithProjectOutputFilePath(document.Project.Id, moduleFile.Path);
649_mockCompilationOutputsProvider = _ => new CompilationOutputFiles(moduleFile.Path);
719solution = solution.WithProjectOutputFilePath(document1.Project.Id, moduleFile.Path).AddDocument(documentInfo);
721_mockCompilationOutputsProvider = _ => new CompilationOutputFiles(moduleFile.Path);
795var sourceFilePath = dir.CreateFile(sourceFileName).WriteAllText(source, Encoding.UTF8).Path;
896using var stream = File.OpenRead(moduleFile.Path);
911_mockCompilationOutputsProvider = _ => new CompilationOutputFiles(moduleFile.Path);
931AssertEx.Equal(new[] { $"{document2.Project.Id}: Error ENC1001: {string.Format(FeaturesResources.ErrorReadingFile, moduleFile.Path, expectedErrorMessage)}" }, InspectDiagnostics(emitDiagnostics));
982AddDocument("a.cs", CreateText(source1), filePath: sourceFile.Path);
987var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
1012AssertEx.Equal(new[] { $"{project.Id}: Warning ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.Path)}" }, InspectDiagnostics(emitDiagnostics));
1035AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path);
1040var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path, checksumAlgorithm: SourceHashAlgorithms.Default);
1049using var fileLock = File.Open(sourceFile.Path, FileMode.Open, FileAccess.Read, FileShare.None);
1059AssertEx.Equal(new[] { $"{project.Id}: Warning ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.Path)}" }, InspectDiagnostics(emitDiagnostics));
1094AddDocument("test.cs", CreateText(sourceA), filePath: sourceFileA.Path);
1099EmitAndLoadLibraryToDebuggee(sourceA, sourceFilePath: sourceFileA.Path);
1111var documentB = project.AddDocument("file2.cs", CreateText(sourceB), filePath: sourceFileB.Path);
1184var moduleId = EmitLibrary(source1, sourceFilePath: sourceFile.Path);
1191var document0 = project.AddDocument("a.cs", CreateText(source0), filePath: sourceFile.Path);
1346AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path);
1349var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path, encoding: encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256);
1573var moduleId = EmitAndLoadLibraryToDebuggee(source0, sourceFilePath: sourceFile.Path);
1579var document1 = project.AddDocument("a.cs", CreateText(source1), filePath: sourceFile.Path);
1601AssertEx.Equal(new[] { $"{project.Id}: Warning ENC1005: {string.Format(FeaturesResources.DocumentIsOutOfSyncWithDebuggee, sourceFile.Path)}" }, InspectDiagnostics(emitDiagnostics));
1677AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path);
1682var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
1721AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path);
1726var moduleId = EmitLibrary(source1, sourceFilePath: sourceFile.Path);
2091var mvidA = EmitAndLoadLibraryToDebuggee(sourceA1, sourceFilePath: sourceFileA.Path, assemblyName: "A");
2092var mvidB = EmitAndLoadLibraryToDebuggee(sourceB1, sourceFilePath: sourceFileB.Path, assemblyName: "B");
2103sourceFileA.Path,
2108sourceFileB.Path,
2118AddDocument("b.cs", CreateText(sourceB2), filePath: sourceFileB.Path);
2431AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.Path);
2440Assert.Equal(sourceFile.Path, filePath);
2448var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
2477solution = solution.WithDocumentText(documentId, CreateTextFromFile(sourceFile.Path));
2519AddDocument("test.cs", CreateText(source2), filePath: sourceFile.Path);
2526var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
2545AssertEx.Equal(new[] { $"{project.Id}: Warning ENC1005: {string.Format(FeaturesResources.DocumentIsOutOfSyncWithDebuggee, sourceFile.Path)}" }, InspectDiagnostics(emitDiagnostics));
2590var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
2613var document1 = project.AddDocument("test.cs", sourceText1, filePath: sourceFile.Path);
2649AddDocument("test.cs", CreateText("class C1 { void M() { System.Console.WriteLine(0); } }"), filePath: sourceFile.Path);
2654var moduleId = EmitLibrary(sourceOnDisk, sourceFilePath: sourceFile.Path);
2834_mockCompilationOutputsProvider = _ => new CompilationOutputFiles(moduleFile.Path, pdbFile.Path);
3349(project.Id == projectA.Id) ? new CompilationOutputFiles(moduleFileA.Path, pdbFileA.Path) :
3350(project.Id == projectB.Id) ? new CompilationOutputFiles(moduleFileB.Path, pdbFileB.Path) :
4466var moduleId = EmitLibrary(source1, sourceFileA.Path, assemblyName: "Proj");
4480loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8),
4481filePath: sourceFileA.Path));
4552var moduleId = EmitLibrary(source1, sourceFileA.Path, assemblyName: "Proj");
4567loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8),
4568filePath: sourceFileA.Path));
4620var moduleId = EmitLibrary(source1, sourceFileA.Path, assemblyName: "Proj");
4634loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, Encoding.UTF8),
4635filePath: sourceFileA.Path));
4699loader: new WorkspaceFileTextLoader(workspace.Services.SolutionServices, sourceFile.Path, Encoding.UTF8),
4700filePath: sourceFile.Path));
4705var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
4709File.WriteAllText(sourceFile.Path, source2, Encoding.UTF8);
4722Assert.Equal(sourceFile.Path, key);
Microsoft.CodeAnalysis.LanguageServerIndexFormat.Generator.UnitTests (1)
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)
Microsoft.CodeAnalysis.Test.Utilities (10)
Microsoft.CodeAnalysis.UnitTests (102)
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 },
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]);
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);
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (208)
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)
CommandLineTests.vb (182)
80"/analyzerconfig:" + analyzerConfig.Path,
81src.Path})
83Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths))
117"/analyzerconfig:" + analyzerConfig.Path,
120"/additionalfile:" + additionalFile.Path,
121src.Path})
123Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths))
175"/analyzerconfig:" + analyzerConfig.Path,
176src.Path})
178Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths))
184$"vbc : warning InvalidSeverityInAnalyzerConfig: The diagnostic 'bc42024' was given an invalid severity 'garbage' in the analyzer config file at '{analyzerConfig.Path}'.
185{src.Path}(4) : warning BC42024: Unused local variable: 'x'.
212"/analyzerconfig:" + analyzerConfig1.Path,
213"/analyzerconfig:" + analyzerConfig2.Path,
214src.Path
238Dim cmd = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.Path})
257Dim cmd = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.Path})
285</text>.Value).Path
331</text>.Value).Path
357").Path
469</text>.Value).Path
510</text>.Value).Path
528</text>.Value).Path
546</text>.Value).Path
587</text>.Value).Path
608Dim src As String = Temp.CreateFile().WriteAllText("♚", New System.Text.UTF8Encoding(False)).Path
612Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /nologo /preferreduilang:en /t:library " & src & " > " & tempOut.Path, expectedRetCode:=1)
627Dim src As String = Temp.CreateFile().WriteAllText("♚", New System.Text.UTF8Encoding(False)).Path
631Dim output = ProcessUtilities.RunAndGetOutput("cmd", "/C """ & s_basicCompilerExecutable & """ /utf8output /nologo /preferreduilang:en /t:library " & src & " > " & tempOut.Path, expectedRetCode:=1)
757</text>.Value).Path
779</text>.Value).Path
928/imports:System.Text</text>.Value).Path
990Dim tmpFileName As String = Temp.CreateFile().WriteAllBytes(New Byte() {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}).Path
1009End Module").Path
1010Dim badres = Temp.CreateFile().WriteAllBytes(New Byte() {0, 0}).Path
2386CleanupAllGeneratedFiles(file1.Path)
2387CleanupAllGeneratedFiles(file2.Path)
2388CleanupAllGeneratedFiles(file3.Path)
2389CleanupAllGeneratedFiles(file4.Path)
2390CleanupAllGeneratedFiles(file5.Path)
2450CleanupAllGeneratedFiles(file1.Path)
2451CleanupAllGeneratedFiles(file2.Path)
2452CleanupAllGeneratedFiles(file3.Path)
2453CleanupAllGeneratedFiles(file4.Path)
2454CleanupAllGeneratedFiles(file5.Path)
2455CleanupAllGeneratedFiles(file6.Path)
2601CleanupAllGeneratedFiles(file.Path)
2618CleanupAllGeneratedFiles(file.Path)
2640CleanupAllGeneratedFiles(file.Path)
2664Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path})
2674CleanupAllGeneratedFiles(file.Path)
2698"/ruleset:" & ruleSetFile.Path, "/warnaserror", "/nowarn:42376"
2712"/warnaserror+", "/ruleset:" & ruleSetFile.Path, "/nowarn:42376"
2721CleanupAllGeneratedFiles(file.Path)
2748"/ruleset:" & ruleSetFile.Path, "/nowarn"
2763"/nowarn", "/ruleset:" & ruleSetFile.Path
2773CleanupAllGeneratedFiles(file.Path)
2798Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path})
2807CleanupAllGeneratedFiles(file.Path)
2831Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory)
2833Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath)
2856Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + """" + file.Path + """", "a.cs"}, _baseDirectory)
2858Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath)
2884parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory)
2887Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath)
2892Assert.Equal(file.Path, DirectCast(err.Arguments(0), String))
3196AssertEx.Equal(File.ReadAllBytes(sl.Path), blob)
3200CleanupAllGeneratedFiles(src.Path)
3225AssertEx.Equal(File.ReadAllBytes(sl.Path), blob)
3228CleanupAllGeneratedFiles(src.Path)
3361expectedEmbeddedMap.Add(src.Path, embed_vb)
3365expectedEmbeddedMap.Add(src2.Path, embed2_vb)
3369expectedEmbeddedMap.Add(txt.Path, embed_xyz)
3388CleanupAllGeneratedFiles(src.Path)
3620CleanupAllGeneratedFiles(file.Path)
4111CleanupAllGeneratedFiles(src.Path)
4161CleanupAllGeneratedFiles(src.Path)
4162CleanupAllGeneratedFiles(xml.Path)
4242CleanupAllGeneratedFiles(src.Path)
4243CleanupAllGeneratedFiles(xml.Path)
4262CleanupAllGeneratedFiles(src.Path)
4281CleanupAllGeneratedFiles(src.Path)
4300CleanupAllGeneratedFiles(src.Path)
4319CleanupAllGeneratedFiles(src.Path)
4338CleanupAllGeneratedFiles(src.Path)
4357CleanupAllGeneratedFiles(src.Path)
4940Dim binaryPath = Temp.CreateFile().WriteAllBytes(TestMetadata.ResourcesNet451.mscorlib).Path
5017CleanupAllGeneratedFiles(src.Path)
5034CleanupAllGeneratedFiles(src.Path)
5128CleanupAllGeneratedFiles(src.Path)
5160CleanupAllGeneratedFiles(src.Path)
5234File.Delete(sysRuntime.Path)
5240File.Delete(msCorLib.Path)
5242CleanupAllGeneratedFiles(src.Path)
5287File.Delete(msCorLib.Path)
5288CleanupAllGeneratedFiles(src.Path)
5321CleanupAllGeneratedFiles(src.Path)
5344CleanupAllGeneratedFiles(file.Path)
5747CleanupAllGeneratedFiles(file1.Path)
5748CleanupAllGeneratedFiles(file2.Path)
5932CleanupAllGeneratedFiles(file.Path)
5983CleanupAllGeneratedFiles(file.Path)
6022CleanupAllGeneratedFiles(file.Path)
6070CleanupAllGeneratedFiles(file.Path)
6114CleanupAllGeneratedFiles(file.Path)
6162CleanupAllGeneratedFiles(file.Path)
6208CleanupAllGeneratedFiles(file.Path)
6250CleanupAllGeneratedFiles(file.Path)
6254Return result.Value.Replace("PATH", file.Path).Replace("VERSION (HASH)", s_compilerVersion).Replace(vbLf, vbCrLf)
6286CleanupAllGeneratedFiles(file.Path)
6320CleanupAllGeneratedFiles(file.Path)
6354CleanupAllGeneratedFiles(file.Path)
6386CleanupAllGeneratedFiles(file.Path)
6418CleanupAllGeneratedFiles(file.Path)
6466CleanupAllGeneratedFiles(file.Path)
6803Path.GetFileName(sourceFile.Path)
6811String.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.Path)),
6812Path.GetFileName(sourceFile.Path)
6836CleanupAllGeneratedFiles(sourceFile.Path)
6851Dim source As String = folder.CreateFile("src.vb").WriteAllText("").Path
6852Dim ref As String = folder.CreateFile("ref.dll").WriteAllText("").Path
6884</text>.Value).Path
6888</text>.Value).Path
6932</text>.Value).Path
6936</text>.Value).Path
6966</text>.Value).Path
6970</text>.Value).Path
7000</text>.Value).Path
7004</text>.Value).Path
7029</text>.Value).Path
7034</text>.Value).Path
7053</text>.Value).Path
7119Return Temp.CreateFile().WriteAllBytes(GetType(CommandLineTests).Assembly.GetManifestResourceStream("vbc.rsp").ReadAllBytes()).Path
7221</text>.Value).Path
7242</text>.Value).Path
7279</text>.Value).Path
7434</text>.Value).Path
7532CleanupAllGeneratedFiles(src.Path)
7588file.Path & "(4) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level.
7621" & file.Path & "(35) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level.
7629CleanupAllGeneratedFiles(file.Path)
7818sourceFile.Path
7893CleanupAllGeneratedFiles(file.Path)
8019CleanupAllGeneratedFiles(file.Path)
8174CleanupAllGeneratedFiles(file.Path)
8397CleanupAllGeneratedFiles(file.Path)
8474CleanupAllGeneratedFiles(file.Path)
8536CleanupAllGeneratedFiles(file.Path)
8585CleanupAllGeneratedFiles(src.Path)
8835</text>.Value).Path
8892</text>.Value).Path
8915</text>.Value).Path
8939</text>.Value).Path
8960</text>.Value).Path
8982</text>.Value).Path
8987</text>.Value).Path
8991</text>.Value).Path
9043CleanupAllGeneratedFiles(file.Path)
9457CleanupAllGeneratedFiles(sourceFile.Path)
9563Dim vbcPath = dir.CopyFile(s_basicCompilerExecutable).Path
9623End Class").Path
9629Dim filePath = Temp.CreateFile().WriteAllText("").Path
9686CleanupAllGeneratedFiles(file.Path)
9738CleanupAllGeneratedFiles(file.Path)
9764CleanupAllGeneratedFiles(file.Path)
9830CleanupAllGeneratedFiles(file.Path)
9858CleanupAllGeneratedFiles(file.Path)
9936additionalFlags = additionalFlags.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray()
9993additionalFlags = additionalFlags.Append("/ruleset:" + ruleSetFile.Path).ToArray()
10065Dim args = {"/nologo", "/t:library", "/preferreduilang:en", src.Path}
10103Dim args = {"/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.Path}
10149additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray()
10192Dim globalOption = "/analyzerconfig:" + globalConfig.Path
10193Dim specificOption = "/analyzerconfig:" + analyzerConfig.Path
10223additionalFlags = additionalFlags.Append("/analyzerconfig:" & globalConfig.Path).ToArray()
10255VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference:=False, additionalFlags:={"/warnaserror+", "/analyzerconfig:" + globalConfig.Path})
10277additionalFlags:={"/additionalfile:" & additionalFile.Path},
10352additionalArgs = additionalArgs.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray()
10424CleanupAllGeneratedFiles(src.Path)
10446CleanupAllGeneratedFiles(src.Path)
10473CleanupAllGeneratedFiles(src.Path)
10489CleanupAllGeneratedFiles(src.Path)
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (18)
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (2)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (8)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (47)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (9)
SolutionTests\SolutionTests.cs (8)
1123solution = solution.AddDocument(DocumentInfo.Create(fileDocumentId, "d.cs", loader: new FileTextLoader(fileD.Path, defaultEncoding: null), filePath: fileD.Path));
2653.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8));
2712.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8));
2779.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8));
3753var loader = new TestSmallFileTextLoader(file.Path, Encoding.UTF8);
3755var textLength = FileUtilities.GetFileLength(file.Path);
3757var 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)
Microsoft.VisualStudio.LanguageServices.UnitTests (7)
Roslyn.VisualStudio.Next.UnitTests (11)
Remote\SnapshotSerializationTests.cs (9)
426var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
447var reference = new AnalyzerFileReference(location, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(location, file.Path)));
484var analyzer1 = new AnalyzerFileReference(file1.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);
485var analyzer2 = new AnalyzerFileReference(file2.Path, TestAnalyzerAssemblyLoader.LoadNotImplemented);
493AssertEx.Equal(new[] { file1.Path, file2.Path }, recovered.GetProject(project.Id).AnalyzerReferences.Select(r => r.FullPath));
565var tempCorlibXml = tempDir.CreateFile(Path.ChangeExtension(tempCorlib.Path, "xml"));
581.AddMetadataReference(MetadataReference.CreateFromFile(tempCorlib.Path))
703return new AnalyzerFileReference(original, new MockShadowCopyAnalyzerAssemblyLoader(ImmutableDictionary<string, string>.Empty.Add(original, shadow.Path)));
VBCSCompiler.UnitTests (21)