Skip to content

Commit 57b6a3a

Browse files
committed
Merge remote-tracking branch 'dotnet/main' into prvysoky/backflow-main
2 parents 28df124 + c9d23c3 commit 57b6a3a

File tree

9 files changed

+58
-16
lines changed

9 files changed

+58
-16
lines changed

documentation/manpages/sdk/dotnet-watch.1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ The <xref:Microsoft.Extensions.FileProviders.PhysicalFileProvider> class uses \f
177177
\f[B]\f[VB]DOTNET_WATCH_AUTO_RELOAD_WS_HOSTNAME\f[B]\f[R]
178178
.RS 2
179179
.PP
180-
As part of \f[V]dotnet watch\f[R], the browser refresh server mechanism reads this value to determine the WebSocket host environment.
180+
As part of \f[V]dotnet watch\f[R], the browser refresh server mechanism reads this value to determine the WebSocket host environment's hostname.
181181
The value \f[V]127.0.0.1\f[R] is replaced by \f[V]localhost\f[R], and the \f[V]http://\f[R] and \f[V]https://\f[R] schemes are replaced with \f[V]ws://\f[R] and \f[V]wss://\f[R] respectively.
182182
.RE
183183
.IP \[bu] 2

eng/Version.Details.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ This file should be imported by eng/Versions.props
140140
<!-- dotnet/core-setup dependencies -->
141141
<NETStandardLibraryRefPackageVersion>2.1.0</NETStandardLibraryRefPackageVersion>
142142
<!-- microsoft/testfx dependencies -->
143-
<MicrosoftTestingPlatformPackageVersion>1.9.0-preview.25460.1</MicrosoftTestingPlatformPackageVersion>
144-
<MSTestPackageVersion>3.11.0-preview.25460.1</MSTestPackageVersion>
143+
<MicrosoftTestingPlatformPackageVersion>1.9.0-preview.25464.1</MicrosoftTestingPlatformPackageVersion>
144+
<MSTestPackageVersion>3.11.0-preview.25464.1</MSTestPackageVersion>
145145
</PropertyGroup>
146146
<!--Property group for alternate package version names-->
147147
<PropertyGroup>

eng/Version.Details.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,13 +553,13 @@
553553
<Uri>https://github.com/dotnet/dotnet</Uri>
554554
<Sha>5d793417389ca94bd649ad988f26978551cc90a6</Sha>
555555
</Dependency>
556-
<Dependency Name="Microsoft.Testing.Platform" Version="1.9.0-preview.25460.1">
556+
<Dependency Name="Microsoft.Testing.Platform" Version="1.9.0-preview.25464.1">
557557
<Uri>https://github.com/microsoft/testfx</Uri>
558-
<Sha>c1da2fb788565ccaf9ac9295d42486104d6797cb</Sha>
558+
<Sha>b7507dc8a6007e132d8809edc2ddf0065bd0ec4e</Sha>
559559
</Dependency>
560-
<Dependency Name="MSTest" Version="3.11.0-preview.25460.1">
560+
<Dependency Name="MSTest" Version="3.11.0-preview.25464.1">
561561
<Uri>https://github.com/microsoft/testfx</Uri>
562-
<Sha>c1da2fb788565ccaf9ac9295d42486104d6797cb</Sha>
562+
<Sha>b7507dc8a6007e132d8809edc2ddf0065bd0ec4e</Sha>
563563
</Dependency>
564564
<Dependency Name="Microsoft.Extensions.Configuration.Ini" Version="10.0.0-rc.1.25461.111">
565565
<Uri>https://github.com/dotnet/dotnet</Uri>

