Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Install Dotnet
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: '10.0.x'
dotnet-version: '11.0.x'

- name: Dotnet Installation Info
run: dotnet --info
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install Dotnet
uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: '10.0.x'
dotnet-version: '11.0.x'

- name: Dotnet Installation Info
run: dotnet --info
Expand Down
4 changes: 2 additions & 2 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## What this is

`csharprepl` is a cross-platform command-line C# REPL distributed as a .NET 10 global tool. It evaluates C# with Roslyn's scripting API and provides IntelliSense, syntax highlighting, NuGet/project/assembly references, object inspection, IL/lowered-C# disassembly (ILSpy), and provider-agnostic AI code completion (via Microsoft.Extensions.AI). The terminal UX (input, autocomplete menus, highlighting) comes from the separate **PrettyPrompt** library (same author, separate NuGet package/repo).
`csharprepl` is a cross-platform command-line C# REPL distributed as a .NET 11 global tool. It evaluates C# with Roslyn's scripting API and provides IntelliSense, syntax highlighting, NuGet/project/assembly references, object inspection, IL/lowered-C# disassembly (ILSpy), and provider-agnostic AI code completion (via Microsoft.Extensions.AI). The terminal UX (input, autocomplete menus, highlighting) comes from the separate **PrettyPrompt** library (same author, separate NuGet package/repo).

Everything targets **`net10.0`**. The SDK is pinned in `global.json` (10.0.0, `latestMajor`, prereleases allowed).
Everything targets **`net11.0`**. The SDK is pinned in `global.json` (11.0.0, `latestMajor`, prereleases allowed).

## Build, run, test

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Release 0.9.3

- .NET 11 upgrade. csharprepl now targets `net11.0`, so it requires the .NET 11 SDK; the `connect` feature requires the target app to run on .NET 11 too. NuGet dependencies are upgraded to match, including Roslyn 5.9, NuGet 8.0, and MSBuild 18.12.

## Release 0.9.2

