diff --git a/CSharpRepl.Services/CSharpRepl.Services.csproj b/CSharpRepl.Services/CSharpRepl.Services.csproj index 5a4a6db..c230c0d 100644 --- a/CSharpRepl.Services/CSharpRepl.Services.csproj +++ b/CSharpRepl.Services/CSharpRepl.Services.csproj @@ -28,6 +28,12 @@ + + + diff --git a/CSharpRepl.Tests/EvaluationTests.cs b/CSharpRepl.Tests/EvaluationTests.cs index 5c29b91..e4425ce 100644 --- a/CSharpRepl.Tests/EvaluationTests.cs +++ b/CSharpRepl.Tests/EvaluationTests.cs @@ -134,6 +134,22 @@ public async Task Evaluate_AssemblyReferenceWithSharedFramework_ReferencesShared Assert.Contains("WebApplication1", completions.Select(c => c.Item.DisplayText).First(text => text.StartsWith("WebApplicat"))); } + [Fact] + public async Task Evaluate_RunSharedFrameworkCode_DoesNotThrowAssemblyLoadException() + { + // Regression test for https://github.com/waf/CSharpRepl/issues/414. Referencing the ASP.NET Core shared framework and + // then running code that transitively loaded Microsoft.Extensions.Logging / Microsoft.Extensions.DependencyInjection threw + // the exception "Manifest definition does not match the assembly reference", because we bundled those assemblies + // at a lower version than the shared framework (they are dependencies of Microsoft.CodeAnalysis.Workspaces.MSBuild) + await services.EvaluateAsync(@"#r ""./Data/WebApplication1.dll""", cancellationToken: TestContext.Current.CancellationToken); + var result = await services.EvaluateAsync( + @"Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder().Build().GetType().Name", + cancellationToken: TestContext.Current.CancellationToken); + + var success = Assert.IsType(result); + Assert.Equal("WebApplication", success.ReturnValue.Value); + } + [Fact] public async Task Evaluate_ProjectReference_ReferencesProject() { diff --git a/CSharpRepl/CSharpRepl.csproj b/CSharpRepl/CSharpRepl.csproj index 36bfe6d..bf3bf1e 100644 --- a/CSharpRepl/CSharpRepl.csproj +++ b/CSharpRepl/CSharpRepl.csproj @@ -39,7 +39,6 @@ -