src/BuiltInTools/HotReloadClient/Web/BrowserRefreshServer.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ namespace Microsoft.DotNet.HotReload;
2727
/// <summary>
2828
/// Kestrel-based Browser Refesh Server implementation.
2929
/// </summary>
30-
internal sealed class BrowserRefreshServer(
30+
internal sealed class BrowserRefreshServer(
3131
ILogger logger,
3232
ILoggerFactory loggerFactory,
3333
string middlewareAssemblyPath,
3434
string dotnetPath,
3535
string? autoReloadWebSocketHostName,
36+
int? autoReloadWebSocketPort,
3637
bool suppressTimeouts)
3738
: AbstractBrowserRefreshServer(middlewareAssemblyPath, logger, loggerFactory)
3839
{
@@ -44,6 +45,7 @@ protected override bool SuppressTimeouts
4445
protected override async ValueTask<WebServerHost> CreateAndStartHostAsync(CancellationToken cancellationToken)
4546
{
4647
var hostName = autoReloadWebSocketHostName ?? "127.0.0.1";
48+
var port = autoReloadWebSocketPort ?? 0;
4749

4850
var supportsTls = await IsTlsSupportedAsync(cancellationToken);
4951

@@ -53,11 +55,11 @@ protected override async ValueTask<WebServerHost> CreateAndStartHostAsync(Cancel
5355
builder.UseKestrel();
5456
if (supportsTls)
5557
{
56-
builder.UseUrls($"https://{hostName}:0", $"http://{hostName}:0");
58+
builder.UseUrls($"https://{hostName}:{port}", $"http://{hostName}:{port}");
5759
}
5860
else
5961
{
60-
builder.UseUrls($"http://{hostName}:0");
62+
builder.UseUrls($"http://{hostName}:{port}");
6163
}
6264

6365
builder.Configure(app =>

src/BuiltInTools/dotnet-watch/CommandLine/EnvironmentOptions.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ internal sealed record EnvironmentOptions(
3636
bool SuppressEmojis = false,
3737
bool RestartOnRudeEdit = false,
3838
string? AutoReloadWebSocketHostName = null,
39+
int? AutoReloadWebSocketPort = null,
3940
string? BrowserPath = null,
4041
TestFlags TestFlags = TestFlags.None,
4142
string TestOutput = "")
@@ -53,6 +54,7 @@ internal sealed record EnvironmentOptions(
5354
SuppressEmojis: EnvironmentVariables.SuppressEmojis,
5455
RestartOnRudeEdit: EnvironmentVariables.RestartOnRudeEdit,
5556
AutoReloadWebSocketHostName: EnvironmentVariables.AutoReloadWSHostName,
57+
AutoReloadWebSocketPort: EnvironmentVariables.AutoReloadWSPort,
5658
BrowserPath: EnvironmentVariables.BrowserPath,
5759
TestFlags: EnvironmentVariables.TestFlags,
5860
TestOutput: EnvironmentVariables.TestOutputDir

src/BuiltInTools/dotnet-watch/CommandLine/EnvironmentVariables.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,18 @@ public static class Names
3939
public static bool SuppressBrowserRefresh => ReadBool(Names.SuppressBrowserRefresh);
4040

4141
public static TestFlags TestFlags => Environment.GetEnvironmentVariable("__DOTNET_WATCH_TEST_FLAGS") is { } value ? Enum.Parse<TestFlags>(value) : TestFlags.None;
42-
public static string TestOutputDir => Environment.GetEnvironmentVariable("__DOTNET_WATCH_TEST_OUTPUT_DIR") ?? "";
42+
public static string TestOutputDir => Environment.GetEnvironmentVariable("__DOTNET_WATCH_TEST_OUTPUT_DIR") ?? "";
4343

4444
public static string? AutoReloadWSHostName => Environment.GetEnvironmentVariable("DOTNET_WATCH_AUTO_RELOAD_WS_HOSTNAME");
45+
public static int? AutoReloadWSPort => ReadInt("DOTNET_WATCH_AUTO_RELOAD_WS_PORT");
4546
public static string? BrowserPath => Environment.GetEnvironmentVariable("DOTNET_WATCH_BROWSER_PATH");
4647

4748
private static bool ReadBool(string variableName)
4849
=> Environment.GetEnvironmentVariable(variableName) is var value && (value == "1" || bool.TryParse(value, out var boolValue) && boolValue);
4950

5051
private static TimeSpan? ReadTimeSpan(string variableName)
5152
=> Environment.GetEnvironmentVariable(variableName) is var value && long.TryParse(value, out var intValue) && intValue >= 0 ? TimeSpan.FromMilliseconds(intValue) : null;
53+
54+
private static int? ReadInt(string variableName)
55+
=> Environment.GetEnvironmentVariable(variableName) is var value && int.TryParse(value, out var intValue) ? intValue : null;
5256
}

src/BuiltInTools/dotnet-watch/HotReload/AppModels/WebApplicationAppModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ private static string GetMiddlewareAssemblyPath()
6060
middlewareAssemblyPath: GetMiddlewareAssemblyPath(),
6161
dotnetPath: context.EnvironmentOptions.MuxerPath,
6262
autoReloadWebSocketHostName: context.EnvironmentOptions.AutoReloadWebSocketHostName,
63+
autoReloadWebSocketPort: context.EnvironmentOptions.AutoReloadWebSocketPort,
6364
suppressTimeouts: context.EnvironmentOptions.TestFlags != TestFlags.None);
6465
}
6566

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.TargetFrameworkInference.targets

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,15 @@ Copyright (c) .NET Foundation. All rights reserved.
134134
<TFTelemetry Include="OutputType" Value="$(OutputType)" />
135135
<TFTelemetry Include="UseArtifactsOutput" Value="$(UseArtifactsOutput)" />
136136
<TFTelemetry Include="ArtifactsPathLocationType" Value="$(_ArtifactsPathLocationType)" />
137+
<TFTelemetry Include="TargetPlatformIdentifier" Value="$(TargetPlatformIdentifier)" />
138+
<TFTelemetry Include="UseMonoRuntime" Value="$(UseMonoRuntime)" />
139+
<TFTelemetry Include="PublishAot" Value="$(PublishAot)" />
140+
<TFTelemetry Include="PublishTrimmed" Value="$(PublishTrimmed)" />
141+
<TFTelemetry Include="PublishSelfContained" Value="$(PublishSelfContained)" />
142+
<TFTelemetry Include="PublishReadyToRun" Value="$(PublishReadyToRun)" />
143+
<TFTelemetry Include="PublishReadyToRunComposite" Value="$(PublishReadyToRunComposite)" />
144+
<TFTelemetry Include="PublishProtocol" Value="$(PublishProtocol)" />
145+
<TFTelemetry Include="Configuration" Value="$(Configuration)" />
137146
</ItemGroup>
138147
<AllowEmptyTelemetry EventName="targetframeworkeval" EventData="@(TFTelemetry)" />
139148
</Target>

test/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildANetCoreAppForTelemetry.cs

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,27 @@ public GivenThatWeWantToBuildANetCoreAppAndPassingALogger(ITestOutputHelper log)
1111
{
1212
}
1313

14+
private string CreateTargetFrameworkEvalTelemetryJson(
15+
string targetFrameworkVersion,
16+
string targetPlatformIdentifier = "null",
17+
string runtimeIdentifier = "null",
18+
string selfContained = "null",
19+
string useApphost = "null",
20+
string outputType = "Library",
21+
string useArtifactsOutput = "null",
22+
string artifactsPathLocationType = "null",
23+
string useMonoRuntime = "null",
24+
string publishAot = "null",
25+
string publishTrimmed = "null",
26+
string publishSelfContained = "null",
27+
string publishReadyToRun = "null",
28+
string publishReadyToRunComposite = "false",
29+
string publishProtocol = "null",
30+
string configuration = "Debug")
31+
{
32+
return $"{{\"EventName\":\"targetframeworkeval\",\"Properties\":{{\"TargetFrameworkVersion\":\"{targetFrameworkVersion}\",\"RuntimeIdentifier\":\"{runtimeIdentifier}\",\"SelfContained\":\"{selfContained}\",\"UseApphost\":\"{useApphost}\",\"OutputType\":\"{outputType}\",\"UseArtifactsOutput\":\"{useArtifactsOutput}\",\"ArtifactsPathLocationType\":\"{artifactsPathLocationType}\",\"TargetPlatformIdentifier\":\"{targetPlatformIdentifier}\",\"UseMonoRuntime\":\"{useMonoRuntime}\",\"PublishAot\":\"{publishAot}\",\"PublishTrimmed\":\"{publishTrimmed}\",\"PublishSelfContained\":\"{publishSelfContained}\",\"PublishReadyToRun\":\"{publishReadyToRun}\",\"PublishReadyToRunComposite\":\"{publishReadyToRunComposite}\",\"PublishProtocol\":\"{publishProtocol}\",\"Configuration\":\"{configuration}\"}}";
33+
}
34+
1435
[CoreMSBuildOnlyFact]
1536
public void It_collects_TargetFramework_version_and_other_properties()
1637
{
@@ -32,7 +53,8 @@ public void It_collects_TargetFramework_version_and_other_properties()
3253
buildCommand
3354
.Execute(TelemetryTestLogger)
3455
.StdOut.Should()
35-
.Contain($"{{\"EventName\":\"targetframeworkeval\",\"Properties\":{{\"TargetFrameworkVersion\":\".NETCoreApp,Version=v{ToolsetInfo.CurrentTargetFrameworkVersion}\",\"RuntimeIdentifier\":\"null\",\"SelfContained\":\"null\",\"UseApphost\":\"null\",\"OutputType\":\"Library\",\"UseArtifactsOutput\":\"null\",\"ArtifactsPathLocationType\":\"null\"}}");
56+
.Contain(CreateTargetFrameworkEvalTelemetryJson(
57+
$".NETCoreApp,Version=v{ToolsetInfo.CurrentTargetFrameworkVersion}"));
3658
}
3759

3860
[CoreMSBuildOnlyFact]
@@ -59,11 +81,13 @@ public void It_collects_multi_TargetFramework_version_and_other_properties()
5981

6082
result
6183
.StdOut.Should()
62-
.Contain(
63-
"{\"EventName\":\"targetframeworkeval\",\"Properties\":{\"TargetFrameworkVersion\":\".NETFramework,Version=v4.6\",\"RuntimeIdentifier\":\"null\",\"SelfContained\":\"null\",\"UseApphost\":\"null\",\"OutputType\":\"Library\",\"UseArtifactsOutput\":\"null\",\"ArtifactsPathLocationType\":\"null\"}")
84+
.Contain(CreateTargetFrameworkEvalTelemetryJson(
85+
".NETFramework,Version=v4.6",
86+
targetPlatformIdentifier: "Windows",
87+
publishReadyToRunComposite: "null"))
6488
.And
65-
.Contain(
66-
$"{{\"EventName\":\"targetframeworkeval\",\"Properties\":{{\"TargetFrameworkVersion\":\".NETCoreApp,Version=v{ToolsetInfo.CurrentTargetFrameworkVersion}\",\"RuntimeIdentifier\":\"null\",\"SelfContained\":\"null\",\"UseApphost\":\"null\",\"OutputType\":\"Library\",\"UseArtifactsOutput\":\"null\",\"ArtifactsPathLocationType\":\"null\"}}");
89+
.Contain(CreateTargetFrameworkEvalTelemetryJson(
90+
$".NETCoreApp,Version=v{ToolsetInfo.CurrentTargetFrameworkVersion}"));
6791
}
6892
}
6993
}

0 commit comments

Comments
 (0)