Skip to content

Commit e1284b7

Browse files
committed
Update to latest .net 7 previews
1 parent 6f61456 commit e1284b7

File tree

6 files changed

+15
-21
lines changed

6 files changed

+15
-21
lines changed

CSharpRepl.Tests/CSharpRepl.Tests.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
1212
</ItemGroup>
1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.0-preview.3.22178.4" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0-preview-20220414-03" />
14+
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="7.0.0-preview.5.22303.8" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.0-preview-20220623-07" />
1616
<PackageReference Include="xunit" Version="2.4.2-pre.12" />
1717
<PackageReference Include="xunit.runner.reporters" Version="2.4.2-pre.12" />
18-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
18+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
1919
<PrivateAssets>all</PrivateAssets>
2020
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
2121
</PackageReference>

CSharpRepl.Tests/EvalTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ public async Task Eval_FaultyDirectiveFailsGracefully()
206206
public void Eval_MissingArgumentsThrowsOnParse()
207207
{
208208
var expr = "#nuget";
209-
210209
Assert.Throws<ArgumentException>(() => NugetPreProcessorDirective.Parse(expr));
211210
}
212211

CSharpRepl/CSharpRepl.csproj

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,12 @@
1515
<ItemGroup>
1616
<PackageReference Include="AngouriMath" Version="1.3.0" />
1717
<PackageReference Include="ICSharpCode.Decompiler" Version="3.2.0.3856" />
18-
19-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
20-
21-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.3.0-1.22213.10" />
22-
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
23-
<PackageReference Include="NuGet.Packaging" Version="6.3.0-preview.1.10" />
24-
<PackageReference Include="NuGet.Protocol" Version="6.3.0-preview.1.10" />
25-
<PackageReference Include="NuGet.Resolver" Version="6.3.0-preview.1.10" />
18+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.4.0-1.22315.13" />
19+
<PackageReference Include="Newtonsoft.Json" Version="13.0.2-beta1" />
20+
<PackageReference Include="NuGet.Packaging" Version="6.3.0-preview.3.89" />
21+
<PackageReference Include="NuGet.Protocol" Version="6.3.0-preview.3.89" />
22+
<PackageReference Include="NuGet.Resolver" Version="6.3.0-preview.3.89" />
2623
<PackageReference Include="Seq.Extensions.Logging" Version="6.1.0-dev-00091" />
27-
<PackageReference Include="System.Runtime.Experimental" Version="7.0.0-preview.2.22152.2" />
2824
</ItemGroup>
2925
<ItemGroup>
3026
<None Update="start.sh">

CSharpRepl/Eval/ScriptExecutionContext.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Linq;
77
using System.Net.Http;
88
using System.Reflection;
9-
using System.Runtime.CompilerServices;
109
using AngouriMath;
1110
using Microsoft.CodeAnalysis;
1211

@@ -62,8 +61,7 @@ public class ScriptExecutionContext
6261
typeof(ValueTuple).GetTypeInfo().Assembly,
6362
typeof(Globals).GetTypeInfo().Assembly,
6463
typeof(Memory<>).GetTypeInfo().Assembly,
65-
typeof(Entity).GetTypeInfo().Assembly,
66-
typeof(INumber<>).GetTypeInfo().Assembly
64+
typeof(Entity).GetTypeInfo().Assembly
6765
};
6866
public ScriptOptions Options =>
6967
ScriptOptions.Default

CSharpRepl/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Microsoft.Extensions.Hosting;
99
using Microsoft.Extensions.DependencyInjection;
1010
using System.Threading.Tasks;
11+
using CSDiscordService.Eval;
1112

1213
namespace CSDiscordService
1314
{
@@ -17,7 +18,10 @@ public static async Task Main()
1718
{
1819
Environment.SetEnvironmentVariable("HOME", Path.GetTempPath());
1920
var host = CreateWebHostBuilder().Build();
21+
var replService = host.Services.GetRequiredService<CSharpEval>();
2022

23+
// run eval once on startup so the first time its hit isn't cripplingly slow.
24+
await replService.RunEvalAsync("1+1");
2125
await host.RunAsync();
2226
}
2327

CSharpRepl/Startup.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Microsoft.AspNetCore.Hosting;
33
using Microsoft.Extensions.Configuration;
44
using Microsoft.Extensions.DependencyInjection;
5-
using System.Linq;
65
using CSDiscordService.Eval;
76
using System;
87
using System.Threading.Tasks;
@@ -42,7 +41,7 @@ public void ConfigureServices(IServiceCollection services)
4241
new RuntimeTypeHandleJsonConverter(), new TypeJsonConverterFactory(), new AssemblyJsonConverter(),
4342
new ModuleJsonConverter(), new AssemblyJsonConverterFactory(),
4443
new DirectoryInfoJsonConverter(),
45-
new AngouriMathEntityConverter(), new AngouriMathEntityVarsConverter(),
44+
new AngouriMathEntityConverter(), new AngouriMathEntityVarsConverter(),
4645
new IntPtrJsonConverter()
4746
}
4847
};
@@ -76,11 +75,9 @@ public void ConfigureServices(IServiceCollection services)
7675
services.AddTransient<IDirectiveProcessor, NugetDirectiveProcessor>();
7776
}
7877

79-
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, CSharpEval evalService, IHostApplicationLifetime appLifetime)
78+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime appLifetime)
8079
{
8180
_appLifetime = appLifetime;
82-
// run eval once on startup so the first time its hit isn't cripplingly slow.
83-
evalService.RunEvalAsync("1+1").ConfigureAwait(false).GetAwaiter().GetResult();
8481
app.UseRouting();
8582
app.Use(async (context, next) =>
8683
{

0 commit comments

Comments
 (0)