- **Breaking:** the "connect to a running process" command has been renamed from `inspect` to `connect`, to avoid confusion with the `dotnet-inspect` tool ([#505](https://github.com/waf/CSharpRepl/pull/505)).
Expand Down
7 changes: 6 additions & 1 deletion CSharpRepl.Services/CSharpRepl.Services.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down Expand Up @@ -66,6 +66,11 @@
<PackageReference Include="NuGet.ProjectModel" PrivateAssets="all" />
<PackageReference Include="NuGet.Protocol" PrivateAssets="all" />
<PackageReference Include="NuGet.Versioning" PrivateAssets="all" />
<!--
NuGet.Packaging pulls in System.Security.Cryptography.Pkcs 8.0.1, which has known vulnerabilities (NU1902/NU1903)
and, unlike the NuGet.* dlls, does ship in our output (it isn't in the shared framework). Pin it to a patched version.
-->
<PackageReference Include="System.Security.Cryptography.Pkcs" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public ImplementationAssemblyResolver(IReadOnlyCollection<string> searchDirector

public Task<MetadataFile?> ResolveModuleAsync(MetadataFile mainModule, string moduleName) => Task.FromResult(ResolveModule(mainModule, moduleName));

// ILSpy uses snapshots to scope resolution caching to a single decompilation; this resolver already caches for its
// whole lifetime (one lowering operation), so there's nothing extra to scope. Null means "no snapshot".
public IDisposable? BeginSnapshot() => null;

private MetadataFile? Load(string fileName)
{
foreach (var directory in searchDirectories)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ internal DotNetInstallationLocator(ITraceLogger logger, IFileSystem io, string d

/// <summary>
/// Extracts the framework version from a reference-assembly path like
/// C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\10.0.10\ref\net10.0
/// C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\11.0.10\ref\net11.0
/// two levels above the target-framework leaf, which holds for both the global packs and the NuGet ".ref" package layouts.
/// </summary>
private static Version ParseReferenceAssemblyVersion(string targetFrameworkPath)
Expand Down
4 changes: 2 additions & 2 deletions CSharpRepl/CSharpRepl.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.9.2</Version>
<Version>0.9.3</Version>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<RollForward>LatestMajor</RollForward>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
Expand Down
8 changes: 4 additions & 4 deletions CSharpRepl/Commands/CommandLine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private static Option<string> BuildFrameworkOption()

private static readonly string ConnectUsage =
"Usage: csharprepl connect <pid> connect to a running, connector-enabled process" + NewLine +
" csharprepl connect list list the connector-enabled processes you ca connect to" + NewLine +
" csharprepl connect list list the connector-enabled processes you can connect to" + NewLine +
" csharprepl connect init [--shell pwsh|bash|cmd] print the env vars to launch your app with";

public static Configuration Parse(string[] args, string configFilePath)
Expand Down Expand Up @@ -265,7 +265,7 @@ public static Configuration Parse(string[] args, string configFilePath)
{
Options = { ConnectShell }
};
var connectList = new Command("list", "List the running, connector-enabled processes you ca connect to.");
var connectList = new Command("list", "List the running, connector-enabled processes you can connect to.");
var connect = new Command("connect", "Connect to and evaluate code in a running, connector-enabled .NET process.")
{
Arguments = { ConnectPid },
Expand Down Expand Up @@ -420,7 +420,7 @@ private static string BuildConnectInitExports(string shell)
}

/// <summary>
/// Builds the `connect list` report: the connector-enabled processes the current user ca connect to.
/// Builds the `connect list` report: the connector-enabled processes the current user can connect to.
/// The process name is read from the pid, which also drops a stale endpoint left behind by a crashed process.
/// </summary>
private static IRenderable BuildConnectListOutput()
Expand Down Expand Up @@ -689,7 +689,7 @@ private static string GetHelp(string configFilePath)
" Connect to and evaluate code in a running, connector-enabled .NET process." + NewLine +
" The REPL [green][[OPTIONS]][/] above (e.g. [green]--theme[/]) also apply to the remote session." + NewLine +
" [green]connect list[/]:" + NewLine +
" List the running, connector-enabled processes you ca connect to (with their process ids)." + NewLine +
" List the running, connector-enabled processes you can connect to (with their process ids)." + NewLine +
" [green]connect init[/] [green][[--shell pwsh|powershell|cmd|bash|fish]][/]:" + NewLine +
" Print the environment variables to launch your app with so it can be connected." + NewLine +
" The shell is auto-detected from the parent process when [green]--shell[/] is omitted." + NewLine + NewLine +
Expand Down
81 changes: 41 additions & 40 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,47 +6,48 @@
<ItemGroup>
<PackageVersion Include="Ben.Demystifier" Version="0.4.1" />
<PackageVersion Include="BenchmarkDotNet" Version="0.15.8" />
<PackageVersion Include="ICSharpCode.Decompiler" Version="10.1.0.8386" />
<PackageVersion Include="Microsoft.Build.Framework" Version="18.7.1" />
<PackageVersion Include="ICSharpCode.Decompiler" Version="11.2.0.10050" />
<PackageVersion Include="Microsoft.Build.Framework" Version="18.12.2" />
<PackageVersion Include="Microsoft.Build.Locator" Version="1.11.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Features" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.3.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="5.3.0" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="10.7.0" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="10.7.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="10.0.8" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="10.0.9" />
<PackageVersion Include="Microsoft.NET.StringTools" Version="18.7.1" />
<PackageVersion Include="Microsoft.SymbolStore" Version="1.0.731901" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.8.0" />
<PackageVersion Include="MonoMod.RuntimeDetour" Version="25.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.9.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Features" Version="5.9.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="5.9.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" Version="5.9.0" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="11.0.0" />
<PackageVersion Include="Microsoft.Extensions.AI.OpenAI" Version="11.0.0" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="11.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="11.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyModel" Version="11.0.0" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="11.0.0" />
<PackageVersion Include="Microsoft.Extensions.Logging" Version="11.0.0" />
<PackageVersion Include="Microsoft.NET.StringTools" Version="18.12.2" />
<PackageVersion Include="Microsoft.SymbolStore" Version="1.0.755903" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.12.0" />
<PackageVersion Include="MonoMod.RuntimeDetour" Version="25.4.0-prerelease.2" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.1" />
<PackageVersion Include="NSubstitute" Version="5.3.0" />
<PackageVersion Include="NuGet.Commands" Version="7.6.0" />
<PackageVersion Include="NuGet.Common" Version="7.6.0" />
<PackageVersion Include="NuGet.Configuration" Version="7.6.0" />
<PackageVersion Include="NuGet.Credentials" Version="7.6.0" />
<PackageVersion Include="NuGet.DependencyResolver.Core" Version="7.6.0" />
<PackageVersion Include="NuGet.Frameworks" Version="7.6.0" />
<PackageVersion Include="NuGet.LibraryModel" Version="7.6.0" />
<PackageVersion Include="NuGet.Packaging" Version="7.6.0" />
<PackageVersion Include="NuGet.ProjectModel" Version="7.6.0" />
<PackageVersion Include="NuGet.Protocol" Version="7.6.0" />
<PackageVersion Include="NuGet.Versioning" Version="7.6.0" />
<PackageVersion Include="PrettyPrompt" Version="6.0.4" />
<PackageVersion Include="Spectre.Console.Ansi" Version="0.57.1" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.55.0" />
<PackageVersion Include="Spectre.Console.Testing" Version="0.57.1" />
<PackageVersion Include="System.CommandLine" Version="3.0.0-preview.5.26302.115" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="10.0.9" />
<PackageVersion Include="System.IO.Abstractions" Version="22.1.1" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="22.1.1" />
<PackageVersion Include="System.Management" Version="10.0.0" />
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="10.0.9" />
<PackageVersion Include="xunit.v3.mtp-v2" Version="4.0.0-pre.128" />
<PackageVersion Include="NSubstitute" Version="6.2.0" />
<PackageVersion Include="NuGet.Commands" Version="8.0.0" />
<PackageVersion Include="NuGet.Common" Version="8.0.0" />
<PackageVersion Include="NuGet.Configuration" Version="8.0.0" />
<PackageVersion Include="NuGet.Credentials" Version="8.0.0" />
<PackageVersion Include="NuGet.DependencyResolver.Core" Version="8.0.0" />
<PackageVersion Include="NuGet.Frameworks" Version="8.0.0" />
<PackageVersion Include="NuGet.LibraryModel" Version="8.0.0" />
<PackageVersion Include="NuGet.Packaging" Version="8.0.0" />
<PackageVersion Include="NuGet.ProjectModel" Version="8.0.0" />
<PackageVersion Include="NuGet.Protocol" Version="8.0.0" />
<PackageVersion Include="NuGet.Versioning" Version="8.0.0" />
<PackageVersion Include="PrettyPrompt" Version="6.0.5" />
<PackageVersion Include="Spectre.Console.Ansi" Version="0.57.2" />
<PackageVersion Include="Spectre.Console.Cli" Version="0.57.2" />
<PackageVersion Include="Spectre.Console.Testing" Version="0.57.2" />
<PackageVersion Include="System.CommandLine" Version="3.0.0" />
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="11.0.0" />
<PackageVersion Include="System.IO.Abstractions" Version="23.0.0" />
<PackageVersion Include="System.IO.Abstractions.TestingHelpers" Version="23.0.0" />
<PackageVersion Include="System.Management" Version="11.0.0" />
<PackageVersion Include="System.Reflection.MetadataLoadContext" Version="11.0.0" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="11.0.0" />
<PackageVersion Include="xunit.v3.mtp-v2" Version="4.0.3" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(System.Text.Json / System.IO.Pipes / System.Net.Sockets are all in Microsoft.NETCore.App).
-->
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
stages into its own directory so the EngineALC's AssemblyDependencyResolver can find them.
-->
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<GenerateDependencyFile>true</GenerateDependencyFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
EngineALC, so the engine is a ReferenceOutputAssembly="false" dependency that we stage next to this DLL.
-->
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>
Expand All @@ -25,7 +25,7 @@
-->
<Target Name="StageEngine" AfterTargets="Build">
<ItemGroup>
<EngineFiles Include="$(MSBuildProjectDirectory)\..\CSharpRepl.InjectedHook.ScriptEngine\bin\$(Configuration)\net10.0\**\*.*" />
<EngineFiles Include="$(MSBuildProjectDirectory)\..\CSharpRepl.InjectedHook.ScriptEngine\bin\$(Configuration)\net11.0\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(EngineFiles)" DestinationFiles="@(EngineFiles->'$(OutDir)%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
</Target>
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ C# REPL provides the following features:

## Installation

C# REPL is a .NET 10 global tool, and runs on Windows, Mac OS, and Linux. It can be installed [from NuGet](https://www.nuget.org/packages/CSharpRepl) via:
C# REPL is a .NET 11 global tool, and runs on Windows, Mac OS, and Linux. It can be installed [from NuGet](https://www.nuget.org/packages/CSharpRepl) via:

```console
dotnet tool install -g csharprepl
Expand Down Expand Up @@ -191,7 +191,7 @@ Patches take effect immediately and persist in the target until reverted or the

**Requirements and limitations:**

- `net10.0` targets only. The connector and the target must both be on .NET 10.
- `net11.0` targets only. The connector and the target must both be on .NET 11.
- Apps published as single-files have very limited functionality:
- A framework-dependent single-file app's assemblies are bundled with no metadata, so strongly-typed access to the app's own types is unavailable. You need to use reflection to access the app's types.
- A self-contained single-file app is unsupported (even the runtime is bundled, so nothing can be compiled). The connector will refuse to start.
Expand Down
2 changes: 1 addition & 1 deletion Tests/CSharpRepl.Benchmarks/CSharpRepl.Benchmarks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion Tests/CSharpRepl.Tests/CSharpRepl.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion Tests/CSharpRepl.Tests/ConnectorTestSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private static string BuildTestTarget()

// DotnetBuilder doesn't pass a configuration, so it always produces the Debug apphost (matching the
// other on-demand-built fixtures, e.g. DemoProject3).
var executable = Path.Combine(projectDirectory, "bin", "Debug", "net10.0",
var executable = Path.Combine(projectDirectory, "bin", "Debug", "net11.0",
OperatingSystem.IsWindows() ? TestTargetName + ".exe" : TestTargetName);
Assert.True(File.Exists(executable), $"Built connector test target not found at '{executable}'.");
return executable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>disable</ImplicitUsings>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<!-- An ordinary Generic Host, so the integration tests exercise the bootstrap's DI-root capture. -->
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.8" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="11.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace CSharpRepl.InjectedHook.TestTarget;
/// <summary>
/// An ordinary app with mutable static state. It knows nothing about the connector — the integration
/// test injects the connector via DOTNET_STARTUP_HOOKS and reads/writes this live state across the process
/// boundary. Stays alive for a bounded time so the test ca connect and evaluate; the test kills it when done.
/// boundary. Stays alive for a bounded time so the test can connect and evaluate; the test kills it when done.
/// It builds (but doesn't run) a Generic Host with a singleton so the tests can also prove the bootstrap's
/// DI-root capture: building the host emits the hosting DiagnosticListener's HostBuilt event.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net11.0</TargetFramework>
<OutputType>Exe</OutputType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.Management" Version="10.0.0" />
<PackageReference Include="System.Management" Version="11.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"runtimeOptions": {
"tfm": "net10.0",
"tfm": "net11.0",
"framework": {
"name": "Microsoft.AspNetCore.App",
"version": "10.0.0"
"version": "11.0.0"
},
"configProperties": {
"System.GC.Server": true,
Expand Down
Loading
Loading