diff --git a/.azure/pipelines/blazor-daily-tests.yml b/.azure/pipelines/blazor-daily-tests.yml
deleted file mode 100644
index 537751bfed6b..000000000000
--- a/.azure/pipelines/blazor-daily-tests.yml
+++ /dev/null
@@ -1,59 +0,0 @@
-# Uses Scheduled Triggers, which aren't supported in YAML yet.
-# https://docs.microsoft.com/en-us/azure/devops/pipelines/build/triggers?view=vsts&tabs=yaml#scheduled
-
-# Daily Tests for Blazor
-# These use Sauce Labs resources, hence they run daily rather than per-commit.
-
-# We just need one Windows machine because all it does is trigger SauceLabs.
-variables:
- SAUCE_CONNECT_DOWNLOAD_ON_INSTALL: true
- E2ETESTS_SauceTest: true
- E2ETESTS_Sauce__TunnelIdentifier: 'blazor-e2e-sc-proxy-tunnel'
- E2ETESTS_Sauce__HostName: 'sauce.local'
-jobs:
-- template: jobs/default-build.yml
- parameters:
- buildDirectory: src/Components
- isTestingJob: true
- agentOs: Windows
- jobName: BlazorDailyTests
- jobDisplayName: "Blazor Daily Tests"
- afterBuild:
-
- # macOS/Safari
- - script: 'dotnet test --filter "StandaloneAppTest"'
- workingDirectory: 'src/Components/test/E2ETest'
- displayName: 'Run Blazor tests - macOS/Safari'
- condition: succeededOrFailed()
- env:
- # Secrets need to be explicitly mapped to env variables.
- E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
- E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
- # Set platform/browser configuration.
- E2ETESTS_Sauce__TestName: 'Blazor Daily Tests - macOS/Safari'
- E2ETESTS_Sauce__PlatformName: 'macOS 10.14'
- E2ETESTS_Sauce__BrowserName: 'Safari'
- # Need to explicitly set version here because some older versions don't support timeouts in Safari.
- E2ETESTS_Sauce__SeleniumVersion: '3.4.0'
-
- # Android/Chrome
- - script: 'dotnet test --filter "StandaloneAppTest"'
- workingDirectory: 'src/Components/test/E2ETest'
- displayName: 'Run Blazor tests - Android/Chrome'
- condition: succeededOrFailed()
- env:
- # Secrets need to be explicitly mapped to env variables.
- E2ETESTS_Sauce__Username: '$(asplab-sauce-labs-username)'
- E2ETESTS_Sauce__AccessKey: '$(asplab-sauce-labs-access-key)'
- # Set platform/browser configuration.
- E2ETESTS_Sauce__TestName: 'Blazor Daily Tests - Android/Chrome'
- E2ETESTS_Sauce__PlatformName: 'Android'
- E2ETESTS_Sauce__PlatformVersion: '10.0'
- E2ETESTS_Sauce__BrowserName: 'Chrome'
- E2ETESTS_Sauce__DeviceName: 'Android GoogleAPI Emulator'
- E2ETESTS_Sauce__DeviceOrientation: 'portrait'
- E2ETESTS_Sauce__AppiumVersion: '1.9.1'
- artifacts:
- - name: Windows_Logs
- path: ../../artifacts/log/
- publishOnError: true
\ No newline at end of file
diff --git a/Directory.Build.targets b/Directory.Build.targets
index a91198a327ce..34e36b4b06bd 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -131,7 +131,7 @@
- $(AspNetCoreMajorMinorVersion).0.0
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).0.0
diff --git a/eng/Versions.props b/eng/Versions.props
index 0261b4b23076..4fcd41e8baaf 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -29,18 +29,18 @@
true
true
- $(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion)
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion)
$(VersionPrefix)
- $(AspNetCoreMajorMinorVersion).0
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).0
0.3.$(AspNetCorePatchVersion)
$([MSBuild]::Add(10, $(AspNetCoreMajorVersion)))
$(AspNetCoreMinorVersion)
$(AspNetCorePatchVersion)
- $(AspNetCoreMajorMinorVersion).$([MSBuild]::Subtract($(AspNetCorePatchVersion), 1))
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$([MSBuild]::Subtract($(AspNetCorePatchVersion), 1))
diff --git a/eng/helix/content/RunTests/RunTestsOptions.cs b/eng/helix/content/RunTests/RunTestsOptions.cs
index 5bb6b46a308f..bd611ef46ee5 100644
--- a/eng/helix/content/RunTests/RunTestsOptions.cs
+++ b/eng/helix/content/RunTests/RunTestsOptions.cs
@@ -60,11 +60,6 @@ public static RunTestsOptions Parse(string[] args)
aliases: new string[] { "--helixTimeout" },
description: "The timeout duration of the Helix job")
{ Argument = new Argument(), Required = true },
-
- new Option(
- aliases: new string[] { "--source" },
- description: "The restore sources to use during testing")
- { Argument = new Argument() { Arity = ArgumentArity.ZeroOrMore }, Required = true }
};
var parseResult = command.Parse(args);
@@ -78,7 +73,6 @@ public static RunTestsOptions Parse(string[] args)
options.AspNetRuntime = parseResult.ValueForOption("--aspnetruntime");
options.AspNetRef = parseResult.ValueForOption("--aspnetref");
options.Timeout = TimeSpan.Parse(parseResult.ValueForOption("--helixTimeout"));
- options.Source = parseResult.ValueForOption>("--source");
options.HELIX_WORKITEM_ROOT = Environment.GetEnvironmentVariable("HELIX_WORKITEM_ROOT");
options.Path = Environment.GetEnvironmentVariable("PATH");
options.DotnetRoot = Environment.GetEnvironmentVariable("DOTNET_ROOT");
@@ -97,7 +91,6 @@ public static RunTestsOptions Parse(string[] args)
public string HELIX_WORKITEM_ROOT { get; set;}
public string DotnetRoot { get; set; }
public string Path { get; set; }
- public IEnumerable Source { get; set; }
public TimeSpan Timeout { get; set; }
}
}
diff --git a/eng/helix/content/RunTests/TestRunner.cs b/eng/helix/content/RunTests/TestRunner.cs
index 8722306e0993..4eb8c903e2c5 100644
--- a/eng/helix/content/RunTests/TestRunner.cs
+++ b/eng/helix/content/RunTests/TestRunner.cs
@@ -126,16 +126,13 @@ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
throwOnError: false,
cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);
- foreach (var restoreSource in Options.Source)
- {
- await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
- $"nuget add source {restoreSource} --configfile NuGet.config",
- environmentVariables: EnvironmentVariables,
- outputDataReceived: Console.WriteLine,
- errorDataReceived: Console.Error.WriteLine,
- throwOnError: false,
- cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);
- }
+ await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
+ "nuget add source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --configfile NuGet.config",
+ environmentVariables: EnvironmentVariables,
+ outputDataReceived: Console.WriteLine,
+ errorDataReceived: Console.Error.WriteLine,
+ throwOnError: false,
+ cancellationToken: new CancellationTokenSource(TimeSpan.FromMinutes(2)).Token);
// Write nuget sources to console, useful for debugging purposes
await ProcessUtil.RunAsync($"{Options.DotnetRoot}/dotnet",
@@ -250,7 +247,7 @@ public async Task RunTestsAsync()
{
// Timeout test run 5 minutes before the Helix job would timeout
var cts = new CancellationTokenSource(Options.Timeout.Subtract(TimeSpan.FromMinutes(5)));
- var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\"";
+ var commonTestArgs = $"test {Options.Target} --logger:xunit --logger:\"console;verbosity=normal\" --blame \"CollectHangDump;TestTimeout=5m\"";
if (Options.Quarantined)
{
Console.WriteLine("Running quarantined tests.");
@@ -349,7 +346,7 @@ public void UploadResults()
else
{
Console.WriteLine("No dmps found in TestResults");
- }
+ }
}
}
}
diff --git a/eng/helix/content/runtests.cmd b/eng/helix/content/runtests.cmd
index a3f1491d2f50..af984dd88274 100644
--- a/eng/helix/content/runtests.cmd
+++ b/eng/helix/content/runtests.cmd
@@ -30,11 +30,11 @@ echo "Invoking InstallDotNet.ps1 %$arch% %$sdkVersion% %$runtimeVersion% %DOTNET
powershell.exe -NoProfile -ExecutionPolicy unrestricted -file InstallDotNet.ps1 %$arch% %$sdkVersion% %$runtimeVersion% %DOTNET_ROOT%
set exit_code=0
-echo "Restore: dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources"
-dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources
+echo "Restore: dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources..."
+dotnet restore RunTests\RunTests.csproj --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://api.nuget.org/v3/index.json --ignore-failed-sources
-echo "Running tests: dotnet run --project RunTests\RunTests.csproj -- --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%"
-dotnet run --project RunTests\RunTests.csproj -- --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json --source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
+echo "Running tests: dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%..."
+dotnet run --project RunTests\RunTests.csproj -- --target %$target% --runtime %$aspRuntimeVersion% --queue %$queue% --arch %$arch% --quarantined %$quarantined% --ef %$ef% --aspnetruntime %$aspnetruntime% --aspnetref %$aspnetref% --helixTimeout %$helixTimeout%
if errorlevel neq 0 (
set exit_code=%errorlevel%
)
diff --git a/src/Components/Components/src/ComponentBase.cs b/src/Components/Components/src/ComponentBase.cs
index 6d4eb6109554..dd80af0fd3bf 100644
--- a/src/Components/Components/src/ComponentBase.cs
+++ b/src/Components/Components/src/ComponentBase.cs
@@ -200,8 +200,9 @@ void IComponent.Attach(RenderHandle renderHandle)
/// A that completes when the component has finished updating and rendering itself.
///
///
- /// Parameters are passed when is called. It is not required that
- /// the caller supply a parameter value for all of the parameters that are logically understood by the component.
+ /// The method should be passed the entire set of parameter values each
+ /// time is called. It not required that the caller supply a parameter
+ /// value for all parameters that are logically understood by the component.
///
///
/// The default implementation of will set the value of each property
diff --git a/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj b/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj
index 8b58eb02dd68..2d7aabeee71c 100644
--- a/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj
+++ b/src/Components/WebAssembly/JSInterop/src/Microsoft.JSInterop.WebAssembly.csproj
@@ -1,4 +1,4 @@
-
+
$(DefaultNetCoreTargetFramework)
@@ -12,4 +12,8 @@
+
+
+
+
diff --git a/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs b/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs
index 14e1600b9f33..cbc07b36a92c 100644
--- a/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs
+++ b/src/Components/WebAssembly/JSInterop/src/WebAssemblyJSRuntime.cs
@@ -78,7 +78,7 @@ TResult IJSUnmarshalledRuntime.InvokeUnmarshalled(string id
var callInfo = new JSCallInfo
{
FunctionIdentifier = identifier,
- ResultType = ResultTypeFromGeneric()
+ ResultType = JSCallResultTypeHelper.FromGeneric()
};
var result = InternalCalls.InvokeJS(out var exception, ref callInfo, arg0, arg1, arg2);
diff --git a/src/Components/test/testassets/BasicTestApp/InteropComponent.razor b/src/Components/test/testassets/BasicTestApp/InteropComponent.razor
index b24da1366bd6..388e74549331 100644
--- a/src/Components/test/testassets/BasicTestApp/InteropComponent.razor
+++ b/src/Components/test/testassets/BasicTestApp/InteropComponent.razor
@@ -137,7 +137,7 @@
ReturnValues["returnArray"] = string.Join(",", ((IJSInProcessRuntime)JSRuntime).Invoke("returnArray").Select(x => x.Source).ToArray());
}
- var jsObjectReference = await JSRuntime.InvokeAsync("returnJSObjectReference");
+ var jsObjectReference = await JSRuntime.InvokeAsync("returnJSObjectReference");
ReturnValues["jsObjectReference.identity"] = await jsObjectReference.InvokeAsync("identity", "Invoked from JSObjectReference");
ReturnValues["jsObjectReference.nested.add"] = (await jsObjectReference.InvokeAsync("nested.add", 2, 3)).ToString();
ReturnValues["addViaJSObjectReference"] = (await JSRuntime.InvokeAsync("addViaJSObjectReference", jsObjectReference, 2, 3)).ToString();
@@ -151,7 +151,7 @@
JSObjectReferenceInvokeNonFunctionException = e;
}
- var module = await JSRuntime.InvokeAsync("import", "./js/testmodule.js");
+ var module = await JSRuntime.InvokeAsync("import", "./js/testmodule.js");
ReturnValues["jsObjectReferenceModule"] = await module.InvokeAsync("identity", "Returned from module!");
if (shouldSupportSyncInterop)
@@ -192,7 +192,7 @@
{
var inProcRuntime = ((IJSInProcessRuntime)JSRuntime);
- var jsInProcObjectReference = inProcRuntime.Invoke("returnJSObjectReference");
+ var jsInProcObjectReference = inProcRuntime.Invoke("returnJSObjectReference");
ReturnValues["jsInProcessObjectReference.identity"] = jsInProcObjectReference.Invoke("identity", "Invoked from JSInProcessObjectReference");
}
diff --git a/src/Components/test/testassets/BasicTestApp/InteropTest/JavaScriptInterop.cs b/src/Components/test/testassets/BasicTestApp/InteropTest/JavaScriptInterop.cs
index 8667bdc2c61f..55fc6e8fc679 100644
--- a/src/Components/test/testassets/BasicTestApp/InteropTest/JavaScriptInterop.cs
+++ b/src/Components/test/testassets/BasicTestApp/InteropTest/JavaScriptInterop.cs
@@ -415,20 +415,20 @@ public static int ExtractNonSerializedValue(DotNetObjectReference objec
}
[JSInvokable]
- public static JSObjectReference RoundTripJSObjectReference(JSObjectReference jsObjectReference)
+ public static IJSObjectReference RoundTripJSObjectReference(IJSObjectReference jsObjectReference)
{
return jsObjectReference;
}
[JSInvokable]
- public static async Task RoundTripJSObjectReferenceAsync(JSObjectReference jSObjectReference)
+ public static async Task RoundTripJSObjectReferenceAsync(IJSObjectReference jSObjectReference)
{
await Task.Yield();
return jSObjectReference;
}
[JSInvokable]
- public static string InvokeDisposedJSObjectReferenceException(JSInProcessObjectReference jsObjectReference)
+ public static string InvokeDisposedJSObjectReferenceException(IJSInProcessObjectReference jsObjectReference)
{
try
{
@@ -442,7 +442,7 @@ public static string InvokeDisposedJSObjectReferenceException(JSInProcessObjectR
}
[JSInvokable]
- public static async Task InvokeDisposedJSObjectReferenceExceptionAsync(JSObjectReference jsObjectReference)
+ public static async Task InvokeDisposedJSObjectReferenceExceptionAsync(IJSObjectReference jsObjectReference)
{
try
{
diff --git a/src/Framework/Directory.Build.props b/src/Framework/Directory.Build.props
index 13342f6cde8e..7e8014e865f1 100644
--- a/src/Framework/Directory.Build.props
+++ b/src/Framework/Directory.Build.props
@@ -7,8 +7,8 @@
PlatformManifest.txt
$(ArtifactsObjDir)$(PlatformManifestFileName)
-
- $(AspNetCoreMajorMinorVersion).0
+
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).0
$(ReferencePackSharedFxVersion)-$(VersionSuffix)
diff --git a/src/Installers/Debian/Runtime/Debian.Runtime.debproj b/src/Installers/Debian/Runtime/Debian.Runtime.debproj
index c780e24d2bf9..70931ff3a4ed 100644
--- a/src/Installers/Debian/Runtime/Debian.Runtime.debproj
+++ b/src/Installers/Debian/Runtime/Debian.Runtime.debproj
@@ -8,7 +8,7 @@
$(SharedFrameworkLayoutRoot)
- $(RuntimeInstallerBaseName)-$(AspNetCoreMajorMinorVersion)
+ $(RuntimeInstallerBaseName)-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)
$(MicrosoftNETCoreAppRuntimeVersion)
diff --git a/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj b/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj
index 5e4282a631f3..43eba9135887 100644
--- a/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj
+++ b/src/Installers/Debian/TargetingPack/Debian.TargetingPack.debproj
@@ -8,10 +8,10 @@
$(TargetingPackLayoutRoot)
- $(TargetingPackInstallerBaseName)-$(AspNetCoreMajorMinorVersion)
+ $(TargetingPackInstallerBaseName)-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)
ASP.NET Core Targeting Pack
- Provides a default set of APIs for building an ASP.NET Core $(AspNetCoreMajorMinorVersion) application. Contains reference assemblies, documentation, and other design-time assets.
+ Provides a default set of APIs for building an ASP.NET Core $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion) application. Contains reference assemblies, documentation, and other design-time assets.
$(MicrosoftNETCoreAppRefPackageVersion)
diff --git a/src/Installers/Rpm/Rpm.Runtime.Common.targets b/src/Installers/Rpm/Rpm.Runtime.Common.targets
index 18a9975c0fe6..dea8c0148d67 100644
--- a/src/Installers/Rpm/Rpm.Runtime.Common.targets
+++ b/src/Installers/Rpm/Rpm.Runtime.Common.targets
@@ -4,8 +4,8 @@
- $(RuntimeInstallerBaseName)-$(AspNetCoreMajorMinorVersion)
- $(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion)
+ $(RuntimeInstallerBaseName)-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion)
1
@@ -24,6 +24,6 @@
-
+
diff --git a/src/Installers/Rpm/TargetingPack/Rpm.TargetingPack.rpmproj b/src/Installers/Rpm/TargetingPack/Rpm.TargetingPack.rpmproj
index 688e9de95efe..38f5fbf78bb6 100644
--- a/src/Installers/Rpm/TargetingPack/Rpm.TargetingPack.rpmproj
+++ b/src/Installers/Rpm/TargetingPack/Rpm.TargetingPack.rpmproj
@@ -8,10 +8,10 @@
- $(TargetingPackInstallerBaseName)-$(AspNetCoreMajorMinorVersion)
+ $(TargetingPackInstallerBaseName)-$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion)
ASP.NET Core Targeting Pack
- Provides a default set of APIs for building an ASP.NET Core $(AspNetCoreMajorMinorVersion) application. Contains reference assemblies, documentation, and other design-time assets.
+ Provides a default set of APIs for building an ASP.NET Core $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion) application. Contains reference assemblies, documentation, and other design-time assets.
@@ -21,7 +21,7 @@
-
+
diff --git a/src/Installers/Windows/AspNetCoreModule-Setup/Directory.Build.props b/src/Installers/Windows/AspNetCoreModule-Setup/Directory.Build.props
index cf5ef5f48827..d08b147e4ae5 100644
--- a/src/Installers/Windows/AspNetCoreModule-Setup/Directory.Build.props
+++ b/src/Installers/Windows/AspNetCoreModule-Setup/Directory.Build.props
@@ -15,7 +15,7 @@
$(BUILD_MINOR)
- 1$(AspNetCoreMajorMinorVersion).$(BUILD_MAJOR)
+ 1$(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(BUILD_MAJOR)
$(ANCMFolderVersion).0
- $(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion).0
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion).0
<_FileRevisionVersion>$(VersionSuffixDateStamp)
<_FileRevisionVersion Condition=" '$(_FileRevisionVersion)' == '' ">42424
- $(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion).$(_FileRevisionVersion)
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion).$(_FileRevisionVersion)
$(DefineConstants);MajorVersion=$(AspNetCoreMajorVersion)
$(DefineConstants);MinorVersion=$(AspNetCoreMinorVersion)
@@ -56,7 +56,7 @@
the upgrade code. Bundle upgrades pivot on Major.Minor.Patch changes. For example, 3.0.1-preview 1 can upgrade to 3.0.1-preview 8, but 3.0.1
cannot upgrade to 3.0.2 or 3.1. -->
- $(AspNetCoreMajorMinorVersion).$(AspNetCorePatchVersion);$(Platform)
+ $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion);$(Platform)
diff --git a/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessObjectReference.cs
new file mode 100644
index 000000000000..2c3cbbde6926
--- /dev/null
+++ b/src/JSInterop/Microsoft.JSInterop/src/IJSInProcessObjectReference.cs
@@ -0,0 +1,20 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+namespace Microsoft.JSInterop
+{
+ ///
+ /// Represents a reference to a JavaScript object whose functions can be invoked synchronously.
+ ///
+ public interface IJSInProcessObjectReference : IJSObjectReference
+ {
+ ///
+ /// Invokes the specified JavaScript function synchronously.
+ ///
+ /// The JSON-serializable return type.
+ /// An identifier for the function to invoke. For example, the value "someScope.someFunction" will invoke the function someScope.someFunction on the target instance.
+ /// JSON-serializable arguments.
+ /// An instance of obtained by JSON-deserializing the return value.
+ TValue Invoke(string identifier, params object?[]? args);
+ }
+}
diff --git a/src/JSInterop/Microsoft.JSInterop/src/IJSObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/IJSObjectReference.cs
new file mode 100644
index 000000000000..43e67f0cb18b
--- /dev/null
+++ b/src/JSInterop/Microsoft.JSInterop/src/IJSObjectReference.cs
@@ -0,0 +1,41 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace Microsoft.JSInterop
+{
+ ///
+ /// Represents a reference to a JavaScript object.
+ ///
+ public interface IJSObjectReference : IAsyncDisposable
+ {
+ ///
+ /// Invokes the specified JavaScript function asynchronously.
+ ///
+ /// will apply timeouts to this operation based on the value configured in . To dispatch a call with a different, or no timeout,
+ /// consider using .
+ ///
+ ///
+ /// The JSON-serializable return type.
+ /// An identifier for the function to invoke. For example, the value "someScope.someFunction" will invoke the function someScope.someFunction on the target instance.
+ /// JSON-serializable arguments.
+ /// An instance of obtained by JSON-deserializing the return value.
+ ValueTask InvokeAsync(string identifier, object?[]? args);
+
+ ///
+ /// Invokes the specified JavaScript function asynchronously.
+ ///
+ /// The JSON-serializable return type.
+ /// An identifier for the function to invoke. For example, the value "someScope.someFunction" will invoke the function someScope.someFunction on the target instance.
+ ///
+ /// A cancellation token to signal the cancellation of the operation. Specifying this parameter will override any default cancellations such as due to timeouts
+ /// () from being applied.
+ ///
+ /// JSON-serializable arguments.
+ /// An instance of obtained by JSON-deserializing the return value.
+ ValueTask InvokeAsync(string identifier, CancellationToken cancellationToken, object?[]? args);
+ }
+}
diff --git a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSObjectReferenceJsonConverter.cs b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSObjectReferenceJsonConverter.cs
index f26efa92a138..d18f7092b614 100644
--- a/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSObjectReferenceJsonConverter.cs
+++ b/src/JSInterop/Microsoft.JSInterop/src/Infrastructure/JSObjectReferenceJsonConverter.cs
@@ -7,17 +7,21 @@
namespace Microsoft.JSInterop.Infrastructure
{
- internal sealed class JSObjectReferenceJsonConverter
- : JsonConverter where TJSObjectReference : JSObjectReference
+ internal sealed class JSObjectReferenceJsonConverter : JsonConverter
+ where TInterface : class, IJSObjectReference
+ where TImplementation : JSObjectReference, TInterface
{
- private readonly Func _jsObjectReferenceFactory;
+ private readonly Func _jsObjectReferenceFactory;
- public JSObjectReferenceJsonConverter(Func jsObjectReferenceFactory)
+ public JSObjectReferenceJsonConverter(Func jsObjectReferenceFactory)
{
_jsObjectReferenceFactory = jsObjectReferenceFactory;
}
- public override TJSObjectReference? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
+ public override bool CanConvert(Type typeToConvert)
+ => typeToConvert == typeof(TInterface) || typeToConvert == typeof(TImplementation);
+
+ public override TInterface? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
long id = -1;
@@ -49,10 +53,10 @@ public JSObjectReferenceJsonConverter(Func jsObjectRef
return _jsObjectReferenceFactory(id);
}
- public override void Write(Utf8JsonWriter writer, TJSObjectReference value, JsonSerializerOptions options)
+ public override void Write(Utf8JsonWriter writer, TInterface value, JsonSerializerOptions options)
{
writer.WriteStartObject();
- writer.WriteNumber(JSObjectReference.IdKey, value.Id);
+ writer.WriteNumber(JSObjectReference.IdKey, ((TImplementation)value).Id);
writer.WriteEndObject();
}
}
diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSInProcessObjectReference.cs b/src/JSInterop/Microsoft.JSInterop/src/JSInProcessObjectReference.cs
index bd97a8f7a071..44dcba72874d 100644
--- a/src/JSInterop/Microsoft.JSInterop/src/JSInProcessObjectReference.cs
+++ b/src/JSInterop/Microsoft.JSInterop/src/JSInProcessObjectReference.cs
@@ -5,10 +5,7 @@
namespace Microsoft.JSInterop
{
- ///
- /// Represents a reference to a JavaScript object whose functions can be invoked synchronously.
- ///
- public class JSInProcessObjectReference : JSObjectReference
+ internal class JSInProcessObjectReference : JSObjectReference, IJSInProcessObjectReference
{
private readonly JSInProcessRuntime _jsRuntime;
@@ -17,15 +14,8 @@ internal JSInProcessObjectReference(JSInProcessRuntime jsRuntime, long id) : bas
_jsRuntime = jsRuntime;
}
- ///
- /// Invokes the specified JavaScript function synchronously.
- ///
- /// The JSON-serializable return type.
- /// An identifier for the function to invoke. For example, the value "someScope.someFunction" will invoke the function someScope.someFunction on the target instance.
- /// JSON-serializable arguments.
- /// An instance of obtained by JSON-deserializing the return value.
[return: MaybeNull]
- public TValue Invoke(string identifier, params object[] args)
+ public TValue Invoke(string identifier, params object?[]? args)
{
ThrowIfDisposed();
diff --git a/src/JSInterop/Microsoft.JSInterop/src/JSInProcessObjectReferenceExtensions.cs b/src/JSInterop/Microsoft.JSInterop/src/JSInProcessObjectReferenceExtensions.cs
new file mode 100644
index 000000000000..57b9cc66fe46
--- /dev/null
+++ b/src/JSInterop/Microsoft.JSInterop/src/JSInProcessObjectReferenceExtensions.cs
@@ -0,0 +1,26 @@
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using System;
+
+namespace Microsoft.JSInterop
+{
+ public static class JSInProcessObjectReferenceExtensions
+ {
+ ///
+ /// Invokes the specified JavaScript function synchronously.
+ ///
+ /// The .
+ /// An identifier for the function to invoke. For example, the value "someScope.someFunction" will invoke the function someScope.someFunction on the target instance.
+ /// JSON-serializable arguments.
+ public static void InvokeVoid(this IJSInProcessObjectReference jsObjectReference, string identifier, params object?[] args)
+ {
+ if (jsObjectReference == null)
+ {
+ throw new ArgumentNullException(nameof(jsObjectReference));
+ }
+
+ jsObjectReference.Invoke