Commit Graph

202 Commits

Author SHA1 Message Date
Pranav K 8e31319215
Prevent null refs in some simple cases in CachedExpressionCompiler
Fixes #6928
2018-05-29 11:09:48 -07:00
Ryan Brandenburg edf4e8fd9e DataAnnotations of Enum values use DataAnnotationLocalizerProvider 2018-05-25 16:00:00 -07:00
Pranav K e1eaf6a6e0
Cleanup TestCommon 2018-05-18 10:45:57 -07:00
Pranav K 777782ac6e Test cleanup 2018-05-03 16:03:42 -07:00
Doug Bunting e0e96ce53b
Include parameter type's attributes in ModelMetadata
- #7595
- #7595 relates to #7350 but does not have the same root cause
  - did _not_ revert the src changes in #7350 fix (d995b0418a)
- make non-`[Obsolete]` `ModelAttributes` constructor overload `internal`
  - should generally use `static` methods and not any constructor
  - change some unit tests to use `[Obsolete]` constructor overloads (with suppressions)
- fix test `ParameterBinderExtensions` to use current `ParameterBinder.BindModelAsync(...)` overload
  - found some tests updated `IModelMetadataProvider`, `MvcOptions`, etc. instances but didn't register them in DI
- extend `ModelBindingTestHelper` and `ModelBindingTestContext`
  - reorder some tests to use correct `MvcOptions` and `IModelMetadataProvider` everywhere
  - fixes above issues

nits:
- take a few VS suggestions
- remove an old comment indended only for PR "Reviewers:"
2018-04-17 12:40:38 -07:00
Kiran Challa e52933e4e3 Removed UrlTestEncoder references in tests
This is because with the following commit, Routing no longer depends on DI to get a UrlEncoder and always uses UrlEncoder.Default.
4184b2406d
2018-04-14 06:08:20 -07:00
Pranav K fdc4df35ed
Fix build break 2018-04-02 10:29:46 -07:00
Pranav K c7559e1ff4
Merge pull request #7590 from aspnet/release/2.1
Release/2.1
2018-04-02 09:49:14 -07:00
Pranav K c515cece8e Use ModelMetadataProvider to infer BindingSource on application model 2018-04-02 09:48:49 -07:00
Pranav K 133dd964ab Introduce ViewDataAttribute
Allow properties on controllers, Razor Page and Razor Page models annotatted with [ViewDataAttribute]
to populate ViewDataDictionary

