Skip to content

Commit 6ba3de9

Browse files
Revert "Revert "Default the cohosting option in the generator to on. (#12214)…" (#12270)
This reverts commit bde4f70. Co-authored-by: Chris Sienkiewicz <chsienki@microsoft.com>
1 parent c0f0695 commit 6ba3de9

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorCohostingOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ internal static class RazorCohostingOptions
55
/// <summary>
66
/// True if razor is running in the cohosting mode
77
/// </summary>
8-
internal static bool UseRazorCohostServer { get; set; } = false;
8+
internal static bool UseRazorCohostServer { get; set; } = true;
99
}

src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
using System.Linq;
1111
using System.Text;
1212
using System.Threading.Tasks;
13+
using Microsoft.AspNetCore.Razor.Language.Syntax;
1314
using Microsoft.CodeAnalysis;
1415
using Microsoft.CodeAnalysis.CSharp;
1516
using Microsoft.CodeAnalysis.Test.Utilities;
@@ -2615,6 +2616,9 @@ public async Task SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSupp
26152616
// start with the generator suppressed (this is the default state in VS)
26162617
driver = SetSuppressionState(true);
26172618

2619+
// Disable co-hosting, this test only applies to non-cohosting scenarios
2620+
RazorCohostingOptions.UseRazorCohostServer = false;
2621+
26182622
// results should be empty, and no recorded steps should have run
26192623
using var eventListener = new RazorEventListener();
26202624
var result = RunGenerator(compilation!, ref driver).VerifyPageOutput();
@@ -3457,6 +3461,7 @@ public async Task UseRazorCohostServer_CanOverride_Suppression()
34573461
["Component.Razor"] = "<h1>Hello world</h1>",
34583462
});
34593463
var compilation = await project.GetCompilationAsync();
3464+
RazorCohostingOptions.UseRazorCohostServer = false;
34603465

34613466
// Start with the generator suppressed
34623467
var (driver, additionalTexts, optionsProvider) = await GetDriverWithAdditionalTextAndProviderAsync(project, configureGlobalOptions: (o) =>

0 commit comments

Comments
 (0)