diff --git a/eng/tools/RepoTasks/DownloadFile.cs b/eng/tools/RepoTasks/DownloadFile.cs
new file mode 100644
index 0000000000..7ba2602d0c
--- /dev/null
+++ b/eng/tools/RepoTasks/DownloadFile.cs
@@ -0,0 +1,149 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.IO;
+using System.Net;
+using System.Net.Http;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using Microsoft.Build.Framework;
+using Microsoft.Build.Utilities;
+
+namespace RepoTasks
+{
+ public class DownloadFile : Microsoft.Build.Utilities.Task
+ {
+ [Required]
+ public string Uri { get; set; }
+
+ ///
+ /// If this field is set and the task fail to download the file from `Uri`, with a NotFound
+ /// status, it will try to download the file from `PrivateUri`.
+ ///
+ public string PrivateUri { get; set; }
+
+ ///
+ /// Suffix for the private URI in base64 form (for SAS compatibility)
+ ///
+ public string PrivateUriSuffix { get; set; }
+
+ public int MaxRetries { get; set; } = 5;
+
+ [Required]
+ public string DestinationPath { get; set; }
+
+ public bool Overwrite { get; set; }
+
+ public override bool Execute()
+ {
+ return ExecuteAsync().GetAwaiter().GetResult();
+ }
+
+ private async System.Threading.Tasks.Task ExecuteAsync()
+ {
+ string destinationDir = Path.GetDirectoryName(DestinationPath);
+ if (!Directory.Exists(destinationDir))
+ {
+ Directory.CreateDirectory(destinationDir);
+ }
+
+ if (File.Exists(DestinationPath) && !Overwrite)
+ {
+ return true;
+ }
+
+ const string FileUriProtocol = "file://";
+
+ if (Uri.StartsWith(FileUriProtocol, StringComparison.Ordinal))
+ {
+ var filePath = Uri.Substring(FileUriProtocol.Length);
+ Log.LogMessage($"Copying '{filePath}' to '{DestinationPath}'");
+ File.Copy(filePath, DestinationPath);
+ return true;
+ }
+
+ List errorMessages = new List();
+ bool? downloadStatus = await DownloadWithRetriesAsync(Uri, DestinationPath, errorMessages);
+
+ if (downloadStatus == false && !string.IsNullOrEmpty(PrivateUri))
+ {
+ string uriSuffix = "";
+ if (!string.IsNullOrEmpty(PrivateUriSuffix))
+ {
+ var uriSuffixBytes = System.Convert.FromBase64String(PrivateUriSuffix);
+ uriSuffix = System.Text.Encoding.UTF8.GetString(uriSuffixBytes);
+ }
+ downloadStatus = await DownloadWithRetriesAsync($"{PrivateUri}{uriSuffix}", DestinationPath, errorMessages);
+ }
+
+ if (downloadStatus != true)
+ {
+ foreach (var error in errorMessages)
+ {
+ Log.LogError(error);
+ }
+ }
+
+ return downloadStatus == true;
+ }
+
+ ///
+ /// Attempt to download file from `source` with retries when response error is different of FileNotFound and Success.
+ ///
+ /// URL to the file to be downloaded.
+ /// Local path where to put the downloaded file.
+ /// true: Download Succeeded. false: Download failed with 404. null: Download failed but is retriable.
+ private async Task DownloadWithRetriesAsync(string source, string target, List errorMessages)
+ {
+ Random rng = new Random();
+
+ Log.LogMessage(MessageImportance.High, $"Attempting download '{source}' to '{target}'");
+
+ using (var httpClient = new HttpClient())
+ {
+ for (int retryNumber = 0; retryNumber < MaxRetries; retryNumber++)
+ {
+ try
+ {
+ var httpResponse = await httpClient.GetAsync(source);
+
+ Log.LogMessage(MessageImportance.High, $"{source} -> {httpResponse.StatusCode}");
+
+ // The Azure Storage REST API returns '400 - Bad Request' in some cases
+ // where the resource is not found on the storage.
+ // https://docs.microsoft.com/en-us/rest/api/storageservices/common-rest-api-error-codes
+ if (httpResponse.StatusCode == HttpStatusCode.NotFound ||
+ httpResponse.ReasonPhrase.IndexOf("The requested URI does not represent any resource on the server.", StringComparison.OrdinalIgnoreCase) == 0)
+ {
+ errorMessages.Add($"Problems downloading file from '{source}'. Does the resource exist on the storage? {httpResponse.StatusCode} : {httpResponse.ReasonPhrase}");
+ return false;
+ }
+
+ httpResponse.EnsureSuccessStatusCode();
+
+ using (var outStream = File.Create(target))
+ {
+ await httpResponse.Content.CopyToAsync(outStream);
+ }
+
+ Log.LogMessage(MessageImportance.High, $"returning true {source} -> {httpResponse.StatusCode}");
+ return true;
+ }
+ catch (Exception e)
+ {
+ Log.LogMessage(MessageImportance.High, $"returning error in {source} ");
+ errorMessages.Add($"Problems downloading file from '{source}'. {e.Message} {e.StackTrace}");
+ File.Delete(target);
+ }
+
+ await System.Threading.Tasks.Task.Delay(rng.Next(1000, 10000));
+ }
+ }
+
+ Log.LogMessage(MessageImportance.High, $"giving up {source} ");
+ errorMessages.Add($"Giving up downloading the file from '{source}' after {MaxRetries} retries.");
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/eng/tools/RepoTasks/RepoTasks.tasks b/eng/tools/RepoTasks/RepoTasks.tasks
index 0fa015d81f..631944feea 100644
--- a/eng/tools/RepoTasks/RepoTasks.tasks
+++ b/eng/tools/RepoTasks/RepoTasks.tasks
@@ -10,4 +10,5 @@
+
diff --git a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netcoreapp.cs b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netcoreapp.cs
index 8c989deda4..10a26b70af 100644
--- a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netcoreapp.cs
+++ b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netcoreapp.cs
@@ -123,6 +123,17 @@ namespace Microsoft.AspNetCore.Components
public ElementReference(string id) { throw null; }
public string Id { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct EventCallback
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public static readonly Microsoft.AspNetCore.Components.EventCallback Empty;
+ public static readonly Microsoft.AspNetCore.Components.EventCallbackFactory Factory;
+ public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
+ public bool HasDelegate { get { throw null; } }
+ public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
+ }
public sealed partial class EventCallbackFactory
{
public EventCallbackFactory() { }
@@ -186,6 +197,16 @@ namespace Microsoft.AspNetCore.Components
public EventCallbackWorkItem(System.MulticastDelegate @delegate) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
}
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct EventCallback
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public static readonly Microsoft.AspNetCore.Components.EventCallback Empty;
+ public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
+ public bool HasDelegate { get { throw null; } }
+ public System.Threading.Tasks.Task InvokeAsync(TValue arg) { throw null; }
+ }
[System.AttributeUsageAttribute(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed partial class EventHandlerAttribute : System.Attribute
{
diff --git a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs
index 8c989deda4..10a26b70af 100644
--- a/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs
+++ b/src/Components/Components/ref/Microsoft.AspNetCore.Components.netstandard2.0.cs
@@ -123,6 +123,17 @@ namespace Microsoft.AspNetCore.Components
public ElementReference(string id) { throw null; }
public string Id { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct EventCallback
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public static readonly Microsoft.AspNetCore.Components.EventCallback Empty;
+ public static readonly Microsoft.AspNetCore.Components.EventCallbackFactory Factory;
+ public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
+ public bool HasDelegate { get { throw null; } }
+ public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
+ }
public sealed partial class EventCallbackFactory
{
public EventCallbackFactory() { }
@@ -186,6 +197,16 @@ namespace Microsoft.AspNetCore.Components
public EventCallbackWorkItem(System.MulticastDelegate @delegate) { throw null; }
public System.Threading.Tasks.Task InvokeAsync(object arg) { throw null; }
}
+ [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
+ public readonly partial struct EventCallback
+ {
+ private readonly object _dummy;
+ private readonly int _dummyPrimitive;
+ public static readonly Microsoft.AspNetCore.Components.EventCallback Empty;
+ public EventCallback(Microsoft.AspNetCore.Components.IHandleEvent receiver, System.MulticastDelegate @delegate) { throw null; }
+ public bool HasDelegate { get { throw null; } }
+ public System.Threading.Tasks.Task InvokeAsync(TValue arg) { throw null; }
+ }
[System.AttributeUsageAttribute(System.AttributeTargets.Class, AllowMultiple=true, Inherited=true)]
public sealed partial class EventHandlerAttribute : System.Attribute
{
diff --git a/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp.cs b/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp.cs
index 73f23b8f46..25c554c639 100644
--- a/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp.cs
+++ b/src/Http/Routing/ref/Microsoft.AspNetCore.Routing.netcoreapp.cs
@@ -517,6 +517,7 @@ namespace Microsoft.AspNetCore.Routing.Matching
private int _dummyPrimitive;
public Microsoft.AspNetCore.Http.Endpoint Endpoint { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public int Score { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
+ public Microsoft.AspNetCore.Routing.RouteValueDictionary Values { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
public sealed partial class EndpointMetadataComparer : System.Collections.Generic.IComparer
{
diff --git a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp.cs b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp.cs
index 49c7324b19..28c29522ca 100644
--- a/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp.cs
+++ b/src/Mvc/Mvc.Razor/ref/Microsoft.AspNetCore.Mvc.Razor.netcoreapp.cs
@@ -297,6 +297,7 @@ namespace Microsoft.AspNetCore.Mvc.Razor.Infrastructure
public sealed partial class TagHelperMemoryCacheProvider
{
public TagHelperMemoryCacheProvider() { }
+ public Microsoft.Extensions.Caching.Memory.IMemoryCache Cache { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
}
}
namespace Microsoft.AspNetCore.Mvc.Razor.Internal
diff --git a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp.cs b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp.cs
index 606f4b2a6c..b93e1462ed 100644
--- a/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp.cs
+++ b/src/Mvc/Mvc.RazorPages/ref/Microsoft.AspNetCore.Mvc.RazorPages.netcoreapp.cs
@@ -637,6 +637,7 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages
public partial class RazorPagesOptions : System.Collections.Generic.IEnumerable, System.Collections.IEnumerable
{
public RazorPagesOptions() { }
+ public Microsoft.AspNetCore.Mvc.ApplicationModels.PageConventionCollection Conventions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public string RootDirectory { get { throw null; } set { } }
System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; }
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; }
diff --git a/src/Razor/Razor.Runtime/ref/Microsoft.AspNetCore.Razor.Runtime.Manual.cs b/src/Razor/Razor.Runtime/ref/Microsoft.AspNetCore.Razor.Runtime.Manual.cs
index 56b3976d61..8549a23cd4 100644
--- a/src/Razor/Razor.Runtime/ref/Microsoft.AspNetCore.Razor.Runtime.Manual.cs
+++ b/src/Razor/Razor.Runtime/ref/Microsoft.AspNetCore.Razor.Runtime.Manual.cs
@@ -1,12 +1,23 @@
// 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.AspNetCore.Razor.Runtime.TagHelpers
-{
- public partial class TagHelperExecutionContext
- {
- internal TagHelperExecutionContext(string tagName, Microsoft.AspNetCore.Razor.TagHelpers.TagMode tagMode) { }
- [System.Diagnostics.DebuggerStepThroughAttribute]
- internal System.Threading.Tasks.Task GetChildContentAsync(bool useCachedResult, System.Text.Encodings.Web.HtmlEncoder encoder) { throw null; }
- }
-}
+using System.Runtime.CompilerServices;
+using Microsoft.AspNetCore.Razor.TagHelpers;
+
+[assembly: TypeForwardedTo(typeof(DefaultTagHelperContent))]
+[assembly: TypeForwardedTo(typeof(HtmlAttributeNameAttribute))]
+[assembly: TypeForwardedTo(typeof(HtmlAttributeNotBoundAttribute))]
+[assembly: TypeForwardedTo(typeof(HtmlTargetElementAttribute))]
+[assembly: TypeForwardedTo(typeof(ITagHelper))]
+[assembly: TypeForwardedTo(typeof(ITagHelperComponent))]
+[assembly: TypeForwardedTo(typeof(NullHtmlEncoder))]
+[assembly: TypeForwardedTo(typeof(OutputElementHintAttribute))]
+[assembly: TypeForwardedTo(typeof(ReadOnlyTagHelperAttributeList))]
+[assembly: TypeForwardedTo(typeof(RestrictChildrenAttribute))]
+[assembly: TypeForwardedTo(typeof(TagHelper))]
+[assembly: TypeForwardedTo(typeof(TagHelperAttribute))]
+[assembly: TypeForwardedTo(typeof(TagHelperAttributeList))]
+[assembly: TypeForwardedTo(typeof(TagHelperComponent))]
+[assembly: TypeForwardedTo(typeof(TagHelperContent))]
+[assembly: TypeForwardedTo(typeof(TagHelperContext))]
+[assembly: TypeForwardedTo(typeof(TagHelperOutput))]
\ No newline at end of file
diff --git a/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp.cs b/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp.cs
index d1455f1796..4bc6818046 100644
--- a/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp.cs
+++ b/src/Servers/Kestrel/Core/ref/Microsoft.AspNetCore.Server.Kestrel.Core.netcoreapp.cs
@@ -155,6 +155,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core
public System.IServiceProvider ApplicationServices { get { throw null; } }
public ulong FileHandle { get { throw null; } }
public System.Net.IPEndPoint IPEndPoint { get { throw null; } }
+ public Microsoft.AspNetCore.Server.Kestrel.Core.KestrelServerOptions KestrelServerOptions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } }
public Microsoft.AspNetCore.Server.Kestrel.Core.HttpProtocols Protocols { [System.Runtime.CompilerServices.CompilerGeneratedAttribute] get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute] set { } }
public string SocketPath { get { throw null; } }
public Microsoft.AspNetCore.Connections.ConnectionDelegate Build() { throw null; }