Skip to content

Throw for invalid TryParse and BindAsync#36628

Merged
BrennanConroy merged 4 commits into
mainfrom
brecon/invalidfunc
Sep 17, 2021
Merged

Throw for invalid TryParse and BindAsync#36628
BrennanConroy merged 4 commits into
mainfrom
brecon/invalidfunc

Conversation

@BrennanConroy
Copy link
Copy Markdown
Member

Fixes #36523

Tried to make the error semi-nice, there is room for improvement if we're willing to loop over the args and format them

BindAsync

BindAsync method found on InvalidWrongReturnBindAsyncStruct with incorrect format. Must be a static method with format
ValueTask<InvalidWrongReturnBindAsyncStruct> BindAsync(HttpContext context, ParameterInfo parameter)
ValueTask<InvalidWrongReturnBindAsyncStruct> BindAsync(HttpContext context)
ValueTask<Nullable<InvalidWrongReturnBindAsyncStruct>> BindAsync(HttpContext context, ParameterInfo parameter)
ValueTask<Nullable<InvalidWrongReturnBindAsyncStruct>> BindAsync(HttpContext context)
but found
static System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Http.Extensions.Tests.ParameterBindingMethodCacheTests+InvalidWrongReturnBindAsyncStruct] BindAsync(Microsoft.AspNetCore.Http.HttpContext, System.Reflection.ParameterInfo)

TryParse

TryParse method found on InvalidNonStaticTryParseClass with incorrect format. Must be a static method with format
bool TryParse(string, IFormatProvider, out InvalidNonStaticTryParseClass)
bool TryParse(string, out InvalidNonStaticTryParseClass)
but found
not-static Boolean TryParse(System.String, System.IFormatProvider, InvalidNonStaticTryParseClass ByRef)

@BrennanConroy BrennanConroy added the old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels label Sep 16, 2021
@BrennanConroy BrennanConroy requested a review from a team September 16, 2021 21:52
@BrennanConroy BrennanConroy changed the title Brecon/invalidfunc Throw for invalid TryParse and BindAsync Sep 16, 2021
Comment thread src/Http/Http.Extensions/test/ParameterBindingMethodCacheTests.cs Outdated
@BrennanConroy BrennanConroy requested a review from a team September 17, 2021 02:17
@BrennanConroy
Copy link
Copy Markdown
Member Author

/backport to release/6.0-rc2

@github-actions
Copy link
Copy Markdown
Contributor

Started backporting to release/6.0-rc2: https://github.com/dotnet/aspnetcore/actions/runs/1246362176

Comment thread src/Shared/ParameterBindingMethodCache.cs Outdated
@BrennanConroy BrennanConroy merged commit bb0cde1 into main Sep 17, 2021
@BrennanConroy BrennanConroy deleted the brecon/invalidfunc branch September 17, 2021 22:41
@ghost ghost added this to the 7.0-preview1 milestone Sep 17, 2021
dougbu pushed a commit that referenced this pull request Sep 17, 2021
* Backport of #36628 to release/6.0-rc2
* Throw for invalid TryParse and BindAsync
* nit
* use TypeNameHelper
* nit

Co-authored-by: Brennan <brecon@microsoft.com>
dougbu added a commit that referenced this pull request Sep 22, 2021
* [release/6.0-rc2] Update dependencies from dotnet/efcore (#36635)

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

* [release/6.0-rc2] Handle JsonExceptions in RequestDelegateFactory (#36627)

* Handle JsonExceptions like InvalidDataExceptions in RequestDelegateFactory

* Don't catch InvalidDataExceptions when reading JSON

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

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

* Avoid using invalid content type for ValidationProblemDetails (#36618)

Co-authored-by: Safia Abdalla <safia@microsoft.com>

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

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

* Use a fake clock in the test (#36626)

Co-authored-by: Chris R <Tratcher@outlook.com>

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

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

* [release/6.0-rc2] Throw for invalid TryParse and BindAsync (#36662)

* Backport of #36628 to release/6.0-rc2
* Throw for invalid TryParse and BindAsync
* nit
* use TypeNameHelper
* nit

Co-authored-by: Brennan <brecon@microsoft.com>

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

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

* Revert Enforce WebSockets Transport for Blazor (#36656)

* Revert Enforce WebSockets Transport for Blazor (changes introduced in #34644)
* Updated Release JS Files

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

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

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

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

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

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

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

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

* [Release/6.0-rc2] Fix and test HttpSys delegation (#36698)

* Out of proc delegation tests
* Troubleshoot IsFeatureSupported
* Fix test
* Fix formatting
* Seperate tests
* Cleanup
* Fix SLN

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

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

* Find inherited TryParse and BindAsync (#36694)

Co-authored-by: Brennan <brecon@microsoft.com>

* [release/6.0-rc2] Use minimal APIs for F# project templates (#36660)

* [release/6.0-rc2] Retarget DOTNETHOME when installing x64 on ARM64 (#36695)

* Retarget DOTNETHOME when installing x64 on ARM64

* Make platform comparison case insenstive

* Address feedback

* Install x64 registry keys to different path on ARM64 machine

Co-authored-by: Eric StJohn <ericstj@microsoft.com>

* Pin analyzers that ship in the SDK (#36690) (#36754)

* Pin analyzers that ship in the SDK (#36690)

* Pin analyzers that ship in the SDK

ASP.NET Core produces a few analyzer assemblies that are shipped as part of the .NET SDK. These analyzers are added to web projects targeting 3.1 and newer.
In 6.0, we (unintentionally) bumped the version of Microsoft.CodeAnalysis that these projects referenced to a 4.0 version. This causes warnings when opening
a 3.1 or 5.0 app in VS 2019 as it does not support these versions.

Additionally update the version of Microsoft.CodeAnalysis.* packages used in tests, Razor, and framework analyzers that are only expected to run with VS 2020 to a more recent build. This is largely book-keeping, but allows us
to write a test for file scoped namespaces.

Fixes #36552

* Apply suggestions from code review

* [release/6.0-rc2] Rename and consolidate  "DelegateEndpoint" types (#36578)

* Call AddEndpointsApiExplorer() in controllers Web API template (#36753)

- backport of #36752 to release/6.0-rc2

Co-authored-by: DamianEdwards <damian@damianedwards.com>

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

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

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

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

Co-authored-by: dotnet-maestro[bot] <42748379+dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Stephen Halter <halter73@gmail.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Safia Abdalla <safia@microsoft.com>
Co-authored-by: Chris R <Tratcher@outlook.com>
Co-authored-by: Brennan <brecon@microsoft.com>
Co-authored-by: Tanay Parikh <TanayParikh@users.noreply.github.com>
Co-authored-by: Chris Ross <chrross@microsoft.com>
Co-authored-by: Eric StJohn <ericstj@microsoft.com>
Co-authored-by: Pranav K <prkrishn@hotmail.com>
Co-authored-by: DamianEdwards <damian@damianedwards.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

old-area-web-frameworks-do-not-use *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Throw for invalid TryParse and BindAsync methods

2 participants