916 references to Path
InteractiveHost.UnitTests (37)
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 (32)
CopyRefAssemblyTests.cs (22)
47File.WriteAllText(file.Path, "");
52SourcePath = file.Path,
65File.WriteAllText(file.Path, "test");
71SourcePath = file.Path,
76AssertEx.AssertEqualToleratingWhitespaceDifferences($$"""Copying reference assembly from "{{file.Path}}" to "{{dest}}".""", engine.Log);
85File.WriteAllText(source.Path, "test");
87File.WriteAllText(dest.Path, "dest");
92SourcePath = source.Path,
93DestinationPath = dest.Path,
99Could not extract the MVID from "{{source.Path}}". Are you sure it is a reference assembly?
100Copying reference assembly from "{{source.Path}}" to "{{dest}}".
104Assert.Equal("test", File.ReadAllText(dest.Path));
112File.WriteAllBytes(source.Path, TestResources.General.MVID1);
113var sourceTimestamp = File.GetLastWriteTimeUtc(source.Path).ToString("O");
116File.WriteAllBytes(dest.Path, TestResources.General.MVID2);
117var destTimestamp = File.GetLastWriteTimeUtc(dest.Path).ToString("O");
123SourcePath = source.Path,
124DestinationPath = dest.Path,
130Source reference assembly "{{source.Path}}" (timestamp "{{sourceTimestamp}}", MVID "f851dda2-6ea3-475e-8c0d-19bd3c4d9437") differs from destination "{{dest.Path}}" (timestamp "{{destTimestamp}}", MVID "8e1ed25b-2980-4f32-9dee-c1e3b0a57c4b").
131Copying reference assembly from "{{source.Path}}" to "{{dest.Path}}".
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (93)
CommandLineTests.cs (59)
146var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/errorlog:errorlog", $"/doc:{docName}", "/warnaserror", src.Path });
166var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/t:library", "/preferreduilang:en", $"/doc:{docName}", src.Path });
199"/analyzerconfig:" + analyzerConfig.Path,
200src.Path });
202Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
242"/analyzerconfig:" + modifyPath(editorconfig.Path, doubleSlashAnalyzerConfig),
243modifyPath(src.Path, doubleSlashSource),
291"/analyzerconfig:" + analyzerConfig.Path,
294"/additionalfile:" + additionalFile.Path,
295src.Path });
297Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
344"/analyzerconfig:" + analyzerConfig.Path,
345src.Path });
347Assert.Equal(analyzerConfig.Path, Assert.Single(cmd.Arguments.AnalyzerConfigPaths));
353$@"warning InvalidSeverityInAnalyzerConfig: The diagnostic 'cs0169' was given an invalid severity 'garbage' in the analyzer config file at '{analyzerConfig.Path}'.
380"/analyzerconfig:" + analyzerConfig1.Path,
381"/analyzerconfig:" + analyzerConfig2.Path,
382src.Path
400var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", src.Path });
420var cmd = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/codepage:932", src.Path });
453").Path;
875string tmpFileName = Temp.CreateFile().WriteAllBytes(new byte[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }).Path;
1261CleanupAllGeneratedFiles(file1.Path);
1262CleanupAllGeneratedFiles(file2.Path);
1263CleanupAllGeneratedFiles(file3.Path);
1264CleanupAllGeneratedFiles(file4.Path);
1265CleanupAllGeneratedFiles(file5.Path);
2262AssertEx.Equal(File.ReadAllBytes(sl.Path), blob);
2267CleanupAllGeneratedFiles(src.Path);
2291AssertEx.Equal(File.ReadAllBytes(sl.Path), blob);
2295CleanupAllGeneratedFiles(src.Path);
2320CleanupAllGeneratedFiles(src.Path);
2440expectedEmbeddedMap.Add(src.Path, embed_cs);
2445expectedEmbeddedMap.Add(src2.Path, embed2_cs);
2450expectedEmbeddedMap.Add(txt.Path, embed_xyz);
2473CleanupAllGeneratedFiles(src.Path);
2838var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory);
2840Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath);
2864var parsedArgs = DefaultParse(new string[] { @"/ruleset:" + "\"" + file.Path + "\"", "a.cs" }, WorkingDirectory);
2866Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath);
2893parsedArgs = DefaultParse(new string[] { @"/ruleset:" + file.Path, "a.cs" }, WorkingDirectory);
2896Assert.Equal(expected: file.Path, actual: parsedArgs.RuleSetPath);
2901Assert.Equal(file.Path, (string)err.Arguments[0]);
2961var csc = CreateCSharpCompiler(null, dir.Path, new[] { "/nologo", "/preferreduilang:en", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.cs", "/ruleset:" + ruleSetFile.Path });
2998"/ruleset:" + ruleSetFile.Path, "/warnaserror+", "/nowarn:8032" });
3009"/warnaserror+", "/ruleset:" + ruleSetFile.Path, "/nowarn:8032" });
3517"/ruleset:" + ruleSetFile.Path, "/warn:0" });
3528"/warn:0", "/ruleset:" + ruleSetFile.Path });
9314commandLineArgs = new[] { @"tmpDir\a.cs", tempFile.Path };
9325commandLineArgs = new[] { tempFile.Path, @"tmpDir\*.cs" };
9340commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, "tmpDir\a.cs" };
9345commandLineArgs = new[] { tempFile.Path, @"tmpDi\r*a?.cs" };
9354commandLineArgs = new[] { tempFile.Path, currentDrive + @":a.cs" };
9360commandLineArgs = new[] { "/preferreduilang:en", tempFile.Path, @":a.cs" };
9365CleanupAllGeneratedFiles(tempFile.Path);
10566sourceFile.Path
13423arguments = arguments.Append($"/ruleset:{rulesetFile.Path}");
13571additionalArgs = additionalArgs.Append("/ruleset:" + rulesetFile.Path).ToArray();
13888additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray();
Microsoft.CodeAnalysis.CSharp.Emit.UnitTests (6)
Microsoft.CodeAnalysis.CSharp.Emit3.UnitTests (10)
Microsoft.CodeAnalysis.CSharp.Features.UnitTests (1)
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)}
Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests (76)
Microsoft.CodeAnalysis.CSharp.Test.Utilities (1)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (8)
Microsoft.CodeAnalysis.Features.UnitTests (48)
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (45)
67var sourceTreeA1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesA1, sourceBytesA1.Length, encodingA, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileA.Path);
68var sourceTreeB1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesB1, sourceBytesB1.Length, encodingB, SourceHashAlgorithms.Default), TestOptions.Regular, sourceFileB.Path);
69var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.Path);
89loader: new WorkspaceFileTextLoader(solution.Services, sourceFileA.Path, encodingA),
90filePath: sourceFileA.Path));
96loader: new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB),
97filePath: sourceFileB.Path));
103loader: new WorkspaceFileTextLoader(solution.Services, sourceFileC.Path, encodingC),
104filePath: sourceFileC.Path));
110loader: new WorkspaceFileTextLoader(solution.Services, sourceFileE.Path, encodingE),
111filePath: sourceFileE.Path));
132filePath: sourceFileD.Path));
150solution = solution.WithDocumentTextLoader(documentIdB, new WorkspaceFileTextLoader(solution.Services, sourceFileB.Path, encodingB), PreservationMode.PreserveValue);
157AssertEx.Equal([$"P.csproj: (0,0)-(0,0): Warning ENC1005: {string.Format(FeaturesResources.DocumentIsOutOfSyncWithDebuggee, sourceFileB.Path)}"], InspectDiagnostics(emitDiagnostics));
201solution = solution.WithProjectOutputFilePath(document.Project.Id, moduleFile.Path);
202_mockCompilationOutputsProvider = _ => new CompilationOutputFiles(moduleFile.Path);
312solution = solution.WithProjectOutputFilePath(document1.Project.Id, moduleFile.Path).AddDocument(documentInfo);
314_mockCompilationOutputsProvider = _ => new CompilationOutputFiles(moduleFile.Path);
387var sourceFilePath = dir.CreateFile(sourceFileName).WriteAllText(source, Encoding.UTF8).Path;
485using var stream = File.OpenRead(moduleFile.Path);
500_mockCompilationOutputsProvider = _ => new CompilationOutputFiles(moduleFile.Path);
520AssertEx.Equal([$"proj.csproj: (0,0)-(0,0): Error ENC1001: {string.Format(FeaturesResources.ErrorReadingFile, moduleFile.Path, expectedErrorMessage)}"], InspectDiagnostics(emitDiagnostics));
569AddDocument("a.cs", CreateText(source1), filePath: sourceFile.Path);
574var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
599AssertEx.Equal([$"proj.csproj: (0,0)-(0,0): Warning ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.Path)}"], InspectDiagnostics(emitDiagnostics));
622AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path);
627var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path, checksumAlgorithm: SourceHashAlgorithms.Default);
636using var fileLock = File.Open(sourceFile.Path, FileMode.Open, FileAccess.Read, FileShare.None);
646AssertEx.Equal([$"test.csproj: (0,0)-(0,0): Warning ENC1006: {string.Format(FeaturesResources.UnableToReadSourceFileOrPdb, sourceFile.Path)}"], InspectDiagnostics(emitDiagnostics));
680AddDocument("test.cs", CreateText(sourceA), filePath: sourceFileA.Path);
685EmitAndLoadLibraryToDebuggee(sourceA, sourceFilePath: sourceFileA.Path);
697var documentB = project.AddTestDocument(sourceB, path: sourceFileB.Path);
769var moduleId = EmitLibrary(source1, sourceFilePath: sourceFile.Path);
776var document0 = project.AddTestDocument(source0, path: sourceFile.Path);
922AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path);
925var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path, encoding: encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256);
1144var moduleId = EmitAndLoadLibraryToDebuggee(source0, sourceFilePath: sourceFile.Path);
1150var document1 = project.AddTestDocument(source1, path: sourceFile.Path);
1172AssertEx.Equal([$"proj.csproj: (0,0)-(0,0): Warning ENC1005: {string.Format(FeaturesResources.DocumentIsOutOfSyncWithDebuggee, sourceFile.Path)}"], InspectDiagnostics(emitDiagnostics));
1244AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path);
1249var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
1287AddDocument("test.cs", CreateText(source1), filePath: sourceFile.Path);
1292var moduleId = EmitLibrary(source1, sourceFilePath: sourceFile.Path);
1348var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path);
1396moduleId = EmitAndLoadLibraryToDebuggee(source3, sourceFilePath: sourceFile.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)
Microsoft.CodeAnalysis.Test.Utilities (15)
Microsoft.CodeAnalysis.UnitTests (110)
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 (235)
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 (192)
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
2394CleanupAllGeneratedFiles(file1.Path)
2395CleanupAllGeneratedFiles(file2.Path)
2396CleanupAllGeneratedFiles(file3.Path)
2397CleanupAllGeneratedFiles(file4.Path)
2398CleanupAllGeneratedFiles(file5.Path)
2458CleanupAllGeneratedFiles(file1.Path)
2459CleanupAllGeneratedFiles(file2.Path)
2460CleanupAllGeneratedFiles(file3.Path)
2461CleanupAllGeneratedFiles(file4.Path)
2462CleanupAllGeneratedFiles(file5.Path)
2463CleanupAllGeneratedFiles(file6.Path)
2609CleanupAllGeneratedFiles(file.Path)
2626CleanupAllGeneratedFiles(file.Path)
2648CleanupAllGeneratedFiles(file.Path)
2672Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path})
2682CleanupAllGeneratedFiles(file.Path)
2706"/ruleset:" & ruleSetFile.Path, "/warnaserror", "/nowarn:42376"
2720"/warnaserror+", "/ruleset:" & ruleSetFile.Path, "/nowarn:42376"
2729CleanupAllGeneratedFiles(file.Path)
2756"/ruleset:" & ruleSetFile.Path, "/nowarn"
2771"/nowarn", "/ruleset:" & ruleSetFile.Path
2781CleanupAllGeneratedFiles(file.Path)
2806Dim vbc = New MockVisualBasicCompiler(Nothing, dir.Path, {"/nologo", "/t:library", "/a:" + Assembly.GetExecutingAssembly().Location, "a.vb", "/ruleset:" + ruleSetFile.Path})
2815CleanupAllGeneratedFiles(file.Path)
2839Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory)
2841Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath)
2864Dim parsedArgs = DefaultParse(New String() {"/ruleset:" + """" + file.Path + """", "a.cs"}, _baseDirectory)
2866Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath)
2892parsedArgs = DefaultParse(New String() {"/ruleset:" + file.Path, "a.cs"}, _baseDirectory)
2895Assert.Equal(expected:=file.Path, actual:=parsedArgs.RuleSetPath)
2900Assert.Equal(file.Path, DirectCast(err.Arguments(0), String))
3204AssertEx.Equal(File.ReadAllBytes(sl.Path), blob)
3208CleanupAllGeneratedFiles(src.Path)
3233AssertEx.Equal(File.ReadAllBytes(sl.Path), blob)
3236CleanupAllGeneratedFiles(src.Path)
3369expectedEmbeddedMap.Add(src.Path, embed_vb)
3373expectedEmbeddedMap.Add(src2.Path, embed2_vb)
3377expectedEmbeddedMap.Add(txt.Path, embed_xyz)
3396CleanupAllGeneratedFiles(src.Path)
3628CleanupAllGeneratedFiles(file.Path)
4119CleanupAllGeneratedFiles(src.Path)
4169CleanupAllGeneratedFiles(src.Path)
4170CleanupAllGeneratedFiles(xml.Path)
4250CleanupAllGeneratedFiles(src.Path)
4251CleanupAllGeneratedFiles(xml.Path)
4270CleanupAllGeneratedFiles(src.Path)
4289CleanupAllGeneratedFiles(src.Path)
4308CleanupAllGeneratedFiles(src.Path)
4327CleanupAllGeneratedFiles(src.Path)
4346CleanupAllGeneratedFiles(src.Path)
4365CleanupAllGeneratedFiles(src.Path)
4948Dim binaryPath = Temp.CreateFile().WriteAllBytes(Net461.Resources.mscorlib).Path
5025CleanupAllGeneratedFiles(src.Path)
5042CleanupAllGeneratedFiles(src.Path)
5049Dim filePath = tempFolder.CreateFile("temp.dll").Path
5070CleanupAllGeneratedFiles(src.Path)
5164CleanupAllGeneratedFiles(src.Path)
5196CleanupAllGeneratedFiles(src.Path)
5270File.Delete(sysRuntime.Path)
5276File.Delete(msCorLib.Path)
5278CleanupAllGeneratedFiles(src.Path)
5323File.Delete(msCorLib.Path)
5324CleanupAllGeneratedFiles(src.Path)
5357CleanupAllGeneratedFiles(src.Path)
5380CleanupAllGeneratedFiles(file.Path)
5783CleanupAllGeneratedFiles(file1.Path)
5784CleanupAllGeneratedFiles(file2.Path)
5968CleanupAllGeneratedFiles(file.Path)
6019CleanupAllGeneratedFiles(file.Path)
6058CleanupAllGeneratedFiles(file.Path)
6106CleanupAllGeneratedFiles(file.Path)
6150CleanupAllGeneratedFiles(file.Path)
6198CleanupAllGeneratedFiles(file.Path)
6244CleanupAllGeneratedFiles(file.Path)
6286CleanupAllGeneratedFiles(file.Path)
6290Return result.Value.Replace("PATH", file.Path).Replace("VERSION (HASH)", s_compilerVersion).Replace(vbLf, vbCrLf)
6322CleanupAllGeneratedFiles(file.Path)
6356CleanupAllGeneratedFiles(file.Path)
6390CleanupAllGeneratedFiles(file.Path)
6422CleanupAllGeneratedFiles(file.Path)
6454CleanupAllGeneratedFiles(file.Path)
6502CleanupAllGeneratedFiles(file.Path)
6839Path.GetFileName(sourceFile.Path)
6847String.Format("/win32manifest:{0}", Path.GetFileName(manifestFile.Path)),
6848Path.GetFileName(sourceFile.Path)
6872CleanupAllGeneratedFiles(sourceFile.Path)
6887Dim source As String = folder.CreateFile("src.vb").WriteAllText("").Path
6888Dim ref As String = folder.CreateFile("ref.dll").WriteAllText("").Path
6920</text>.Value).Path
6924</text>.Value).Path
6968</text>.Value).Path
6972</text>.Value).Path
7002</text>.Value).Path
7006</text>.Value).Path
7036</text>.Value).Path
7040</text>.Value).Path
7065</text>.Value).Path
7070</text>.Value).Path
7089</text>.Value).Path
7257</text>.Value).Path
7278</text>.Value).Path
7315</text>.Value).Path
7470</text>.Value).Path
7568CleanupAllGeneratedFiles(src.Path)
7624file.Path & "(4) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level.
7657" & file.Path & "(35) : error BC30451: 'Goo' is not declared. It may be inaccessible due to its protection level.
7665CleanupAllGeneratedFiles(file.Path)
7729CleanupAllGeneratedFiles(file.Path)
7748CleanupAllGeneratedFiles(file.Path)
7937sourceFile.Path
8012CleanupAllGeneratedFiles(file.Path)
8138CleanupAllGeneratedFiles(file.Path)
8293CleanupAllGeneratedFiles(file.Path)
8516CleanupAllGeneratedFiles(file.Path)
8593CleanupAllGeneratedFiles(file.Path)
8655CleanupAllGeneratedFiles(file.Path)
8704CleanupAllGeneratedFiles(src.Path)
8954</text>.Value).Path
9011</text>.Value).Path
9034</text>.Value).Path
9058</text>.Value).Path
9079</text>.Value).Path
9101</text>.Value).Path
9106</text>.Value).Path
9110</text>.Value).Path
9162CleanupAllGeneratedFiles(file.Path)
9576CleanupAllGeneratedFiles(sourceFile.Path)
9682Dim vbcPath = dir.CopyFile(s_basicCompilerExecutable).Path
9742End Class").Path
9748Dim filePath = Temp.CreateFile().WriteAllText("").Path
9805CleanupAllGeneratedFiles(file.Path)
9857CleanupAllGeneratedFiles(file.Path)
9883CleanupAllGeneratedFiles(file.Path)
9949CleanupAllGeneratedFiles(file.Path)
9977CleanupAllGeneratedFiles(file.Path)
10055additionalFlags = additionalFlags.Append("/analyzerconfig:" + analyzerConfig.Path).ToArray()
10112additionalFlags = additionalFlags.Append("/ruleset:" + ruleSetFile.Path).ToArray()
10185Dim args = {"/nologo", "/t:library", "/preferreduilang:en", src.Path}
10225Dim args = {"/warnaserror+", $"/warnaserror-:{diagnosticId}", "/nologo", "/t:library", "/preferreduilang:en", src.Path}
10304additionalFlags = additionalFlags.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray()
10347Dim globalOption = "/analyzerconfig:" + globalConfig.Path
10348Dim specificOption = "/analyzerconfig:" + analyzerConfig.Path
10378additionalFlags = additionalFlags.Append("/analyzerconfig:" & globalConfig.Path).ToArray()
10410VerifyOutput(dir, src, includeCurrentAssemblyAsAnalyzerReference:=False, additionalFlags:={"/warnaserror+", "/analyzerconfig:" + globalConfig.Path})
10432additionalFlags:={"/additionalfile:" & additionalFile.Path},
10507additionalArgs = additionalArgs.Append($"/analyzerconfig:{analyzerConfig.Path}").ToArray()
10579CleanupAllGeneratedFiles(src.Path)
10601CleanupAllGeneratedFiles(src.Path)
10628CleanupAllGeneratedFiles(src.Path)
10644CleanupAllGeneratedFiles(src.Path)
10719CleanupAllGeneratedFiles(src.Path)
10759"/analyzerconfig:" + analyzerConfig.Path,
10760src.Path})
10802"/analyzerconfig:" + analyzerConfig.Path,
10803src.Path})
10847"/analyzerconfig:" + analyzerConfig.Path,
10848src.Path})
Microsoft.CodeAnalysis.VisualBasic.Emit.UnitTests (13)
Microsoft.CodeAnalysis.VisualBasic.Scripting.UnitTests (2)
Microsoft.CodeAnalysis.VisualBasic.Semantic.UnitTests (1)
Microsoft.CodeAnalysis.VisualBasic.Symbol.UnitTests (46)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (2)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (1)
Microsoft.CodeAnalysis.Workspaces.UnitTests (9)
SolutionTests\SolutionTests.cs (8)
1628solution = solution.AddDocument(DocumentInfo.Create(fileDocumentId, "d.cs", loader: new FileTextLoader(fileD.Path, defaultEncoding: null), filePath: fileD.Path));
3301.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8));
3350.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8));
3417.AddDocument(did, "x", new WorkspaceFileTextLoader(workspace.Services.SolutionServices, file.Path, Encoding.UTF8));
4507var loader = new TestSmallFileTextLoader(file.Path, Encoding.UTF8);
4509var textLength = FileUtilities.GetFileLength(file.Path);
4511var 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 (1)
Roslyn.VisualStudio.Next.UnitTests (9)
Remote\SnapshotSerializationTests.cs (7)
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);
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)));
VBCSCompiler.UnitTests (29)