Fixes https://github.com/aspnet/Mvc/issues/6525
2018-03-30 14:19:52 -07:00
Pranav K ccb6793126
Introduce LifecycleProperty
Update TempDataAttribute infrastructure to use LifecycleProperty
2018-03-22 10:18:36 -07:00
Doug Bunting 869825b16c
Quick fix: Add test of #2890
- tests added (ages ago) in aspnet/Mvc@a045324 no longer fail when `__` handling removed
2018-03-19 11:59:52 -07:00
Doug Bunting f061d328d9
Do not use `FormattedModelValue` in password editor template
- #7418
- add quirk switch to reverse this if necessary
2018-03-05 08:33:16 -08:00
Jass Bagga 8d1c85ab74
Add overload for AddModelError without ModelMetadata (#7407)
Addresses #6102
2018-03-02 11:03:46 -08:00
Doug Bunting daf341df35 Add more tests of #7033 scenarios 2018-02-21 15:11:52 -08:00
Charlie Daly 4f3e044928 HtmlHelper.DisplayTextFor should use DisplayAttribute of enums
- #7033
2018-02-21 15:11:51 -08:00
Fabien Lavocat c062d637fe Add new contructor in SelectListItem.cs 2018-02-06 11:01:24 -08:00
Javier Calvarro Nelson 17a407bba2 [Fixes #7271] Support covariant casting of ViewDataDictionary<T>
On HtmlHelper<T> we now support contextualizing an instance of
HtmlHelper<TBase> with a ViewDataDictionary<TDerived> in
ViewContext.ViewData.

This can happen in some situations when the model for a RazorPage has
been changed using a page application model convention.

In these cases we just build a new ViewDataDictionary<TBase> and pass in
the TDerived model as an instance.
2018-01-23 17:31:03 -08:00
Kiran Challa 00c6b53b06 [Fixes #7115] Update property type check in SaveTempDataPropertyFilterBase to match TempDataSerializer requirements 2018-01-10 15:08:01 -08:00
Pranav K b196708a3e Merge tag '2.0.2' into dev 2018-01-10 10:02:54 -08:00
Doug Bunting ecedbd5372 Allow `null` or empty `fullName` in one special case
- #6662
- users can now provide a `name` or `data-valmsg-for` attribute to avoid `ArgumentException`s
  - affects `<input>`, `<select>`, `<textarea>` elements and validation message `<div>`s
- remove `fullName` check in `DefaultHtmlGenerator.GetCurrentValues(...)` entirely

The new workaround is _not_ identical to changing `ViewData.TemplateInfo.HtmlFieldPrefix`
- does not change where expression values are found in `ModelState` or `ViewData`
- likely needs to be combined with additional workarounds i.e. for advanced use only

nits:
- clean up some excessive argument naming; add a few missing argument names
- take VS suggestions in changed classes e.g. inline a few variable declarations
- clean up some test data
2018-01-09 08:53:37 -08:00
Doug Bunting 1fa1d7df3e Add missing `RenderPartial(...)` overload
- #7127
- also remove some redundant `null` checks
2018-01-05 11:27:54 -08:00
N. Taylor Mullen 7cea779b7a Update JsonHelper to escape HTML.
- This functionality can be disabled by setting the `Switch.Microsoft.AspNetCore.Mvc.AllowJsonHtml` switch in an app.config.
- Updated tests to react to this new behavior.
- Exposed a new `PublicSerializerSettings` property on `JsonOutputFormatter` so we can accurately copy settings from the used output formatter in `JsonHelper`.
2017-12-07 16:12:43 -08:00
Kiran Challa e09ea40551 [Fixes #6591] TempData should support nullable types 2017-12-04 15:33:22 -08:00
Jass Bagga 5fffd464cd
Support input type "week" (#7045) 2017-11-16 16:00:15 -08:00
Pranav K b6144142fe Update samples and tests to target netcoreapp2.1 2017-11-13 14:58:40 -08:00
Jass Bagga bb07119b4a
Handle "month" input type (#7022)
Addresses #6615
2017-11-09 10:25:36 -08:00
Nate McMaster 2e4bc548f5
Pin tool and package versions to make builds more repeatable (#7013) 2017-10-31 19:18:14 -07:00
Pranav K 41efa409a4 Remove TestOptionsManager 2017-10-30 17:49:15 -07:00
Nate McMaster 3bfb023679 Update how PackageReference versions are set
Changes:
 - Remove floating versions
 - Disable myget feeds during a Universe build
 - Use package-specific MSBuild variables. Pattern = `packageId.Pascalize() + "PackageVersion"`, with a few exceptions.
2017-10-09 11:11:24 -07:00
Nate McMaster 3f02482617 Minor test code changes to resolve xUnit2013 build error 2017-10-05 16:04:20 -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
Doug Bunting fd9cb08790 Add Switch.Microsoft.AspNetCore.Mvc.UseDateTimeTypeForDateTimeOffset quirks mode
- patch recipients can use switch to undo the #6648 fix
2017-09-18 15:13:43 -07:00
Doug Bunting 6041c6b966 Auto-select `type="text"` for `DateTimeOffset` values
- cherry-picked from 7e4a8fe in dev
- #6648
- a different take on #4871
- `DateTime` can also round-trip `DateTimeKind.UTC` with `[DataType("datetimeoffset")]` or `[UIHint("datetimeoffset")]`
- since they're now handled differently by default, add more `DateTime` tests
- expand tests involving `Html5DateRenderingMode.CurrentCulture`

nits: make VS-suggested changes to files updated in this PR
2017-09-18 15:13:33 -07:00
Kiran Challa 3beb310866 Avoid saving TempData in case of unhandled exceptions. [Fixes #6598] BUG? Accessing TempData prevent response to have content on error. 2017-09-07 13:13:27 -07:00
Doug Bunting 7e4a8fe479 Auto-select `type="text"` for `DateTimeOffset` values
- #6648
- a different take on #4871
- `DateTime` can also round-trip `DateTimeKind.UTC` with `[DataType("datetimeoffset")]` or `[UIHint("datetimeoffset")]`
- since they're now handled differently by default, add more `DateTime` tests
- expand tests involving `Html5DateRenderingMode.CurrentCulture`

nits: make VS-suggested changes to files updated in this PR
2017-09-05 16:05:13 -07:00
Doug Bunting 8645ada6b5 Remove no-op behaviour for no-content `<label></label>` elements
- #6638
2017-08-31 09:21:44 -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
Kiran Challa b2f9ad1b67 Changed CookieTempDataProvider's CookieSecurePolicy from SameAsRequest to None 2017-08-29 14:55:52 -07:00
Kiran Challa cfc05104e4 Updated to use WebEncoders utility's Base64Url encode/decode functionality 2017-08-29 08:37:28 -07:00
Pranav K 3e8da43279 Pinning versions for 2.0.0 2017-08-17 15:00:47 -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
Ryan Nowak f80f7cefa5 Fix #6480
This change logs when we encounter and exception reading temp data from a
cookie and swallows the exception. Additionally, we clear the cookie so
that this won't happen on subsequent requests.

This will handle cases where data protection is misconfigured, or a
request just has general garbage in the cookies.
2017-07-07 13:14:03 -07:00
Chris R b9541be20d React to ISession cancellation changes 2017-07-05 14:34:48 -07:00
Nate McMaster 1eb7f9e032 Add CookieBuilder to CookieTempDataProviderOptions and obsolete duplicate API (#6472) 2017-07-05 10:19:13 -07:00
Ryan Nowak a23307e2b1 Check for properties that can't befound
If you give ModelExpressionProvider a lambda with a private property
you'll end up here. This wasn't common before, but it seems like users
are more likely to try it with pages.

Model Metadata and Model Binding don't handle private properties, so
supporting it in Model Expressions seems less than useful.

This isn't a breaking change because this case would have resulted in a
null-ref. Addresses #6400
2017-07-04 13:26:17 -07:00
Doug Bunting 293ac81fe1 Use ordinal comparisons in `ExpressionTextCache`
- #6349
- C# field and property names are case-sensitive
  - it's not important (where this cache is used) that HTML field names are case-insenstive
2017-06-29 14:59:06 -07:00
Nate McMaster 12ea28af5c React to API change in HttpAbstractions 2017-06-27 17:33:46 -07:00