Commit Graph

486 Commits

Author SHA1 Message Date
ASP.NET CI 2e73bab2a4 Move option for JSON errors to MvcJsonOptions
This was in the wrong place - JSON formatters have their own options
type already.

Moved the option to MvcJsonOptions and updated the naming + defaults to
reflect our plan.

Also did a bunch of general cleanup on these tests, which were a bit
sloppy.
2018-01-07 21:48:58 -08:00
Kiran Challa 40d027fca3 File results - logging 2018-01-04 23:49:13 -08:00
Ryan Nowak bf61ce2b8f Document compatiblity switch for input formatter exceptions 2018-01-03 11:23:05 -08:00
Ryan Nowak 64259fe51c Add skips for dotnet/standard#567
This issue causes problems with ValueTuple when used across assembly
boundaries between netstandard and net4X when net471 is installed. These
tests fail consistently in appveyor and will fail on any machine with
net471 installed.
2018-01-02 20:58:39 -08:00
Doug Bunting 5778f44bf7 Use `ExceptionDispatchInfo` in `MiddlewareFilterBuilder` if available
- #6596
- better-align this code with `ResourceInvoker.Rethrow()`

nits:
- take VS suggestions in `MiddlewareFilterBuilderTest`
- clean up names like `httpCtxt`
- remove unused `Pipeline2` class
2018-01-02 14:56:41 -08:00
Ryan Nowak 82e32240a4 Update the Enum Invalid Value setting for compat
Updated the naming to follow guidelines, and set the default for 2.0
apps to false. Note that I inverted the naming, which means that I had
to invert the logic in a few places.
2017-12-29 12:09:29 -08:00
Ryan Nowak 747420e5aa
Compatibility switches (#7142)
* [Design] Compatibility switches

This introduces a pattern for versioning breaking behaviour changes in
minor releases of MVC.

The general plan is that application developers choose a release version
(2.0, 2.1, Latest) as their baseline which determines the effective
'defaults' for some options. Anything the developer sets explicitly is
an override and always wins.

Then we add a version setting to the template to point to the current
release.

This allows us to be progressive with fixing issues and improving areas
that don't work well, but offers the developer some choice about when to
adopt new behaviours. In effect, we separate new behaviours from the
libraries that develiver them. Apps can update the version, and then opt
in to new behaviours as a separate change.

* Be more american

* improve docs, add example

* Fix visibility

* Fix broken test

* Add test

* Docs!

* The rest of the tests

* fix example

* Adding docs

* PR feedback
2017-12-28 09:43:24 -08:00
Pranav K dfa085afaf Add support for areas to Razor Pages
Fixes #6926
2017-12-19 15:03:05 -08:00
Kiran Challa c8cabde1f1 Improve logging - individual filters 2017-12-18 13:16:06 -08:00
Kiran Challa 4c4a7b3c6c Improve logging - filter pipeline execution
Related to issue #6498: When enabling "Trace" logging for MVC loggers, I should be buried in log messages
2017-12-14 11:22:13 -08:00
Kiran Challa 7e26af908e [Fixes #6514] Add default ctor overload to AuthorizeFilter 2017-12-12 14:07:02 -08:00
Kiran Challa 821daa5ad0 [Fixes #7085] ApplicationModelConventionExtensions should make a copy of collections when iterating them 2017-12-12 14:03:35 -08:00
Kiran Challa db38da7edb Fix Xml formatters to taking in MvcOptions to take affect of options mutation
Related to issue [Fixes #6858] Changes to MvcOption's settings (SuppressInputFormatterBuffering & AllowBindingUndefinedValueToEnumType) are not taking affect
2017-12-06 11:44:35 -08:00
Kiran Challa 629f87181a [Fixes #6858] Changes to MvcOption's settings (SuppressInputFormatterBuffering & AllowBindingUndefinedValueToEnumType) are not taking affect 2017-12-04 14:25:41 -08:00
Pranav K b6144142fe Update samples and tests to target netcoreapp2.1 2017-11-13 14:58:40 -08:00
Steve Sanderson d9825d1547 Better JSON deserialization errors. Implements #4607, #4862 2017-11-06 23:02:13 +00:00
Pranav K ab4c519dd5 Infer multipart/form-data for FromFile parameters 2017-11-02 09:36:31 -07:00
Nate McMaster 2e4bc548f5
Pin tool and package versions to make builds more repeatable (#7013) 2017-10-31 19:18:14 -07:00
Ryan Nowak 861d78fb78
Refactor content negotiation code into a service (#6998)
* Refactor content negotiation code into a service

This is a refactor in anticipation of using this logic in some other
places
2017-10-31 16:32:37 -07:00
Pranav K 41efa409a4 Remove TestOptionsManager 2017-10-30 17:49:15 -07:00
Pranav K de2aef61ba Make controllers with ApiControllerAttribute visible in ApiExplorer 2017-10-27 12:04:12 -07:00
Pranav K 8946a68923 Infer binding sources for ApiController parameters
Fixes #6847
2017-10-16 15:20:43 -07:00
Ryan Nowak 7ba167fcd8 Add 'default response' to API Response Type
Also some cleanup and unit tests.
2017-10-09 19:48:52 -07:00
Nate McMaster 3f02482617 Minor test code changes to resolve xUnit2013 build error 2017-10-05 16:04:20 -07:00
Sébastien Ros d0a8b5f78f Port fix for URL helper redirect (#6917)
Fixes #6910
2017-10-05 11:24:18 -07:00
Pranav K 950db6587c Require attribute routing with [ApiController]
Fixes #6870
2017-10-04 13:13:20 -07:00
Ryan Nowak e3ce1f52d4 Added Conflict result helper to ControllerBase
- Added ConflictObjectResult and ConflictResult types.
- Conflict(), Conflict(object error), Conflict(ModelState modelState)
added to ControllerBase.cs.

Fixes #6172
2017-10-02 15:05:57 -07:00
Jass Bagga 2fcfc6be7c Add EnableRangeProcessing (#6895)
Addresses #6780
2017-09-29 18:39:45 -07:00
Jass Bagga eeac99985a Only set Content-Length when serving body (#6886)
Addresses #6875
2017-09-25 15:07:12 -07:00
Kiran Challa 83c3ac62fb Updated formatters to wrap exceptions in InputFormatException for invalid input 2017-09-22 14:33:17 -07:00
Ryan Nowak 38712609bb Design extensibility for executors
We have all of these executors but they aren't really
documented/supported for extensibility today. This change introduces a
pattern for action result executors so we can make them extensible.
2017-09-22 10:32:55 -07:00
Kristian Hellang 97fab8711a Add UnprocessableEntityResult, UnprocessableEntityObjectResult and ControllerBase.UnprocessableEntity methods (#6851)
* Added UnprocessableEntityResult

* Added UnprocessableEntityObjectResult

* Added UnprocessableEntity overloads to ControllerBase

Fixes https://github.com/aspnet/Mvc/issues/6795
2017-09-22 09:27:29 -07:00
Steve Sanderson 236ef5d1d1 Support validation and BindBehavior on top-level action parameters and bound properties. Fixes #6790 2017-09-22 10:13:48 +01:00
Pranav K 7f214492b8 Introduce a filter to send bad request results with details when ModelState is invalid (#6849)
* Introduce a filter to send bad request results with details when ModelState is invalid

Fixes #6789
2017-09-21 11:09:32 -07:00
Pranav K f0a5af2ba7 Revisit the unwrapping code in ControllerActionInvoker
Fixes #6679
2017-09-19 09:49:37 -07:00
Kiran Challa 23b7d8f62a Added RequestFormLimits filter.
[Fixes #5128] Overriding Request Form max upload limit
2017-09-18 13:48:15 -07:00
Ryan Nowak c09575dbd0 Fix #4914 patternize filter overrides
Adding some convenience methods to the context class and updating our
code to use them.
2017-09-18 12:12:44 -07:00
Pranav K 776c2604f8 Introduce opinionated API defaults.
* Introduce ProblemDescriptionAttribute to enhance some 4xx messages and produce better API description.
* Introduce IErrorDescriptionProvider to modify the shape of error response.

Fixes #6785, Fixes #6786
2017-09-14 17:07:34 -07:00
Kiran Challa 35601f95b3 Added a model binder for handling Enum types. [Fixes #6329] Why don't we check for Enum.IsDefined on action parameters of enum type 2017-09-14 08:25:05 -07:00
Kiran Challa 06f6de6c11 Changed RequestSizeLimitAttribute to create an authorization filter rather than a resource filter.
[Fixes #6777] RequestSizeLimit is ignored
2017-09-12 17:03:24 -07:00
Pranav K 717f1e6f7d Normalize paths in RazorViewEngine prior to invoking page factory
Fixes #6672
2017-09-07 11:36:31 -07:00
Pranav K a7cc243942 Introduce ProblemDescription 2017-09-06 18:46:35 -07:00
Pranav K 151cf44607 Introduce ActionResult<T> 2017-09-06 18:46:06 -07:00
bchavez 16c267d95e House Cleaning - Spelling and grammar 🚿 2017-08-30 14:58:44 -07:00
Nate McMaster b811e69d00 Use PackageLineup to manage PackageReference versions
- Move the Mvc.Performance project from test/ to benchmarks/.
 - Remove the Version attribute on PackageReference.
 - Add a reference to two PackageLineup's.
 - Add snippet to README explaining the additional requirement to run build.cmd /t:restore.
 - Add a target to check that packages have been pinned.
2017-08-30 12:14:11 -07:00
Pranav K 900a5c7c4c Add support for ResponseCache in Razor Pages
Fixes #6437
2017-08-18 16:25:40 -07:00
Nate McMaster 3a710c3d64 Upgrade to xunit 2.3.0-beta4 2017-08-17 10:45:03 -07:00
Nate McMaster b43b244830 Use Directory.Build.props/targets 2017-08-16 12:30:13 -07:00
Javier Calvarro Nelson f2a8c1cea7 Refactor CORS support out of MVC Core 2017-08-14 11:40:56 -07:00
Pranav K a5b55edb93 Fix filter order (#6577)
* Fix filter order
2017-07-21 10:50:34 -07:00
Hao Kung 36e24b7a31 Fix AuthZ Regression (#6574) 2017-07-20 21:18:53 -07:00
Jass Bagga b4fe715c71 Revert breaking change (#6519)
Addresses #6518
2017-07-07 17:09:36 -07:00
Pranav K 288da1a405 RedirectToPage(page, handler) does not work (#6503)
Fixes #6436
2017-07-06 14:12:57 -07:00
Doug Bunting c351712419 Add `FloatingPointTypeModelBinderProvider` and related binders
- #5502
- support thousands separators for `decimal`, `double` and `float`
- add tests demonstrating `SimpleTypeModelBinder` does not support thousands separators for numeric types
- add tests demonstrating use of commas (not thousands separators) with `enum` values
2017-07-03 17:55:04 -07:00
Hao Kung eeee3ef731 Add SignOut overload + Use new auth api (#6476) 2017-07-03 12:32:11 -07:00
Henk Mollema 948982ebff Create custom collection for model binder providers
Fixes #6161
2017-06-30 15:44:07 -07:00
Doug Bunting f76a390a4e Fall back to linear search for prefix matches
- #6469
2017-06-30 10:59:07 -07:00
Jass Bagga 17f6b17a6d Add RequestSizeLimitAttribute (#6453)
Addresses #6352
2017-06-29 13:04:27 -07:00
Doug Bunting a90f4118ad Do not include type names in `ModelState` error messages
- #6076
- add resources and accessors specifically for the element / parameter cases
- avoid `metadata.GetDisplayName()` where possible
- fill in the `ValidationContext` that `ValidatorObjectAdapter` uses
  - e.g. `Validate_NestedComplexType_IValidatableObject_Invalid()` test fails without this

Possible future work:
- improve error message used for `ModelMetadata.IsRequired` elements and parameters
- use something besides the type for `ValidationContext.DisplayName` of elements and parameters

nits:
- trailing whitespace
- use more `out var`
2017-06-28 15:16:23 -07:00
Henk Mollema 7166dfecd7 Add generic overloads on FilterCollection 2017-06-28 09:03:48 -07:00
Ryan Nowak 0ad9c7d4eb Making Pages Binding Consistent
This changeset reckonciles the binding work we did for pages with
controllers.

A quick summary:
- Moves [BindProperty] to the MVC namespace (#6401)
- Makes [FromRoute] and friends behave consistently (#6402)
- Makes [BindProperty] work with controllers (untracked)
2017-06-26 18:11:44 -07:00
Pranav K b1b7252ddc Merge pull request #6383 from aspnet/rel/2.0.0-preview2
Modify ControllerBase.RedirectToPageResult to call the correct overload
2017-06-09 15:11:23 -07:00
Pranav K d92d8cddeb Modify ControllerBase.RedirectToPageResult to call the correct overload 2017-06-09 14:40:29 -07:00
Pranav K a5f3a6425e Remove TaskCache and TaskCacheOfT 2017-06-08 08:19:20 -07:00
Pranav K 8f883e8e13 Use RazorViewAttribute \ RazorPageAttribute for view discovery 2017-06-07 13:49:24 -07:00
Jass Bagga 7ffd88757d Respond to RangeHelper refactor (#6348)
Respond to https://github.com/aspnet/StaticFiles/pull/200
2017-06-06 11:22:35 -07:00
Jass Bagga a0d9b08f58 Set Content-Length and increase BufferSize (#6347)
Addresses #6045
2017-06-01 11:27:49 -07:00
Ryan Nowak 688e518991 Add result filters to pages 2017-05-26 12:33:46 -07:00
Ryan Nowak 84e007a2a7 Move exception and result filters in base 2017-05-26 12:33:46 -07:00
Ryan Nowak e7bd6cfc06 Refactor invoker tests for reuse 2017-05-26 12:33:46 -07:00
Hao Kung 4c2d727e38 React to Auth + switch to Policy Evaluator 2017-05-25 18:23:41 -07:00
Ryan Brandenburg 03404cd3df Return to NetStandard 2017-05-25 10:34:16 -07:00
Ryan Nowak 083f55e337 Delete pranav's test logs :) 2017-05-22 17:38:27 -07:00
Pranav K c5f771d96d Use factory pattern for caching in ControllerActionInvoker 2017-05-22 13:05:55 -07:00
Jass Bagga 9aff0a67c1 Range support for FileResult(#6150)
Addresses #3702
2017-05-19 10:51:46 -07:00
Nate McMaster d70bfdd1ea Upgrade test framework versions and fix test issues 2017-05-15 14:11:27 -07:00
Steve Sanderson 014a786b45 Replace IModelBindingMessageProvider with new highly-virtual base class (#6241)
Replace IModelBindingMessageProvider with new highly-virtual base class. Fixes #6069
2017-05-10 16:02:18 +01:00
Ryan Nowak e2cb8e8ac8 A new and exciting implementation of action selection
This is an improved implementation of the ActionSelector for conventional
routing. This will do fewer dictionary lookups than the decision tree, and
will avoid OrdinalIgnoreCase hashing in the common case.
2017-05-05 17:54:09 -07:00
Pranav K 64ffcfaa89 Merge pull request #6236 from aspnet/rel/2.0.0-preview1
Change TFM to netcoreapp2.0 (#6234)
2017-05-04 22:18:48 -07:00
Pranav K 1c5e417606 Change TFM to netcoreapp2.0 (#6234)
* Change TFM to netcoreapp2.0
2017-05-04 18:11:26 -07:00
Steve Sanderson 6f3a295041 React to new ObjectMethodExecutor in Common 2017-05-03 15:40:02 +01:00
Ryan Brandenburg 42b988ad88 ./ paths relative on page. 2017-04-25 11:57:58 -07:00
Pranav K 649ee4d28d Add support for page handler to URL generating APIs. 2017-04-24 22:56:58 -07:00
Ryan Nowak 04fd762943 Rename form-action -> handler 2017-04-24 14:15:35 -07:00
Doug Bunting 141b637d20 Bump `MemoryPoolHttpResponseStreamWriter` buffer size up to 16K `char`s
- #3516
- fix tests that relied on otherwise-unused `HttpResponseStreamWriter.DefaultBufferSize`
2017-04-23 16:15:58 -07:00
Pranav K ca017eced2 Add page to AnchorTagHelper and FormTagHelper
Fixes #6088
2017-04-21 18:12:54 -07:00
Pranav K f568d3c2bc Support finding "sibling" pages when using RedirecToPage
Fixes #6083
2017-04-21 18:12:52 -07:00
Ajay Bhargav Baaskaran 8eac7c2d6c [Fixes #6117] Added RedirectToPage overloads to Controller 2017-04-21 12:19:35 -07:00
Christopher Dresel 025870e8b9 Fix #6159 - Fix deep copy for ControllerModel and ActionModel 2017-04-21 07:41:14 -07:00
Kiran Challa f4d84f50cd Upgrading Moq to 4.7.1 2017-04-20 17:07:50 -07:00
Ryan Nowak 4bf518b09b Fix #6140 - Allow linking between controller and page
The issue here is that route values used for action selection are
'global'. That means that pages need to have a 'null' route value for
'action' and controllers need to have a 'null' route value for pages. This
is the same way that areas work.

The fix is to move the 'merge' of route values up to a level where pages
and controllers can work together. Since ADPs use the russian-doll
pattern, the fix is to run this 'merge' in the controller ADP, but after
all of the ADs have been created.
2017-04-19 16:48:38 -07:00
Hao Kung 3e8cd1e7c9 MVC => Auth 2.0 2017-04-19 11:57:04 -07:00
Mike Harder e766a259ed Revert "Skip test `AssemblyPartTest.GetReferencePaths_ReturnsReferencesFromDependencyContext_IfPreserveCompilationContextIsSet`"
This reverts commit c69e48f06b.
2017-04-14 18:41:31 -07:00
Pranav K 49628bca2e Use case invariant lookups for DependencyModel to workaround CLI version differences 2017-04-14 17:03:20 -07:00
Pranav K 8fa95d66d4 Add support for suppressing inbound and outbound routing 2017-04-14 17:02:45 -07:00
Mike Harder c69e48f06b Skip test `AssemblyPartTest.GetReferencePaths_ReturnsReferencesFromDependencyContext_IfPreserveCompilationContextIsSet`
- Workaround for "Can not find compilation library location for package" (https://github.com/dotnet/cli/issues/6318)
2017-04-14 15:37:54 -07:00
Pranav K c8a1bb6914 React to deps file casing change
Fixes #6122
2017-04-13 13:09:00 -07:00
Pranav K dfbf6d43ff Temporarily skipping ReferenceAssemblies_ReturnsLoadableReferenceAssemblies 2017-04-12 14:31:21 -07:00
Jass Bagga 1a8ac88da7 Add PreserveMethod (#6075)
Addresses #5609
2017-04-10 17:31:59 -07:00
Steve Sanderson 90acd055fe Make [FromBody] treat empty request bodies as invalid (#4750) 2017-04-10 16:55:14 +01:00
Steve Sanderson 4f351bd37c Add support for media type suffixes (#5273, #6032) 2017-03-31 10:20:43 +01:00
Doug Bunting 824d65ca3d Remove `ValueProviderResultExtensions`
- #5063
- update tests that used one extension method to instead use `ModelBindingHelper` directly

nit: `mbc` -> `context`
2017-03-24 22:17:34 -07:00
Pranav K e7101f248a Support model binding to Razor Pages properties on page and PageModel classes
Fixes #5952
2017-03-24 07:45:19 -07:00
Pranav K 705c36921a Use alternate workaround for #6005 2017-03-22 19:14:46 -07:00
Pranav K 18785dbed6 Add System.Reflection.TypeExtensions to fix net46 tests 2017-03-22 06:33:04 -07:00
Pranav K badb6ce8e5 Remove net451 as a cross-compile target 2017-03-22 06:32:50 -07:00
Nate McMaster 6f7717a381 Unify dependency versions to one file 2017-03-15 16:54:32 -07:00
Pranav K de25357c28 Do not throw if a library does not have a runtime component
Fixes #5690
2017-03-14 15:07:50 -07:00
Ajay Bhargav Baaskaran 2ffaa88830 Using NullLogger types from Logging.Abstractions 2017-03-14 12:24:18 -07:00
Doug Bunting 9b3b3e91bd Re-enable functional tests on full .NET Framework
- #5873
- creating an EXE for the test project seems to work around #5873
  - also avoids dotnet/sdk#926 when building in Visual Studio

nit: clean up duplicate test data
2017-03-01 23:08:46 -08:00
N. Taylor Mullen acfad83aa6 Migrate to MSBuild
- thanx to @NTaylorMullen for initial conversion
  - e.g. AssemblyInfo.cs files were already minimized or removed :)
- allow `>=` RC3 CLI's to build and run MVC
- work around several dotnet migration issues; see #5482
- disable full .NET Framework runs of functional tests; see #5873
- remove `Microsoft.DotNet.InternalAbstractions` and `System.Xml.XmlDocument` dependencies
- remove project.json (!!), *.xproj, .notest, and web.config files

Redo earlier changes:
- apply test migration to .NET 4.5.2 in *.csproj world
  - see 63507c8 for previous, project.json work
- apply dependency version downgrade from 0097e40 in *.csproj world

Make other test-related changes:
- make Microsoft.AspNetCore.Mvc.TestDiagnosticListener a regular class library
- add support for `/p:GenerateBaselines=true` for functional and Razor.Host tests
- separate `GetCSharpTypeName_ReturnsCorrectTypeNames_ForOutParameter()` test
  - work around inability to deserialize a odd `ref` type
  - xUnit and vstest now serialize / deserialze test data more often
- skip poor test mentioned in #5768
- work around Microsoft/vstest#392
  - rename tests to avoid duplicates
- work around Microsoft/vstest#419
  - set up created `AppDomain`s with current `ApplicationBase`
2017-02-28 21:20:39 -08:00
Doug Bunting 63507c8da9 Bump test projects up to .NET 4.5.2
- aspnet/Testing#248
- xUnit no longer supports .NET 4.5.1
- update AppVeyor config so this framework version is available
- build tests for desktop .NET only on Windows
2017-02-21 07:15:36 -08:00
Jass Bagga 927e75870d Add BindingSourceMetadataProvider
Addresses #5673
2017-02-17 13:22:10 -08:00
Ryan Brandenburg 366dbde378 Add culture constructor to RouteValueProvider 2017-02-16 14:47:34 -08:00
Nate McMaster 0097e40e46 Downgrade to stable packages 2017-02-15 14:23:48 -08:00
Kiran Challa a00acceaa9 Merge branch 'rel/1.1.2' into dev 2017-02-15 12:43:37 -08:00
Kiran Challa 29647fda33 [Fixes #5801] Move call to validate constructor in ComplexTypeModelBinder into CreateModel 2017-02-15 12:33:01 -08:00
Ryan Nowak af5648c1f7 Merge branch 'rel/1.1.2' into dev 2017-02-13 08:34:18 -08:00
Ryan Nowak 531c11df2a Fix 5594 - ExceptionHandled + Result is broken
This change ensures that setting ExceptionContext.Result will always
execute if set. The problem with 1.1.0 is that when we had a real short
circuit the wrong set of conditions were checked. I suspect that when you
set ExceptionFilter.Result and didn't short circuit that result filters
were also running (which is a bug).

Added a few tests that verify that the result doesn't trigger result
filters.

I did some general cleanup on this code path to make the state transitions
more clear.

No exception was thrown -> BeginResult
Exception was handled -> ExceptionHandled
Exception was not handled -> gets rethrown
2017-02-13 07:58:32 -08:00
Doug Bunting fc40985412 Merge branch 'rel/1.1.2' into dev 2017-02-10 14:55:32 -08:00
Kiran Challa 842d661ac2 [Fixes #5698] Regression in 1.1 model binding for model types without default constructor
- Also reverts "Check for default constructor in ComplexTypeModelBinderProvider" commit d09e921c4a.
2017-02-10 11:10:02 -08:00
Kiran Challa c95c2a5a6d [Fixes #5686] Extend `ModelMetadata` to reduce ugliness 2017-02-03 11:37:28 -08:00
Ryan Nowak cf70ed663b Merge tag 'rel/1.1.1' into dev 2017-02-03 10:31:17 -08:00
Joonas Westlin d44c9aee1e Added printing of route values when a route is not matched 2017-01-27 11:31:05 -08:00
Kiran Challa 42ae78a360 [Fixes #5012] ProducesAttribute should not inherit from ResultFilterAttribute 2017-01-25 14:00:35 -08:00
Kiran Challa 8ac6b6699f [Fixes #4945] Simple string returned by controller action is not a valid JSON! 2017-01-25 13:29:18 -08:00
Ryan Nowak 5885feb7c0 Fixes a parsing bug with the AcceptHeaderParser
When we find an invalid character at the end of a media type value we
should advance and skip over it.
2017-01-23 13:12:40 -08:00
Ryan Brandenburg 305748a800 Move classes out of .Internal 2017-01-19 11:11:28 -08:00
Ryan Brandenburg 6396e14504 Add null-check back to MediaType 2017-01-18 16:56:08 -08:00
Doug Bunting ce53675b87 Add `[ValidateNever]` and `IPropertyValidationFilter`
- #5642
- lazy-load `ValidationEntry.Model`
  - avoids `Exception`s when moving to a property that will not be validated

nits:
- remove duplicate code in `ValidationVisitor`
- clarify "all properties of" doc comments
  - also add missing `<param>` doc in `ViewDataInfo`
2017-01-15 21:40:29 -08:00
Ryan Brandenburg 93774a0234 Mitigate MediaType overflow 2017-01-13 12:51:19 -08:00
Pranav K 6b0282fa84 Commonize code from ControllerActionInvokerCache and PageFilterFactoryProvider 2017-01-11 10:53:23 -08:00
Kiran Challa de0f277892 Fix attribute routing error message related to replace tokens 2017-01-04 15:43:57 -08:00
Pranav K 78492b39d8 Introduce a base type for executing auth and resource filters. 2017-01-03 11:14:15 -08:00
Jass Bagga 9146fce4ec Add extension method for IParameterModelConvention. (#5640) 2016-12-27 16:49:12 -08:00
Pranav K a42006d295 Workarond type collision
Fixes compilation error "The type 'XmlNode' exists in both 'System.Xml.ReaderWriter, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' and 'System.Xml.XmlDocument, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'"
2016-12-21 16:47:14 -08:00
Pranav K 2b50ec99df Updating to 4.4 CoreFx packages 2016-12-21 16:47:14 -08:00
Joonas Westlin 1dd1d49321 Redirects with fragment (#5519)
- Added implementation of overloads where you can specify the fragment to redirect to.
- Added unit tests
- Added XML comments, including missing documentation of existing members
2016-12-06 10:32:01 -08:00
Doug Bunting 48546dbb28 Add more to `MvcCoreServiceCollectionExtensionsTest`
- 2nd half of #5554
- follow-on to #5540 PR
2016-12-05 20:05:24 -08:00
Pranav K 52ee9afc31 Adding PageActionDescriptorProvider
Fixes #5353
2016-11-23 16:53:06 -08:00
Pranav K 5b2a4aecb6 Make Microsoft.AspNetCore.Mvc.TestCommon a regular project
* This allows specifying all it's dependencies rather than for consuming projects to do this
* Remove unused APIs
* Fix weird downgrade warnings that show up due to P2P references
2016-11-23 16:23:56 -08:00
Pranav K 74c9194aee Pinning versions for 1.1.0 release 2016-11-18 12:12:52 -08:00
Pranav K c5a5ba1fee Add support for updateable ActionDescriptorCollection
Fixes #5350
2016-11-17 10:08:38 -08:00
Pranav K 1506a44cd5 Fix downgrade warnings 2016-11-10 09:22:11 -08:00
Pranav K b82969a557 Updating versions to 1.2.0-* 2016-11-09 14:18:46 -08:00
Jass Bagga 576c0e6a65 Throw an exception if configurationType to CreateConfigureDelegate is abstract/has no parameterless ctor
Addresses #5431
2016-11-08 14:16:03 -08:00
Marcus Schweda 24d5dfb552 Dynamic assembly checks to prevent NotSupprotedExceptions from System.Reflection.Emit
Fixes #5487
2016-11-07 12:49:49 -08:00
Jass Bagga 9caa688a30 Modified exception message for duplicate keys exception in CandidateResolver
Addresses #5289
2016-11-07 11:16:11 -08:00
Hugh Bellamy 1dc4b28bbe Add AcceptedAtActionResult tests 2016-11-07 09:53:19 -08:00
Kiran Challa 0cee00aae1 [Fixes #5352] When replacing Controller.Dispose with an explicit implementation the base Dispose is an action 2016-11-04 09:34:30 -07:00
Doug Bunting f04286562e Treat `ContentType==null` and `MediaType.GetEncoding(ContentType)==null` differently
- now, if client sends e.g. `Content-type: text/json;charset=[invalid]`, service will respond with HTTP/415
 - if client sends `Content-type: text/json`, service will still try UTF-8 (or updated default encoding)
 - intentional (and slight) behaviour change from 1ac7315
- include and a few new tests and some cleanup from same commit
2016-11-03 10:51:39 -07:00
Doug Bunting 116c927e61 Revert "Do not call `Encoding.GetEncoding()` with a string from the request"
- #5351 should be Won't Fix

This reverts commit 1ac731519a.
2016-11-03 10:51:39 -07:00
Jass Bagga 0eea3c2651 Log messages added to BodyModelBinder for input formatters (#5451)
Addresses #5367
2016-10-27 09:43:53 -07:00
Doug Bunting 1ac731519a Do not call `Encoding.GetEncoding()` with a string from the request
- #5351
- fix affects only `TextInputFormatter`
 - `TextOutputFormatter` already does the Right Thing™️ with `Accept-Charset` headers
 - `ResponseContentTypeHelper` uses `Encoding.GetEncoding()` but is not passed request data
2016-10-24 14:59:49 -07:00
Ryan Brandenburg 60c59b576e Replace HashSet with a Hybrid HashSet/List
to improve performance on less nested models
2016-10-24 14:47:49 -07:00
Doug Bunting 3fdcaecaa8 Correctly handle quoted media type parameter values
- #5349
- fix or add comments about other parsing errors and inconsistencies
 - `MediaType` did not skip whitespace before the type

nits:
- use `+=`
- `<code>` -> `<c>` since the former is not for use within a paragraph
- split tests up to remove `bool expectedResult` parameters
2016-10-24 13:16:09 -07:00
Jass Bagga 79e576b86c ProducesResponseTypeAttribute(int statusCode) ctor added
Addresses #4863
2016-10-19 17:08:06 -07:00
jacalvar d5b0ebd10c Merge branch 'rel/1.1.0-preview1' into dev 2016-10-18 14:26:12 -07:00
jacalvar 9579806306 [Fixes #5150] parsing issue on asp.net when request quality factor is specified 2016-10-18 12:52:53 -07:00
joheredi 38aa48651f Fix for Issue#5150 2016-10-18 12:52:30 -07:00
John Luo d8c6c4ab34 Add support for VaryByQueryKey #2894 2016-10-18 12:31:04 -07:00
Jaspreet Bagga c2fee4d74d AcceptedResult(), AcceptedAtActionResult(), AcceptedAtRouteResult() support
Addresses #4937
2016-10-18 09:48:26 -07:00
Pranav K a52d692de0 Updating to netcoreapp1.1 2016-10-13 11:21:09 -07:00
Pranav K ed1378a365 Revert "Updating to netcoreapp1.1"
This reverts commit 398a104810.
2016-10-12 16:09:12 -07:00
Pranav K 398a104810 Updating to netcoreapp1.1 2016-10-12 14:24:52 -07:00
Kiran Challa d09e921c4a Check for default constructor in ComplexTypeModelBinderProvider 2016-10-07 16:46:13 -07:00
Kiran Challa e7fe635dab Modified FormCollectionModelBinderProvider to throw when binding for FormCollection model type.
[Fixes #4895] No parameterless Constructor defined
2016-10-07 16:46:11 -07:00
Pranav K 6fe683c585 Add Microsoft.DotNet.InternalAbstractions to fix tests 2016-10-04 10:11:09 -07:00
Pranav K 6d235e4ef5 Update partner package versions 2016-10-03 14:27:20 -07:00
Doug Bunting 4cca6b09f0 Reduce allocations during HTML generation
- #3918
- precompute size of `StringBuilder` in `ExpressionHelper`
- reduce `string` allocations in `ViewDataEvaluator`
 - also get rid of `Enumeration` state machines
- reduce the size of a few objects; use more expression-valued properties
 - e.g. don't store `_modelType` in `ModelExplorer`
- add `EmptyArray<TElement>`; make empty arrays consistently `static`
- avoid `string.Split()` in HTML and tag helpers

nits:
- make `ExpressionHelperTest` tests more stringent
- correct `Message` for an `ArgumentNullException`
- remove excess `using`s in classes I touched (but often ended up leaving otherwise unchanged)
- improve doc comments
- remove `ToString()` call on a `string`
- avoid encoding `string.Empty`
- fix test file name
- remove useless variables
- correct spelling
- improve whitespace
2016-10-03 12:17:47 -07:00
Doug Bunting 9c6c8410e2 Get rid of some duplicate test data
- remove a few warnings from output when testing in VS
2016-09-21 14:52:52 -07:00
Kiran Challa 01f7ecd9d9 [Fixes #5154] Stream should be suppressed from model metadata validation 2016-09-19 11:10:03 -07:00
Pranav K a480378a44 Make AuthorizeFilter constructable
* Make AuthorizeFilter constructable

Fixes #5253
2016-09-14 13:43:56 -07:00
Ajay Bhargav Baaskaran 4677bf13fa Reverting accidental changes 2016-09-08 08:28:51 -07:00
Crystal Qian 05392cbf35 Added view component tag helper code generator. (#5195)
This addresses #1051. There is one more pull request that needs to be completed/merged (for `CompositeTagHelperDescriptorResolver` and friends). After that, runtime should work!
2016-09-07 20:30:09 -04:00
Doug Bunting fae0e9a66e Handle `!ConvertEmptyStringToNull` cases correctly in `SimpleTypeModelBinder`
- #4988
- preserve whitespace as the setting demands
 - correct previous `string.IsNullOrEmpty()` call to match previous `ValueProviderResultExtensions.ConvertTo()` use
- short-circuit other `string`-to-`string` conversions (as `ValueProviderResultExtensions.ConvertTo()` does)
- correct documentation of `ConvertEmptyStringToNull` properties
- add more tests of these scenarios and remove duplicate `BindModel_ValidValueProviderResult_ConvertEmptyStringsToNull()` test
2016-09-02 16:15:18 -07:00
Kiran Challa f7ee16170c [Fixes #5161] Support running middleware pipeline as part of a resource filter 2016-08-30 09:26:04 -07:00
Ajay Bhargav Baaskaran 9ed753288f [Fixes #5170] Fixed KeyNotFoundException in UrlHelperFactory.GetUrlHelper() 2016-08-26 11:27:02 -07:00
Nate McMaster 3aa6d739ce
Fix broken test caused by logging change aspnet/Logging#480 2016-08-26 10:59:30 -07:00
Kiran Challa ece8f33a65 [Fixes #5175] Async resource filters' short circuited result getting executed more than once. 2016-08-25 16:30:41 -07:00
Kiran Challa a4ec3bb24a [Fixes #4991] Misleading MissingMethodException message for incorrect routes 2016-08-11 11:57:21 -07:00
Pranav K 67dce322df Updating to Moq \ Castle.Core that does not require imports 2016-08-08 12:20:14 -07:00
ivano 6e5187c1ae Using new StringRouteConstraint for area constraint 2016-08-08 08:47:04 -07:00
Kiran Challa ac98417398 ModelBinding: Remove IsReadOnly checks and add/update tests 2016-08-04 14:20:23 -07:00
ivano scifoni be5deef584 Created option for RequireHttpsAttribute.Permanent
Fixes #4650
2016-08-04 11:43:16 -07:00
jacalvar b56cab6414 Merge branch 'rel/1.0.1' into dev 2016-08-01 14:16:58 -07:00
jacalvar f0732e9e21 [Fixes #5038] HTTP Verbs mapping error GET and DELETE
When an action contained an attribute derived from HttpMethodAttribute,
doesn't specify an attribute route and there is also another attribute
extending HttpMethodAttribute that has a route defined on it; we ignored
the HttpMethodAttribute attribute without a defined route when building
the set of action selectors for the method.

This caused the resulting action to be unbounded and to accept requests
for other verbs not associated with it. The root cause of the problem was
that attributes override equality and do a field by field comparison but
ignore fields in the base classes of the type, so if an attribute is part
of a class hierarchy (like Http*Attributes) there might be two different
attributes that get considered equal.

The fix for the problem has been to change using Contains on a couple of
collections (that uses the equals method on the underlying object) and
check for the existence of the attribute on the collection directly by
using reference equality.
2016-08-01 12:49:23 -07:00
Ryan Nowak e77dc3af6a Implement manual state machine 2016-08-01 10:38:46 -07:00
Ryan Brandenburg 27a641f4bf Only create filters for models that need them (#5044) 2016-07-27 16:36:26 -07:00
jacalvar 7a3f24d49d [Fixes #4960] Action results returned from controller actions rendered as json instead of executed 2016-07-27 14:42:46 -07:00
BrennanConroy 0a5f8e013e AppDomain safety 2016-07-27 09:26:06 -07:00
Pranav K 5092e75387 Pin repo version to 1.0.1 2016-07-26 12:09:57 -07:00
Ryan Nowak fb514d7ef8 Update versions to 1.0.1-*
Also adding a version number to TestConfiguration. This is not a leaf node
so it should have a version.
2016-07-21 09:55:28 -07:00
Ryan Nowak b80f4d31f3 Add a test to verify our service lifetimes
This test uses the new features in the service provider to verify that we
don't reference any scoped services from singletons.

Note that this can't really cover the cases where we have optional
services or where we replace default services (like DI for controllers).
You'll just have to be careful.
2016-07-20 17:10:52 -07:00
Pranav K 6bdcf35670 Pin the version of dotnet-test-xunit to 1.0.0-rc3-00000-01 2016-07-19 11:14:56 -07:00
Kiran Challa 52a7c112e8 [Fixes #4876] ContentResult forcing chunked encoding 2016-07-18 16:10:01 -07:00
Kiran Challa 26b3b5ea7b [Fixes #4766] Remove disable buffering feature from our action result classes 2016-07-18 13:07:54 -07:00
Doug Bunting 52e4ca7232 Put `ModelBindingHelper` on a diet
- remove extra argument checks
- remove two test-only `ConvertTo()` overloads
 - this relates to #4521
2016-07-15 11:53:32 -07:00
zhangmm ea73434979 Fix typo in test name 2016-07-15 10:01:39 -07:00
Ryan Brandenburg 310ab25347 Make tests resilient to Localization (#5011) 2016-07-14 09:28:01 -07:00