From bf50b16fa3a9e1d1c403fc9e245f8d870780f81d Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Sun, 12 Oct 2025 12:50:29 -0700 Subject: [PATCH] =?UTF-8?q?Revert=20"Revert=20"Revert=20"Default=20the=20c?= =?UTF-8?q?ohosting=20option=20in=20the=20generator=20to=20on.=20=E2=80=A6?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 06c0bfa232e394fdd691261b26eee19f14b907db. --- .../src/SourceGenerators/RazorCohostingOptions.cs | 2 +- .../RazorSourceGeneratorTests.cs | 5 ----- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorCohostingOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorCohostingOptions.cs index 21db8554f0a..fc1a8a78f1e 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorCohostingOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorCohostingOptions.cs @@ -5,5 +5,5 @@ internal static class RazorCohostingOptions /// /// True if razor is running in the cohosting mode /// - internal static bool UseRazorCohostServer { get; set; } = true; + internal static bool UseRazorCohostServer { get; set; } = false; } diff --git a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs index 460b5cdf6d6..ac91bdf7606 100644 --- a/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs +++ b/src/Compiler/test/Microsoft.NET.Sdk.Razor.SourceGenerators.Tests/RazorSourceGeneratorTests.cs @@ -10,7 +10,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.Test.Utilities; @@ -2623,9 +2622,6 @@ public async Task SourceGenerator_DoesNotUpdateSources_WhenSourceGeneratorIsSupp // start with the generator suppressed (this is the default state in VS) driver = SetSuppressionState(true); - // Disable co-hosting, this test only applies to non-cohosting scenarios - RazorCohostingOptions.UseRazorCohostServer = false; - // results should be empty, and no recorded steps should have run using var eventListener = new RazorEventListener(); var result = RunGenerator(compilation!, ref driver).VerifyPageOutput(); @@ -3468,7 +3464,6 @@ public async Task UseRazorCohostServer_CanOverride_Suppression() ["Component.Razor"] = "

Hello world

", }); var compilation = await project.GetCompilationAsync(); - RazorCohostingOptions.UseRazorCohostServer = false; // Start with the generator suppressed var (driver, additionalTexts, optionsProvider) = await GetDriverWithAdditionalTextAndProviderAsync(project, configureGlobalOptions: (o) =>