Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infer default sources for parameters in MapAction #30248

Closed
halter73 opened this issue Feb 17, 2021 · 8 comments
Closed

Infer default sources for parameters in MapAction #30248

halter73 opened this issue Feb 17, 2021 · 8 comments
Assignees
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-minimal-actions Controller-like actions for endpoint routing
Milestone

Comments

@halter73
Copy link
Member

halter73 commented Feb 17, 2021

How to determine each parameter's source

The numbered and lettered rules for determining the source of a parameter should be applied in the order. The bullet points are unordered.

  1. If an attribute that implements one of the "IFrom..." interfaces in Microsoft.AspNetCore.Http.Metadata is applied to the parameter, populate the parameter from the source specified by the attribute. Only one of these attributes can be specified per parameter, and these attributes must implement no more than one of these interfaces.
    • IFromRouteMetadata
      • Reads from HttpRequest.RouteValues[name] where name is specified by IFromRouteMetadata.Name or the parameter name if IFromRouteMetadata.Name is null.
    • IFromBodyMetadata
      • Reads from HttpRequest.Body(Reader) as JSON using HttpRequest.ReadFromJsonAsync<{ParameterType}>().
      • Can only be used once per parameter list (there's only one body)
      • Cannot be used in the same parameter list as IFromFormMetadata
      • Will cause requests with an empty body to be rejected without calling the action unless IFromBodyMetadata.AllowEmpty returns true. (The default interface implementation returns false.)
    • IFromFormMetadata
      • Reads from HttpRequest.Form[name] where name is specified by IFromFormMetadata.Name or the parameter name if IFromFormMetadata.Name is null.
      • Can be used multiple times in a single parameter list (presumably for different names)
      • Cannot be used in the same parameter list as IFromBodyMetadata (there's only one body)
    • IFromHeaderMetadata
      • Reads from HttpRequest.Headers[name] where name is specified by IFromHeaderMetadata.Name or the parameter name if IFromHeaderMetadata.Name is null.
    • IFromQueryMetadata
      • Reads from HttpRequest.Query[name] where name is specified by IFromQueryMetadata.Name or the parameter name if IFromQueryMetadata.Name is null.
    • IFromServiceMetadata
      • Normally resolves via HttpRequest.RequestServices.GetRequiredService<{ParameterType}>().
      • If the parameter is a nullable reference type (i.e. has the System.Runtime.CompilerServices.NullableAttribute), resolve via HttpRequest.RequestServices.GetService<{ParameterType}>().
      • If the parameter is optional (i.e. has a default value), resolve via HttpRequest.RequestServices.GetService<{ParameterType}>() ?? parameter.DefaultValue.
  2. If the parameter is a scalar value type that lives in the System namespace, first check HttpRequest.RouteValues contains an entry for the parameter name. If it does, use HttpRequest.RouteValues[{ParameterName}]. Otherwise, use HttpRequest.Query[{ParameterName}].
    • TODO: Come up with actual list of scalar value types that live in the System namespace.
    • Question: Do we want to allow types to opt-in to this? Today MVC uses TypeConverter which is hard to implement.
    • Alternatives:
      • Something convention-based like the presence of a bool TryParse(string, out T) method
      • The explicit implementation of an interface with that method to make it more opt in
  3. If HttpRequest.RequestServices.GetService<{ParameterType}>() is not null, use that value.
    • TODO: Figure out how to make this work well with compile-time source generation. This might need to be determined at runtime no matter what.
  4. Otherwise, treat the parameter as if it had an attribute implementing IFromBodyMetadata where IFromBodyMetadata.AllowEmpty is false.

How we will convert to the parameter type.

  1. For parameters bound from the body (has an IFromBodyMetadata attribute or is treated by such by convention), we will continue to assume JSON and initialize the parameter with HttpRequest.ReadFromJsonAsync<{ParameterType}>().
    • We need to figure out if we want make this configurable or force people to read they body themselves if they want configurability. If we decide on configurability, we need to decide on how much.
  2. For all other parameters bound from the request (i.e. not a service or from the body) we need to convert from a string.
    • Since there is a finite list of "scalar value who lives in the System namespace" we'll bind to by convention, we'll use their TryParse methods or equivalent until we decide on something different for those.
    • Parameters explicitly bound by attribute to a string-based source also need to be converted much like those read from the RouteValues or Query by convention. I doubt we also want to limit these parameter types to a finite list. For now, we'll continue doing what we do today to convert from string as described below.

How we convert to the parameter type today in the "MapAction" APIs

Today, all inputs are converted to their respective parameter types as follows:

  1. For parameters bound from the body, we already call HttpRequest.ReadFromJsonAsync<{ParameterType}>().
  2. All other parameters start as strings from the various sources listed above.
    1. If {ParameterType} is string, we're done!
    2. If there's a {ParameterType}.Parse({ValueString}) method, use that.
      • NOTE: Going forward, prefer/require TryParse instead.
    3. Lastly, try Convert.ChangeType({ValueString}, typeof{ParameterType}, CultureInfo.InvariantCulture)
      • NOTE: Going forward, we should stop using CultureInfo.InvariantCulture

Original issue:

  1. Complex type -> FromBody (See https://source.dot.net/#Microsoft.AspNetCore.Mvc.Abstractions/ModelBinding/ModelMetadata.cs,606)
  2. Name appears as a route value -> FromRoute
  3. Everything else -> FromQuery

From: #29878 (comment)

New inference rules unique to MapAction:

  1. [FromServices] should work implicitly for types that can be resolved from RequestServices.
@halter73
Copy link
Member Author

halter73 commented Feb 17, 2021

As part of this let's make sure optional parameters work well and that there are good error logs when non-optional parameters are missing.

Fixed by #30434

@mkArtakMSFT mkArtakMSFT added area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-minimal-actions Controller-like actions for endpoint routing enhancement This issue represents an ask for new feature or an enhancement to an existing one labels Feb 17, 2021
@mkArtakMSFT mkArtakMSFT added this to the Next sprint planning milestone Feb 18, 2021
@ghost
Copy link

ghost commented Feb 18, 2021

Thanks for contacting us.
We're moving this issue to the Next sprint planning milestone for future evaluation / consideration. We will evaluate the request when we are planning the work for the next milestone. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

@Kahbazi
Copy link
Member

Kahbazi commented Feb 23, 2021

@halter73 Do you accept PR for this if the requirement is final?

@halter73
Copy link
Member Author

I'd be happy to accept a PR from you for this @Kahbazi. Thanks for all the MapAction help already! No promises we don't change the design a little down the road ofc.

@halter73
Copy link
Member Author

  1. I own the type and define the Parse method I want which is used by convention.
  2. I don't own the type, but I want to change how it's parsed.
    1. Option 1: Add attribute to parameter.
    2. Option 2: Add attribute to assembly that applies to all parameters to a specified type.
      1. Does this only apply to call sites in that are in the same assembly?
    3. Option 3: Scan assembly or source for implementation of a specific interface (e.g. IParameterConverter).
    4. Option 4: Add a TypeConvert like service at runtime (Rejected: cannot adequately optimize at compile time).

@charlesroddie
Copy link

Please don't put a convention-based approach in such a core dotnet library as ASP.Net. It's true that there is a precedent for convention-based approaches from EF but EF is not such a core library since it is easy to avoid unlike ASP.Net.

@halter73 halter73 added area-servers and removed area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates labels Mar 30, 2021
@davidfowl
Copy link
Member

Please don't put a convention-based approach in such a core dotnet library as ASP.Net. It's true that there is a precedent for convention-based approaches from EF but EF is not such a core library since it is easy to avoid unlike ASP.Net.

ASP.NET Core already have the un-opinionated layer you're looking for, this isn't that component.

@halter73
Copy link
Member Author

halter73 commented Apr 9, 2021

Follow up based on yesterday's meeting discussing #31603:

  • Look for TryParse on method on any parameter first, signatures supported:
    • For enums, use static bool Enum.TryParse<T>(string, out T).
    • Special case for some built-in types:
    • static bool TryParse(string, IFormatProvider, out T)
    • static bool TryParse(string, out T)
  • Use invariant culture always (and will wait for feedback)
  • Assume interfaces are services, classes will require an explicit [FromServices]
  • Assume classes are from the body
  • Remove form as a source

halter73 added a commit that referenced this issue Apr 9, 2021
This does a big chunk of #30248 while heavily refactoring the RequestDelegateFactory by splitting it out into a bunch of smaller methods.

For part 2 of #30248, a "scalar value type that lives in the System namespace", I went with the alternative of "Something convention-based like the presence of a bool TryParse(string, out T) method" instead. This conventions work for types in any namespace including user-defined types.
eugene2candy added a commit to eugene2candy/Home that referenced this issue Apr 10, 2021
* Update dependencies from https://github.com/dotnet/efcore build 20210315.3 (dotnet#30960)

[main] Update dependencies from dotnet/efcore

* Feedback from Pranav

* Remove regex use in DataProtection (dotnet#30855)

* Fix null ref in SyntaxTokenCache (dotnet#30978)

Fixes dotnet#27154

* Pool SocketSenders (dotnet#30771)

- SocketAsyncEventArgs have lots of state on them and as a result are quite big (~350) bytes at runtime. We can pool these since sends are usually very fast and we can reduce the per connection overhead as a result.
- We also allocate one per IOQueue to reduce contention.
- Fixed buffer list management
- Disposed pool when the transport is disposed
- Added project to slnf so running tests in VS was possible
- Clear the buffer and buffer list before returning to the pool
- This cleans up dumps as the pooled senders don't see references to buffers
while pooled in the queue
- Keep track of items in the pool separately from the queue count.

* Add Consolidated view classifier to make view types internal (dotnet#30976)

* Add Consolidated view classifier to make view types internal

* Address feedback from peer review

* Address feedback and fix tests

* Fix nullability of TypeNameHelper.GetTypeDisplayName parameter (dotnet#30987)

* [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#30968)

[main] Update dependencies from dotnet/runtime dotnet/efcore


 - Remove assemblies from the ref and runtime pack

 - Remove more references

* Update src/Features/JsonPatch/src/Internal/ConversionResultProvider.cs

Co-authored-by: Pranav K <[email protected]>

* Update src/Features/JsonPatch/src/PublicAPI.Unshipped.txt

Co-authored-by: Pranav K <[email protected]>

* Update dependencies from https://github.com/dotnet/efcore build 20210316.2 (dotnet#30991)

[main] Update dependencies from dotnet/efcore

* HTTP/3 input validation and connection abort (dotnet#29665)

* Connection error for invalid HTTP/3 frame on request stream

* Update src/Servers/Kestrel/Core/src/CoreStrings.resx

* Write frame types and errors codes in logs as per spec

* Clean up

* Add HTTP/3 connection exception with code

* Connection abort

* More abort connection stuff

* More test

* More tests

* PR feedback

* Update dependencies from https://github.com/dotnet/efcore build 20210317.1 (dotnet#30998)

[main] Update dependencies from dotnet/efcore

* helix + pw + linux/osx (dotnet#30676)

* [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#30999)

[main] Update dependencies from dotnet/runtime dotnet/efcore

* Dispose streams that don't fit in pool (dotnet#30995)

* Dispose streams that don't fit in pool

* PR feedback

* Update NodeJS dependency in build instructions (dotnet#31000)

* Respect consolidated views in all document classifiers (dotnet#31008)

* Respect consolidated views in all document classifiers

* Address feedback from peer review

* E2E test apps for WinForms and WPF BlazorWebView (dotnet#31021)

* Add API to Renderer to trigger a UI refresh on hot reload (dotnet#30884)

* Add API to Renderer to trigger a UI refresh on hot reload

Fixes dotnet#30816

* Update RazorExtensions.cs (dotnet#31029)

* Fix credscan issues in aspnetcore (dotnet#30337)

* Fix credscan issues in DataProtection

* Fix credscan issues in Identity, except where they affect checked in certs

* Updated scan

* [Blazor] Adds static web assets support for Blazor desktop (dotnet#31041)

* Wires up static web assets support on the WebViewManager.

* Support ElementReference.Focus in WebView (dotnet#31050)

* Support InputFile in WebView (dotnet#31049)

* Update DotNetMuxerTest (dotnet#31053)

Fixes dotnet#24082

* Bring back working DevServer packaging setup (dotnet#31043)

* Bring pack working DevServer packaging setup

* Revert "Bring pack working DevServer packaging setup"

This reverts commit 0dda92e.

* Update runtimeconfig.template.json

* Quarantine one failing test (dotnet#31045)

- dotnet#31044
- `RazorPagesTemplate_RazorRuntimeCompilation_BuildsAndPublishes()`

* Update SDK to bring unified assembly changes (dotnet#31039)

* Update SDK to bring unified assembly changes

* Update SDK to pick up Razor pages fix

* Fixup test

Co-authored-by: Pranav K <[email protected]>

* Update launchSettings to indicate hotReload is to be used (dotnet#31060)

* Fix race in FrameAfterTrailers_UnexpectedFrameError dotnet#30754 (dotnet#31061)

* Fix JS interop cases in WebView (dotnet#31054)

* Template tests: Create dev cert only once (dotnet#31012)

* Simplify Razor bug reports. (dotnet#31033)

* Simplify Razor bug reports.

- We now have better mechanisms for capturing information so no need to scare users off.

* Address code review feedback

* [Blazor][Desktop] Mark packages as shipping (dotnet#31035)

* Make packages shipping
* Update RepoTasks to msbuild 16.9
* Update global.json
* Update Nuget

* Remove WebView dependency to AspNetCore.App (dotnet#31071)

The Blazor Desktop project must not depend on Microsoft.AspNetCore.App because it needs to run on almost any platform, including Android/iOS. But AspNetCore.App doesn't run on those platforms. This changes WebView to not use any packages that are part of AspNetCore.App, such as StaticFiles and Http.Abstractions. Instead, it has copies of those files.

* Use longer delay in test (dotnet#31072)

* [SignalR TS] Fix permanent Disconnecting state (dotnet#30948)

* Changed logLevel to Information instead of warning for EphemeralDataProtectionProvider (dotnet#29405)

Fixes dotnet#29107

* [Blazor][Desktop] Fixes nullable annotations on the public API baselines (dotnet#31073)

* Fix nullable annotations
* Fix APIs
* Add missing API baseline file

* Implements shadow copying for ASP.NET Core + IIS (dotnet#28357)

* Suppress generating source checksums when configured (dotnet#31089)

Hot reload / EnC does not like it when type level attributes are modified. Razor views and Pages
include a RazorSourceChecksumAttribute that includes a checksum of all of it's inputs (current cshtml file, and
all _ViewImports that contribute to it). It's used used by runtime compilation to tell if the compiled view is
current compared to it's inputs. However, it gets in the way with enc since editing a file updates the checksum.

We'll disable this feature by default in RazorSourceGenerator, and enable it using an MSBuild switch that's configured
by runtime compilation

* Caching Redis: Add option to register profiling session (dotnet#31018)

* Add option to register profiling session

* Add API change

* Fix public API declaration

* Cleanup

* Quarantine and fix RequestTrailers_CanReadTrailersFromRequest dotnet#31057 (dotnet#31059)

* Sync shared code from runtime (dotnet#31094)

Co-authored-by: Tratcher <[email protected]>

* Revert "Remove ANCM shim and outofprocess handler from Runtime SiteEx… (dotnet#31042)

* Revert "Remove ANCM shim and outofprocess handler from Runtime SiteExtension (dotnet#24884)"

This reverts commit 7f7528f.

* Enable site extension build temporarily

* Enable build native

* Fixing site extension build

* No need to set

* Fixing up build

* Update .azure/pipelines/ci.yml

* Update ci.yml

* retry

* Update .azure/pipelines/ci.yml

* Follow ups for Blazor AOT (dotnet#31098)

* Follow ups for Blazor AOT

* Add Emscripten packs to manifest
* Update acquire tool to use manifest from the dotnet sdk
* Add AOT option to templates

* Undo Emscripten for now

* [Blazor] [Desktop] Exclude Resources.resx from the embedded file manifest (dotnet#31107)

Excludes unnecessary embedded resources from the embedded files manifest provider.

* Fix some low hanging allocation fruit (dotnet#31115)

* Fix some low hanging allocation fruit
- Use singleton pipe options
- Use Task.Yield instead of AwaitableThreadPool on the server side
- Change WebSocketMiddleware handshake helpers to remove enumerator allocations.

* Fix issues preventing hot reload for Blazor WASM (dotnet#31108)

* Configure DOTNET_MODIFIABLE_ASSEMBLIES=debug env variable
* Fixup broken reflection

* Fixup targeting pack intermediate zip version

* Add new Polly DI extension method for HttpClientFactory (dotnet#28283)

* Fix IDE warnings

Fix IDE warnings about non-disposed handlers.

* Update return type documentation

Update the comment's type to match the method's.

* Add new AddPolicyRegistry overload

Add a new overload for AddPolicyRegistry() that allows the
caller to configure the policy registry using other services
that are registered with the service provider, such as config.

* Add more nullability to Mvc.Core (dotnet#31076)

* Update nuget & msbuild versions (dotnet#31064)

* Update nuget & msbuild versions

* Update RepoTasks.csproj

* Fix one test

* Fix all tests

* Update dependencies from https://github.com/dotnet/arcade build 20210317.3 (dotnet#31124)

Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Helix.Sdk
 From Version 6.0.0-beta.21160.7 -> To Version 6.0.0-beta.21167.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>

* Update branding to 6.0.0-preview4

* Revert "Update branding to 6.0.0-preview4"

This reverts commit 5c8e9f1.

* Added missing event ids for hosting events (dotnet#31149)

- Fixed slnf file

* Don't separately build arm64 installers

* Don't build targeting pack nupkgs

* Undo change that stopped building installers in win-arm64 leg.

This reverts commit 03aab5d.

* Update comment

* Update branding to 6.0.0-preview4 (dotnet#31153)

* Dispose the DiagnosticListener (dotnet#31170)

- Add the DiagnosticListener to the DI container as a lambda so it gets disposed.

* Add support for tabs vs. spaces settings for generated files

* Fixed grammar on `SessionOptions.IOTimeout` XML (dotnet#31174)

Fixed grammar on `SessionOptions.IOTimeout`

* Resolve remaining credscan bugs (dotnet#31157)

* Default to Kestrel over IISExpress (dotnet#31161)

* Update CONTRIBUTING.md (dotnet#31167)

* Update CONTRIBUTING.md

* Follow-up edits

* Add tracing to templates process launch for debugging (dotnet#31202)

* Add tests

* Cleanup

* Cleanup

* Remove unsafe from BytesOrdinalEqualsStringAndAscii (dotnet#31201)

* Add field

* Cleanup

* Revert changes to global.json

* fix naming

* Add hotReloadProfile to Razor Pages template (dotnet#31197)

* BlazorTemplate test improvements (dotnet#30907)

* Split the HPackEncoder partial class (dotnet#31210)

* [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31020)

[main] Update dependencies from dotnet/runtime dotnet/efcore


 - Do not declare iOS and Android support everywhere
- runtime update includes new annotations making non-support obvious
- see dotnet/runtime#49354 (w/ a similar Android PR coming soon)

 - !fixup! Fix typo in item group name

 - !fixup! Set `$(RemoveDevicePlatformSupport)` in correct project
- not needed in BlazorManifest.csproj
- but, is needed in dotnet-install-blazoraot.csproj

 - suppress

 - Fixup

* Annotate Blazor wasm auth assemblies for trimmability (dotnet#31119)

Minor cleanup when inspecting the code

* Creates script command for sql-cache-tool (dotnet#30398)

* Creates script command for sql-cache-tool
* Includes idempotency, output to stdout, or specific file
* Fixes help suggestion to be command-specific

* Corrects typo

* Revert "BlazorTemplate test improvements (dotnet#30907)" (dotnet#31223)

This reverts commit 730e39b.

* Sync shared code from runtime (dotnet#31182)

Co-authored-by: dotnet <[email protected]>

* Unquarantine BootResourceCachingTest (dotnet#31154)

* Resolve final credscan bug (dotnet#31196)

* READMEs for Servers (dotnet#31207)

* READMEs for Servers

* Remove en-us

* Update src/Servers/README.md

Co-authored-by: Brennan <[email protected]>

* Update src/Servers/Kestrel/README.md

Co-authored-by: Chris Ross <[email protected]>

* Update src/Servers/IIS/README.md

Co-authored-by: Chris Ross <[email protected]>

* Feedback

* Update src/Servers/HttpSys/README.md

* Quick test

* HttpSys

* Update README.md

* Feedback

* Update src/Servers/IIS/README.md

Co-authored-by: Günther Foidl <[email protected]>

* Update src/Servers/Kestrel/README.md

Co-authored-by: Günther Foidl <[email protected]>

Co-authored-by: Brennan <[email protected]>
Co-authored-by: Chris Ross <[email protected]>
Co-authored-by: Günther Foidl <[email protected]>

* Components test parole for good behavior (dotnet#31156)

* Add hotReloadProfile to Razor Pages template (dotnet#31216)

* Add hotReloadProfile to Razor Pages template

* Turn off hotReloadProfile for Blazor WebAssembly projects

The WebAssembly experience is a bit problematic in preview3 because of runtime issues
dotnet/runtime#50190. We'll turn it off in the templates by default
to avoid giving a confusing experience out of the box.

* [main] Update dependencies from dotnet/efcore dotnet/runtime (dotnet#31220)

[main] Update dependencies from dotnet/efcore dotnet/runtime

* Readmes for HTTP and Site Extensions (dotnet#31250)

* Readmes for HTTP and Site Extensions

* Apply suggestions from code review

Co-authored-by: Brennan <[email protected]>

Co-authored-by: Brennan <[email protected]>

* Update dependencies from https://github.com/dotnet/efcore build 20210325.2 (dotnet#31254)

[main] Update dependencies from dotnet/efcore

* Refactor and fix failing tests

* Revert global.json changes

* Enable CA2012 (Use ValueTask Correctly) (dotnet#31221)

* Unquarantine a couple servers tests (dotnet#31213)

* Update src/Razor/Microsoft.AspNetCore.Razor.Language/src/CodeGeneration/CodeWriter.cs

Co-authored-by: Pranav K <[email protected]>

* Sync shared code from runtime (dotnet#31271)

Co-authored-by: Tratcher <[email protected]>

* Update dependencies from https://github.com/dotnet/runtime build 20210326.1 (dotnet#31277)

[main] Update dependencies from dotnet/runtime

* Use Emscripten SDKs in WASM workload (dotnet#31259)

* Update dependencies from https://github.com/dotnet/efcore build 20210326.1 (dotnet#31283)

[main] Update dependencies from dotnet/efcore

* Clean up verbiage on build scripts (dotnet#31262)

* Clean up verbiage on build scripts

* Update docs/BuildFromSource.md

Co-authored-by: Kevin Pilch <[email protected]>

Co-authored-by: Kevin Pilch <[email protected]>

* Enable nullable on more authentication projects (dotnet#31230)

* Enable nullable on Azure projects (dotnet#31298)

* Reduce allocations for Cookies. (dotnet#31258)

* Update dependencies from https://github.com/dotnet/efcore build 20210326.2 (dotnet#31292)

[main] Update dependencies from dotnet/efcore

* [release/6.0-preview3] Update dependencies from dotnet/efcore dotnet/runtime (dotnet#31255)

[release/6.0-preview3] Update dependencies from dotnet/efcore dotnet/runtime


 - Port changes from main

 - Merge branch 'release/6.0-preview3' into darc-release/6.0-preview3-ce4fb228-ea32-4f60-95e1-0e60d42e3fc3

* [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31310)

[main] Update dependencies from dotnet/runtime dotnet/efcore

* Update dependencies from https://github.com/dotnet/runtime build 20210327.4 (dotnet#31329)

[main] Update dependencies from dotnet/runtime

* Fix comment grammar (dotnet#31326)

Minor update to XML docs to fix sentence grammar.

* Use LoggerMessage.Define in HttpSys (dotnet#31333)

- Use LoggerMessage.Define() throughout HttpSys instead of ILogger extension methods.
- Also updates two incorrect event Id field names.

Fixes dotnet#31313.

* Reduce the per connection overhead in SocketConnection (dotnet#31308)

* Reduce the per connection overhead in SocketConnection
- Removed 3 state machines (StartAsync, ProcessSends and ProcessReceives)
- Use ValueTask to remove delegate allocation on both senders and receivers
- Remove field from DoSend and DoReceive state machine

* Faster strongly typed features for server FeatureCollection (dotnet#31322)

- Use strongly typed features
- Use Unsafe.As to workaround dotnet/runtime#49614
- Do the casting it for Set<T> as well
- Add more benchmarks
- Reorder features (order of reset);

* Update dependencies from https://github.com/dotnet/runtime build 20210328.6 (dotnet#31350)

[main] Update dependencies from dotnet/runtime

* Move logging to separate class to prevent allocation per generic type (dotnet#31345)

* Badges, badges! (Licence, Help wanted, Good first issue, Chat) (dotnet#31341)

* Badges, badges! (Licence, Help wanted, Good first issue, Chat)

* Use correct links

* Update dependencies from https://github.com/dotnet/efcore build 20210329.1 (dotnet#31351)

[main] Update dependencies from dotnet/efcore

* Fix WebView header APIs and behavior (dotnet#31246)

* Fix WebView header APIs and behavior
- Change WebView to return dictionary of headers instead of strings (this is needed for Android)
- Change StaticContentProvider to use filename (always exists) instead of physical file path (not always available) to determine MIME type
- Fix WPF sample bug

* Update dependencies from https://github.com/dotnet/efcore build 20210329.2 (dotnet#31352)

[main] Update dependencies from dotnet/efcore

* Update dependencies from https://github.com/dotnet/efcore build 20210327.1 (dotnet#31309)

[release/6.0-preview3] Update dependencies from dotnet/efcore

* Update dependencies from https://github.com/dotnet/runtime build 20210329.3 (dotnet#31363)

[release/6.0-preview3] Update dependencies from dotnet/runtime

* Refactor logging in generic classes (dotnet#31364)

* Update dependencies from https://github.com/dotnet/efcore build 20210329.4 (dotnet#31366)

[release/6.0-preview3] Update dependencies from dotnet/efcore

* Update dependencies from https://github.com/dotnet/efcore build 20210329.3 (dotnet#31353)

[main] Update dependencies from dotnet/efcore

* Make RequestDelegateFactory public (was MapActionExpressionTreeBuilder) (dotnet#31171)

* Make RequestDelegateBuilder public

- Formerly known as MapActionExpressionTreeBuilder

* Add new BuildRequestDelegate overloads

* Address PR feedback

* RequestDelegateBuilder -> RequestDelegateFactory

* Build -> Create

* Address final review feedback.

* [Http] Remove some unsafe code and save a string allocation (dotnet#31267)

* Use one shot pbkdf2 (dotnet#31200)

* Use one shot pbkdf2

* Update NetCorePbkdf2Provider.cs

* CR feedback

* CR feedback

* Fix

* Just use GetBytes for now

* Update NetCorePbkdf2Provider.cs

* Use interned Header Names for known headers not in the pre-allocated block (dotnet#31311)

* Use interned headernames for known headers not in the preallocated block

* Switch Connection header values for interned values

* Use interned strings for websockets

* Keep baggage, tracestate, and traceparent with previous casing

* Update src/Servers/Kestrel/shared/KnownHeaders.cs

Co-authored-by: Chris Ross <[email protected]>

* Feedback

Co-authored-by: Chris Ross <[email protected]>

* Revert global.json changes

* Modify constructor

* Remove IReceiveHotReloadContext and HotReloadContext (dotnet#31281)

* Remove IReceiveHotReloadContext and HotReloadContext

React to API review feedback. Substitute IReceiveHotReloadContext and HotReloadContext
with RenderHandle.IsHotReloading

* Fixup

* Update src/Components/Components/src/RenderHandle.cs

* Update src/Components/Components/src/Properties/ILLink.Substitutions.xml

* Update src/Components/Components/src/Properties/ILLink.Substitutions.xml

* Flow Kestrel CancellationTokens to BindAsync (dotnet#31377)

* Update dependencies from https://github.com/dotnet/runtime build 20210329.5 (dotnet#31384)

[main] Update dependencies from dotnet/runtime

* [main] Update dependencies from dotnet/arcade (dotnet#31349)

[main] Update dependencies from dotnet/arcade

* Quarantine flaky test (dotnet#31389)

* Clean up NetCore PBKDF2 provider. (dotnet#31391)

* Update dependencies from https://github.com/dotnet/runtime build 20210330.7 (dotnet#31394)

[release/6.0-preview3] Update dependencies from dotnet/runtime

* Add a FeaturesCollection constructor that supports initial capacity (dotnet#31381)

* Add a FeaturesCollection constructor that supports initial capacity

* Raise authenticationFailed event when cert validation fails (dotnet#31370)

* Unquarantine UseStartupFactoryWorks (dotnet#31297)

* Update dependencies from https://github.com/dotnet/efcore build 20210330.1 (dotnet#31400)

[release/6.0-preview3] Update dependencies from dotnet/efcore

* Update dependencies from https://github.com/dotnet/efcore build 20210330.2 (dotnet#31401)

[main] Update dependencies from dotnet/efcore

* Fix generated CSS scopes in layout views and update templates (dotnet#31257)

* Fix generated CSS scopes in layout views and update templates

* Update template baselines

* Enabled scoped CSS for MVC template tests

* Bring back static CSS file

* Quarantine ClosesAfterDataSent (dotnet#31405)

* Update CONTRIBUTING.md (dotnet#31371)

Removed tab that seemed to cause a paragraph about the new help wanted label to be in a code fence.

* Support round trip serialization of AuthenticationProperties with System.Text.Json (dotnet#31330) dotnet#20722

* Update Microsoft.Net.Compilers.Toolset (dotnet#31403)

* Improve test failures for unexpected logs (dotnet#31406)

* Add ToString() to Testing's log WriteContext

* Update StrictTestServerTests to only show unexpected log

* Undo template change that induced flakiness (dotnet#31417)

* Add helpful exception message when exception handler returns 404 (dotnet#31142)

* Update dependencies from https://github.com/dotnet/runtime build 20210331.6 (dotnet#31421)

[release/6.0-preview3] Update dependencies from dotnet/runtime

* Do not serialize Parameters property on AuthenticationProperties (dotnet#31414)

* Do not serialize Parameters

Explicitly prevent the Parameters dictionary from being included in the deserialized payload.
See dotnet#31330 (comment).

* Ignore props backed by Items

Also ignore the properties backed by the Items dictionary to minimise the size of the serialized JSON payload.

* Add ignoreLineEndingDifferences

Stop tests from failing on non-Windows OSs due to different line endings.

* ArPow stage 1: local source-build infrastructure (dotnet#31235)

Conflicts:
	eng/Version.Details.xml

Co-authored-by: John Luo <[email protected]>

* [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31411)

[main] Update dependencies from dotnet/runtime dotnet/efcore

* Update dependencies from https://github.com/dotnet/efcore build 20210331.4 (dotnet#31424)

[release/6.0-preview3] Update dependencies from dotnet/efcore

* Fix project path in slnf (dotnet#31431)

* Fix trailing comma in Caching.slnf (dotnet#31438)

* Fix file headers in src/Caching (dotnet#31439)

* [SignalR Java] Update to RxJava3 (dotnet#31426)

* Fixed de-duping hosting startup assemblies (dotnet#31440)

- De-dupe hosting startup assemblies based on assembly instance not the name of the assembly. Names can be short or long and we don't know if they resolve to the same assembly. Instead of trying to mess with names, we just check to make sure that the instance isn't the same.

* Trim down framework references for Blazor dev server (dotnet#31420)

* Only include Microsoft.AspNetCore.App framework reference for Blazor dev server
* Address feedback from peer review
* Use SharedFxVersion property

* Cross-target last few projects to DefaultNetCoreTargetFramework (dotnet#31239)

* Cross-target last 2 projects to DefaultNetCoreTargetFramework

* More projects

* Fixup

* Fixup again

* Fixup

* Undo SiteExtension change

* Update src/SiteExtensions/LoggingBranch/LB.csproj

Co-authored-by: Doug Bunting <[email protected]>

Co-authored-by: Doug Bunting <[email protected]>

* [main] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31425)

[main] Update dependencies from dotnet/runtime dotnet/efcore

* Use integer division trick to get exact base64 length (dotnet#31442)

* Add nullability to more MVC assemblies (dotnet#31338)

* Add nullability to more MVC assemblies

* [x] MVC.Cors
* [x] Mvc.DataAnnotations
* [x] Mvc.Localization
* [x] Mvc.Newtonsoft.Json
* [ ] Mvc.ViewFeatures (partial)

* Fixup

* Update src/Mvc/Mvc.ViewFeatures/src/Rendering/ViewContext.cs

* Apply suggestions from code review

* Update RazorPagePropertyActivator.cs

* Update assembly check on EventHandlerTagHelperDescriptorProvider (dotnet#31458)

* Remove legacy routing (dotnet#31295)

* [release/6.0-preview3] Update dependencies from dotnet/runtime dotnet/efcore (dotnet#31451)

[release/6.0-preview3] Update dependencies from dotnet/runtime dotnet/efcore

* Update dependencies from https://github.com/dotnet/arcade build 20210331.6 (dotnet#31427)

[main] Update dependencies from dotnet/arcade


 - Merge branch 'main' into darc-main-2c400715-e553-48d8-8d43-983dc7aa4b7d

* Update dependencies from https://github.com/dotnet/efcore build 20210401.3 (dotnet#31468)

[main] Update dependencies from dotnet/efcore

* Fix project paths in Azure.slnf (dotnet#31435)

* Fix project paths in Azure.slnf

* Update Azure.slnf

* Update IdentityModel versions to 6.10.0 dotnet#31454 (dotnet#31482)

* Removed static activity source from hosting (dotnet#31483)

* Removed static activity source from hosting
- Get it from DI instead

* Fixed test

* Use Random.Shared property (dotnet#31453)

* Use Random.Shared

Use the new .NET 6 Random.Shared static property where possible.
See dotnet/runtime#50297.

* Revert WebApi-CSharp changes

For some reason I don't understand, this template doesn't see Random.Shared when compiled so this reverts the previous change for this template.

* Remove baseline suppressions from 5.0 (dotnet#29934)

* Remove baseline suppressions from 5.0

* Use newer NuGet.Protocol version

- v4.8.2 ➡️  v5.8.1

* Fix condition

* Back to 5.8.1

* Undo components changes

* Whoops

* Whoops

Co-authored-by: Doug Bunting <[email protected]>

* Remove DNT from pre-reserved headers (dotnet#31493)

No modern browser uses it anymore

* Reuse HttpProtocol CTS (dotnet#31466)

* Change Router _emptyParametersDictionary to a regular Dictionary (dotnet#31460)

* Change Router _emptyParametersDictionary to a regular Dictionary

This allows for ReadOnlyDictionary to be trimmed in a default Blazor WASM app. Saving roughly 3 KB .br compressed.

Contributes to dotnet#30098

* Update src/Components/Components/src/Routing/Router.cs

Co-authored-by: James Newton-King <[email protected]>

* Clean up some MVC code (dotnet#31511)

* Clean up some MVC code

* PR feedback

* Do not throwing on InputBase.Dispose() if not in EditContext. (dotnet#31510)

* Do not throwing on InputBase.Dispose() if not in EditContext.

Fixes dotnet#30990

* Cache filters between requests in the ordinary case (dotnet#31513)

In the normal case,
* only the DefaultFilterFactoryProvider is registered
* all filters registered by the framework are reusable

We could so something targeted and cache filter instances between requests.

* Update dependencies from https://github.com/dotnet/arcade build 20210403.1 (dotnet#31526)

[main] Update dependencies from dotnet/arcade

* Flaky tests (dotnet#31502)

* Revert "Update assembly check on EventHandlerTagHelperDescriptorProvider (dotnet#31458)" (dotnet#31530)

This reverts commit 7bc87ba.

* Ability to deactivate DataAnnotationsValidation dynamically. Fixes dotnet#31027 (dotnet#31413)

* Use UriHelper.BuildAbsolute for RedirectToHttpsRule (dotnet#28899)

* Use UriHelper.BuildAbsolute and UriHelper.BuildRelative for RedirectRule (dotnet#28903)

* Still send 100 Continue with null MinRequestBodyDataRate (dotnet#31543)

* Update Selenium/Playwright (dotnet#31497)

* Update Selenium/Playwright

* Update selenium-config.json

* Update Versions.props

* Added VSCode debugging (for MvcSandbox) & code analysis support  (dotnet#29486)

* Added VSCode debugging support for MvcSandbox

* Added ignored vscode folders

* 1. Convered some more projects.
2. Added env variable for TargetFramework and used it in launch.json file rather than
hardcoding TFW.

* Addressed PR feedback.
1. Removed extensions.json
2. Updated BuildFromSource.md for Vscode instructions.
3. Added launch settings for BasicTestApp.

* Addressed PR feedback!

* Implement new SmallCapacityDictionary for dictionaries with a small amount of values. (dotnet#31360)

* Fix duplicated event names in KestrelTrace logger. (dotnet#31523) (dotnet#31554)

* Update area-owners.md (dotnet#31552)

* Data Protection minor tidying (dotnet#31512)

* Remove unused code

Remove unused constant, method and variable.

* Remove array allocations

Use Array.Empty() instead of allocating an empty array.
Use a static array for activation type instead of creating a new one per invocation.

* Rename field

Address PR feedback.

* [SignalR TS] Improve connection error messages (dotnet#31402)

* [MVC] Fix MSB4186 error (dotnet#31066)

Fix MSB4186 error if a project references Microsoft.AspNetCore.Mvc.Testing that is not itself an ASP.NET project, such as a helper library in a test suite.

* Re-use cancellation tokens in the https middleware (dotnet#31528)

* Re-use cancellation tokens in the https middleware
- These tokens are usually short lived and exist for the purposes of cancelling the handshake.

* Fix IPNetwork.Contains behavior for prefixes which are not at start of subnet range (dotnet#31573)

* Update branding to 5.0.6 (dotnet#31563)

* Use skipEnabledCheck for LoggerMessage.Define (dotnet#31562)

* Use skipEnabledCheck in MVC

* Use skipEnabledCheck in Http/Routing DefaultLinkGenerator, DefaultLinkParser, and DfaMatcher

* Use skipEnabledCheck in SignalR

* Use skipEnabledCheck in Components

* Use skipEnabledCheck in Hosting

* Use skipEnabledCheck in Servers/HttpSys

* Use skipEnabledCheck in Servers/Kestrel

* Use skipEnabledCheck in Middleware

* Avoid some allocations by checked IsEnabled first in MVC

* Avoid some allocations by checked IsEnabled first in Servers/Kestrel

* Simplify usage of logging in transports

* Fix up typo in Blazor Server launchSettings.json (dotnet#31580)

* Rename 'Blazor component' to 'component' to be more generic (dotnet#31590)

Co-authored-by: Adrian Wright <[email protected]>

* Update branding to 3.1.15 (dotnet#31577)

* Update branding to 3.1.15

Update Ubuntu 16.04 to 18.04

* Remove obsolete groovy code

* [release/5.0] Update nuget versions (dotnet#31490)

* Update nuget/msbuild versions

* Update nuget

* Nuget only

* Fix baseline, update to 5.8.1

* Undo test change

* Update MetadataSerializerTest.cs

* Set cab name for TargetingPack.wixproj (dotnet#30975)

* Added IConnectionSocketFeature  (dotnet#31588)

- Removed the nullable from the Socket property as approved in API review
- Make the IConnectionSocketFeature an additional feature instead of one implemented on the TransportConnection.
- Added a test to verify it works

* Fix null ref in SyntaxTokenCache (dotnet#30978) (dotnet#30988)

Fixes dotnet#27154

* Still send 100 Continue with null MinRequestBodyDataRate (dotnet#31568)

* [SignalR TS] Fix permanent Disconnecting state (dotnet#30948) (dotnet#31253)

* Fix arguments order for call of HeartbeatSlow (dotnet#28698) (dotnet#31080)

Co-authored-by: Roman Marusyk <[email protected]>

* Quarantine one failing test (dotnet#31045) (dotnet#31296)

- dotnet#31044
- `RazorPagesTemplate_RazorRuntimeCompilation_BuildsAndPublishes()`

Co-authored-by: Doug Bunting <[email protected]>

* Fix merge

* Fix merge

* Update HubConnection.Reconnect.test.ts

* Update default-build.yml

* Error boundaries (dotnet#30874)

* Remove unused ADAL dependency (dotnet#31484)

* Remove unused dependency

* Remove outdated AAD sample

* Custom event args: support receiving IJSObjectReference (dotnet#31591)

* Add failing E2E case

* Implement fix

* Add E2E test

* Update src/Components/test/testassets/BasicTestApp/EventCustomArgsComponent.razor

* Update suppressions

* [SignalR TS] Set keep alive timer in receive loop (dotnet#31300)

* Unskip some fixed E2E tests (dotnet#31614)

* Fix "no event handler" in simultaneous blur+removal case (dotnet#31612)

* [SPA] Introduces new approach for proxying the SPA templates (dotnet#31564)

* A new package Microsoft.AspNetCore.SpaProxy has been added that is
  used by the templates to launch their development proxy via npm/yarn.
* The SPA development proxy for each CLI now is the frontend for the
  application and proxies the requests to the backend which is the
  ASP.NET Core application.
* At publish time the application assets are copied to the wwwroot.
* SpaServices.Extensions has been removed from the templates since it is
  no longer needed. MapFallbackToFile("index.html") handles unknown
  requests and serves the SPA entry point.
* The templates have been updated to keep using HTTPS with the SPA proxy
  configured to use the ASP.NET Core HTTPS development certificate via a
  new aspnetcore-https.js file that ships within the template.
* The configuration for angular has been updated with a proxy.conf.js
  file to proxy requests to the backend.
* The entry point for the application in development is now
  https://localhost:5002 when using https and http://localhost:5002
  otherwise.

* Infer default sources for parameters of minimal actions (dotnet#31603)

This does a big chunk of dotnet#30248 while heavily refactoring the RequestDelegateFactory by splitting it out into a bunch of smaller methods.

For part 2 of dotnet#30248, a "scalar value type that lives in the System namespace", I went with the alternative of "Something convention-based like the presence of a bool TryParse(string, out T) method" instead. This conventions work for types in any namespace including user-defined types.

* Avoid closure caused by local function (dotnet#31641)

* Avoid closure caused by local function
- Made the local function static and passed state via parameters.

* Remove form support from minimal APIs (dotnet#31646)

* Remove form support from minimal APIs

* Add

* MapActionSample -> MinimalSample

* Remove MapActionSample.csproj from Mvc.slnf

* [Templates] Update the react template to use the CLI proxy (dotnet#31652)

Updates the react template to use the http-proxy-middleware for handling
the requests instead of the asp.net core proxy in the same way it's done
for the Angular template.

* [SignalR] Allocate HubCallerClients once per connection (dotnet#31661)

* [main] Update dependencies from dotnet/emsdk dotnet/efcore dotnet/runtime (dotnet#31576)

[main] Update dependencies from dotnet/emsdk dotnet/efcore dotnet/runtime


 - Add `RemoveDevicePlatformSupport` To `Microsoft.AspNetCore.Authentication.Negotiate.csproj`

Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Andre Milbradt <[email protected]>
Co-authored-by: Andre Milbradt <[email protected]>
Co-authored-by: Pranav K <[email protected]>
Co-authored-by: Hao Kung <[email protected]>
Co-authored-by: David Fowler <[email protected]>
Co-authored-by: Safia Abdalla <[email protected]>
Co-authored-by: Kristian Hellang <[email protected]>
Co-authored-by: msftbot[bot] <48340428+msftbot[bot]@users.noreply.github.com>
Co-authored-by: James Newton-King <[email protected]>
Co-authored-by: Chris Ross <[email protected]>
Co-authored-by: Steve Sanderson <[email protected]>
Co-authored-by: Kevin Pilch <[email protected]>
Co-authored-by: Javier Calvarro Nelson <[email protected]>
Co-authored-by: Doug Bunting <[email protected]>
Co-authored-by: N. Taylor Mullen <[email protected]>
Co-authored-by: Eilon Lipton <[email protected]>
Co-authored-by: Brennan <[email protected]>
Co-authored-by: Shreyas Jejurkar <[email protected]>
Co-authored-by: Justin Kotalik <[email protected]>
Co-authored-by: Gabriel Lucaci <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tratcher <[email protected]>
Co-authored-by: John Luo <[email protected]>
Co-authored-by: Martin Costello <[email protected]>
Co-authored-by: William Godbe <[email protected]>
Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Allison Chou <[email protected]>
Co-authored-by: Anthony J <[email protected]>
Co-authored-by: Jonathan Berube <[email protected]>
Co-authored-by: dotnet <[email protected]>
Co-authored-by: Günther Foidl <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: Ben Adams <[email protected]>
Co-authored-by: Andrzej <[email protected]>
Co-authored-by: Stephen Halter <[email protected]>
Co-authored-by: Kevin Jones <[email protected]>
Co-authored-by: Marek Linka <[email protected]>
Co-authored-by: Kevin Miller <[email protected]>
Co-authored-by: Michael Simons <[email protected]>
Co-authored-by: Youssef Victor <[email protected]>
Co-authored-by: Eric Erhardt <[email protected]>
Co-authored-by: fvoronin <[email protected]>
Co-authored-by: Paulo Morgado <[email protected]>
Co-authored-by: Tanay Parikh <[email protected]>
Co-authored-by: Adrian Wright <[email protected]>
Co-authored-by: Adrian Wright <[email protected]>
Co-authored-by: Sébastien Ros <[email protected]>
Co-authored-by: Roman Marusyk <[email protected]>
@halter73 halter73 removed the Working label Apr 14, 2021
@halter73 halter73 closed this as completed May 4, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Jun 3, 2021
@amcasey amcasey added area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-minimal Includes minimal APIs, endpoint filters, parameter binding, request delegate generator etc enhancement This issue represents an ask for new feature or an enhancement to an existing one feature-minimal-actions Controller-like actions for endpoint routing
Projects
None yet
Development

No branches or pull requests

6 participants