diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4ff74bf..a853676 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: - name: Install Dotnet uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: '9.0.x' + dotnet-version: '10.0.x' - name: Dotnet Installation Info run: dotnet --info diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f947edc..0c8219f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: - name: Install Dotnet uses: actions/setup-dotnet@607fce577a46308457984d59e4954e075820f10a with: - dotnet-version: '9.0.x' + dotnet-version: '10.0.x' - name: Dotnet Installation Info run: dotnet --info diff --git a/CSharpRepl.Services/CSharpRepl.Services.csproj b/CSharpRepl.Services/CSharpRepl.Services.csproj index e712d69..7dd7bdd 100644 --- a/CSharpRepl.Services/CSharpRepl.Services.csproj +++ b/CSharpRepl.Services/CSharpRepl.Services.csproj @@ -1,29 +1,29 @@  - net9.0 + net10.0 enable - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - - + + - + - - - + + + - - - - - - - - + + + + + + + + - - - - + + + + diff --git a/CSharpRepl.Tests/CSharpRepl.Tests.csproj b/CSharpRepl.Tests/CSharpRepl.Tests.csproj index aa56e5a..00c9d68 100644 --- a/CSharpRepl.Tests/CSharpRepl.Tests.csproj +++ b/CSharpRepl.Tests/CSharpRepl.Tests.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 false @@ -14,21 +14,21 @@ - + - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/CSharpRepl.Tests/Data/ComplexSolution/EntryPoint/EntryPoint.csproj b/CSharpRepl.Tests/Data/ComplexSolution/EntryPoint/EntryPoint.csproj index 4a923b4..c7393a0 100644 --- a/CSharpRepl.Tests/Data/ComplexSolution/EntryPoint/EntryPoint.csproj +++ b/CSharpRepl.Tests/Data/ComplexSolution/EntryPoint/EntryPoint.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net10.0 enable enable diff --git a/CSharpRepl.Tests/Data/DemoSolution/DemoSolution.DemoProject3/DemoSolution.DemoProject3.csproj b/CSharpRepl.Tests/Data/DemoSolution/DemoSolution.DemoProject3/DemoSolution.DemoProject3.csproj index 115da12..37f1801 100644 --- a/CSharpRepl.Tests/Data/DemoSolution/DemoSolution.DemoProject3/DemoSolution.DemoProject3.csproj +++ b/CSharpRepl.Tests/Data/DemoSolution/DemoSolution.DemoProject3/DemoSolution.DemoProject3.csproj @@ -1,12 +1,12 @@ - net6.0 + net10.0 Exe - + diff --git a/CSharpRepl.Tests/Data/WebApplication1.runtimeconfig.json b/CSharpRepl.Tests/Data/WebApplication1.runtimeconfig.json index e498aae..266eb81 100644 --- a/CSharpRepl.Tests/Data/WebApplication1.runtimeconfig.json +++ b/CSharpRepl.Tests/Data/WebApplication1.runtimeconfig.json @@ -1,9 +1,9 @@ { "runtimeOptions": { - "tfm": "net6.0", + "tfm": "net10.0", "framework": { "name": "Microsoft.AspNetCore.App", - "version": "6.0.0" + "version": "10.0.0" }, "configProperties": { "System.GC.Server": true, diff --git a/CSharpRepl.Tests/DotNetInstallationLocatorTest.cs b/CSharpRepl.Tests/DotNetInstallationLocatorTest.cs index e9ce947..3edad19 100644 --- a/CSharpRepl.Tests/DotNetInstallationLocatorTest.cs +++ b/CSharpRepl.Tests/DotNetInstallationLocatorTest.cs @@ -1,8 +1,9 @@ -using System; +using CSharpRepl.Services.Roslyn.References; +using System; using System.Collections.Generic; using System.IO; using System.IO.Abstractions.TestingHelpers; -using CSharpRepl.Services.Roslyn.References; +using System.Runtime.InteropServices; using Xunit; namespace CSharpRepl.Tests; @@ -41,6 +42,82 @@ public void GetSharedFrameworkConfiguration_Net5GlobalInstallation_IsLocated() ); } + [Fact] + public void GetSharedFrameworkConfiguration_Net10Installation_IsLocated() + { + var fileSystem = new MockFileSystem(new Dictionary + { + { @"/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0/data/FrameworkList.xml", string.Empty }, + { @"/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/9.0.0/ref/net9.0/Microsoft.CSharp.dll", string.Empty }, + { @"/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.0/data/FrameworkList.xml", string.Empty }, + { @"/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.0/ref/net10.0/Microsoft.CSharp.dll", string.Empty }, + { @"/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.1/data/FrameworkList.xml", string.Empty }, + { @"/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.1/ref/net10.0/Microsoft.CSharp.dll", string.Empty }, + + { @"/Program Files/dotnet/shared/Microsoft.NETCore.App/9.0.2/Microsoft.CSharp.dll", string.Empty }, + { @"/Program Files/dotnet/shared/Microsoft.NETCore.App/10.0.0/Microsoft.CSharp.dll", string.Empty }, + { @"/Program Files/dotnet/shared/Microsoft.NETCore.App/10.0.1/Microsoft.CSharp.dll", string.Empty } + }); + + var locator = new DotNetInstallationLocator( + logger: new TestTraceLogger(), io: fileSystem, + dotnetRuntimePath: @"/Program Files/dotnet/", + userProfilePath: @"/Users/bob/" + ); + + var (refPath, implPath) = locator.FindInstallation("Microsoft.NETCore.App", new Version(10, 0, 1)); + + Assert.Equal( + CrossPlatform(@"/Program Files/dotnet/packs/Microsoft.NETCore.App.Ref/10.0.1/ref/net10.0"), + CrossPlatform(refPath) + ); + Assert.Equal( + CrossPlatform(@"/Program Files/dotnet/shared/Microsoft.NETCore.App/10.0.1"), + CrossPlatform(implPath) + ); + } + + [Fact] + public void GetSharedFrameworkConfiguration_Net10UsesNuGetWhenNotInstalledGlobally() + { + string platform = OperatingSystem.IsWindows() ? "win" + : OperatingSystem.IsLinux() ? "linux" + : OperatingSystem.IsMacOS() ? "osx" + : null; + + var architecture = RuntimeInformation.ProcessArchitecture.ToString().ToLowerInvariant(); + + var fileSystem = new MockFileSystem(new Dictionary + { + // existing global runtimes but none for net10 + { @"/Program Files/dotnet/shared/Microsoft.NETCore.App/9.0.0/Microsoft.CSharp.dll", string.Empty }, + + // reference assemblies in .nuget installation + { @"/Users/bob/.nuget/packages/microsoft.netcore.app.ref/10.0.0/data/FrameworkList.xml", string.Empty }, + { @"/Users/bob/.nuget/packages/microsoft.netcore.app.ref/10.0.0/ref/net10.0/Microsoft.CSharp.dll", string.Empty }, + + // implementation assemblies in .nuget installation + { @$"/Users/bob/.nuget/packages/microsoft.netcore.app.runtime.{platform}-{architecture}/10.0.0/runtimes/{platform}-{architecture}/lib/net10.0/Microsoft.CSharp.dll", string.Empty }, + }); + + var locator = new DotNetInstallationLocator( + logger: new TestTraceLogger(), io: fileSystem, + dotnetRuntimePath: @"/Program Files/dotnet/", + userProfilePath: @"/Users/bob/" + ); + + var (refPath, implPath) = locator.FindInstallation("Microsoft.NETCore.App", new Version(10, 0, 0)); + + Assert.Equal( + CrossPlatform(@"/Users/bob/.nuget/packages/microsoft.netcore.app.ref/10.0.0/ref/net10.0"), + CrossPlatform(refPath) + ); + Assert.Equal( + CrossPlatform(@$"/Users/bob/.nuget/packages/microsoft.netcore.app.runtime.{platform}-{architecture}/10.0.0/runtimes/{platform}-{architecture}/lib/net10.0"), + CrossPlatform(implPath) + ); + } + [Fact] public void GetSharedFrameworkConfiguration_NoGlobalNet5ReferenceAssemblies_UsesNuGetInstallation() { diff --git a/CSharpRepl.Tests/EvaluationTests.cs b/CSharpRepl.Tests/EvaluationTests.cs index 8a3d236..fc7a1ff 100644 --- a/CSharpRepl.Tests/EvaluationTests.cs +++ b/CSharpRepl.Tests/EvaluationTests.cs @@ -185,7 +185,7 @@ public async Task Evaluate_ResolveCorrectRuntimeVersionOfReferencedAssembly() var (buildExitCode, _) = builder.Build("./Data/DemoSolution/DemoSolution.DemoProject3"); Assert.Equal(0, buildExitCode); - var referenceResult = await services.EvaluateAsync(@"#r ""./Data/DemoSolution/DemoSolution.DemoProject3/bin/Debug/net6.0/DemoSolution.DemoProject3.dll"""); + var referenceResult = await services.EvaluateAsync(@"#r ""./Data/DemoSolution/DemoSolution.DemoProject3/bin/Debug/net10.0/DemoSolution.DemoProject3.dll"""); var importResult = await services.EvaluateAsync(@"DemoSolution.DemoProject3.DemoClass3.GetSystemManagementPath()"); Assert.IsType(referenceResult); diff --git a/CSharpRepl.Tests/SymbolExplorerTests.cs b/CSharpRepl.Tests/SymbolExplorerTests.cs index a2a2169..45235dc 100644 --- a/CSharpRepl.Tests/SymbolExplorerTests.cs +++ b/CSharpRepl.Tests/SymbolExplorerTests.cs @@ -34,27 +34,27 @@ public async Task GetSymbolAtIndex_ReturnsFullyQualifiedName() [Fact] public async Task GetSymbolAtIndex_ClassInSourceLinkedAssembly_ReturnsSourceLinkUrl() { - // should return a string like https://www.github.com/dotnet/runtime/blob/208e377a5329ad6eb1db5e5fb9d4590fa50beadd/src/libraries/System.Console/src/System/Console.cs + // should return a string like https://www.github.com/dotnet/dotnet/blob/b0f34d51fccc69fd334253924abd8d6853fad7aa/src/runtime/src/libraries/System.Console/src/System/Console.cs var symbol = await services.GetSymbolAtIndexAsync(@"Console.WriteLine(""howdy"")", "Conso".Length); - Assert.StartsWith("https://www.github.com/dotnet/runtime/", symbol.Url); + Assert.StartsWith("https://www.github.com/dotnet/dotnet/", symbol.Url); Assert.EndsWith("Console.cs", symbol.Url); } [Fact] public async Task GetSymbolAtIndex_GenericTypeInSourceLinkedAssembly_ReturnsSourceLinkUrl() { - // should return a string like https://www.github.com/dotnet/runtime/blob/1381d5ebd2ab1f292848d5b19b80cf71ac332508/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs + // should return a string like https://www.github.com/dotnet/dotnet/blob/b0f34d51fccc69fd334253924abd8d6853fad7aa/src/runtime/src/libraries/System.Private.CoreLib/src/System/Collections/Generic/List.cs var symbol = await services.GetSymbolAtIndexAsync(@"List", "Li".Length); - Assert.StartsWith("https://www.github.com/dotnet/runtime/", symbol.Url); + Assert.StartsWith("https://www.github.com/dotnet/dotnet/", symbol.Url); Assert.EndsWith("List.cs", symbol.Url); } [Fact] public async Task GetSymbolAtIndex_MethodInSourceLinkedAssembly_ReturnsSourceLinkUrl() { - // should return a string like https://www.github.com/dotnet/runtime/blob/208e377a5329ad6eb1db5e5fb9d4590fa50beadd/src/libraries/System.Console/src/System/Console.cs#L635-L636 + // should return a string like https://www.github.com/dotnet/dotnet/blob/b0f34d51fccc69fd334253924abd8d6853fad7aa/src/runtime/src/libraries/System.Console/src/System/Console.cs#L733-L734 var symbol = await services.GetSymbolAtIndexAsync(@"Console.WriteLine(""howdy"")", "Console.Wri".Length); AssertLinkWithLineNumber(symbol); @@ -63,7 +63,7 @@ public async Task GetSymbolAtIndex_MethodInSourceLinkedAssembly_ReturnsSourceLin [Fact] public async Task GetSymbolAtIndex_PropertyInSourceLinkedAssembly_ReturnsSourceLinkUrl() { - // should return a string like https://www.github.com/dotnet/runtime/blob/208e377a5329ad6eb1db5e5fb9d4590fa50beadd/src/libraries/System.Console/src/System/Console.cs + // should return a string like https://www.github.com/dotnet/dotnet/blob/b0f34d51fccc69fd334253924abd8d6853fad7aa/src/runtime/src/libraries/System.Console/src/System/Console.cs var symbol = await services.GetSymbolAtIndexAsync(@"Console.Out", "Console.Ou".Length); AssertLinkWithLineNumber(symbol); @@ -72,7 +72,7 @@ public async Task GetSymbolAtIndex_PropertyInSourceLinkedAssembly_ReturnsSourceL [Fact] public async Task GetSymbolAtIndex_EventInSourceLinkedAssembly_ReturnsSourceLinkUrl() { - // should return a string like https://www.github.com/dotnet/runtime/blob/208e377a5329ad6eb1db5e5fb9d4590fa50beadd/src/libraries/System.Console/src/System/Console.cs + // should return a string like https://www.github.com/dotnet/dotnet/blob/b0f34d51fccc69fd334253924abd8d6853fad7aa/src/runtime/src/libraries/System.Console/src/System/Console.cs var symbol = await services.GetSymbolAtIndexAsync(@"Console.CancelKeyPress", "Console.CancelKe".Length); AssertLinkWithLineNumber(symbol); @@ -103,7 +103,7 @@ private static void AssertLinkWithLineNumber(SymbolResult symbol) Assert.Equal(2, urlParts.Length); var url = urlParts[0]; - Assert.StartsWith("https://www.github.com/dotnet/runtime/", url); + Assert.StartsWith("https://www.github.com/dotnet/dotnet/", url); var lineHash = urlParts[1]; const string LinePattern = "L[0-9]+"; diff --git a/CSharpRepl/CSharpRepl.csproj b/CSharpRepl/CSharpRepl.csproj index 44dac32..ac85161 100644 --- a/CSharpRepl/CSharpRepl.csproj +++ b/CSharpRepl/CSharpRepl.csproj @@ -3,7 +3,7 @@ 0.6.7 Exe - net9.0 + net10.0 LatestMajor latest enable @@ -27,7 +27,7 @@ - + diff --git a/global.json b/global.json new file mode 100644 index 0000000..a11f48e --- /dev/null +++ b/global.json @@ -0,0 +1,7 @@ +{ + "sdk": { + "version": "10.0.0", + "rollForward": "latestMajor", + "allowPrerelease": true + } +} \ No newline at end of file