- #4866 3 of 3
- other than ignored parameters and properties, no vestige remains of alternate behaviours
- also remove `AllowAreas` use outside src/Mvc
- left the `IEnumerable<ICompatibilitySwitch>` implementations to avoid `breakingchanges.netcore.json` churn
- made the implementations more consistent
- left one `ConfigureCompatibilityOptions<MvcOptions>` subclass: `MvcOptionsConfigureCompatibilityOptions`
- note `AllowShortCircuitingValidationWhenNoValidatorsArePresent` default now applies to `TryValidateModel(...)` etc.
nits:
- updated `CompatibilityVersion` doc comments
- "currently unused" -> "currently ignored" in doc comments from part 2
- took a few VS suggestions
- VS seems to have cleaned up some trailing whitespace in files I had opened but didn't manually change
- #3754
- remove `#if`'s for multi-targeting where source is never multi-targeted
- left `StreamPipeReader`, `StreamPipeWriter` and their test classes alone because they're moving to CoreFx
- #7156 2 of 3
- will leave the `IEnumerable<ICompatibilitySwitch>` implementations to avoid `breakingchanges.netcore.json` churn
- will leave one `ConfigureCompatibilityOptions<MvcOptions>` subclass: `MvcOptionsConfigureCompatibilityOptions`
- a few options remain as regular properties:
- `ApiBehaviorOptions.SuppressMapClientErrors` (default `false`)
- `MvcOptions.EnableEndpointRouting` (default `true`)
- `MvcOptions.MaxValidationDepth` (default `32`)
- `MvcJsonOptions.AllowInputFormatterExceptionMessages` (default `true`)
nits:
- move `IsEffectivePolicy(...)` check earlier in `AuthorizeFilter`
- correct a typo or two
This is a workaround for a workaround that currently have in d16p1.
The Razor SDK maps all netcoreapp3.0 projects to MVC-2.1 at design time,
however this only really works if you have the Razor.Design package.
Since we have internal builds available that support MVC-3.0 we can just
manually hardcode the correct targeting of the project.
Replaces package references the following packages with local code:
Microsoft.AspNetCore.Certificates.Generation.Sources
Microsoft.Extensions.CopyOnWriteDictionary.Sources
Microsoft.Extensions.ClosedGenericMatcher.Sources
Microsoft.Extensions.ObjectMethodExecutor.Sources
Microsoft.Extensions.PropertyActivator.Sources
Microsoft.Extensions.PropertyHelper.Sources
Microsoft.Extensions.RazorViews.Sources
Microsoft.Extensions.SecurityHelper.Sources
Microsoft.Extensions.StackTrace.Sources
Microsoft.Extensions.WebEncoders.Sources
Changes:
* Ensure IIS managed and pkg projects build after the native projects
* Update projects to build test
* Update CI checks to build on macOS and Linux
* Use package baselines to manage ANCM packages
All other properties (`Predicate`, `ResponseWriter` and `AllowCachingResponses`) have a setter but `ResultStatusCodes` doesn't.
Without a setter, reusing the same status to http status code mapping is impossible and leads to duplicate code that looks like this:
```csharp
private static void ConfigureHealthChecks(IApplicationBuilder app, HealthCheckServiceOptions options)
{
app.UseHealthChecks("/health", new HealthCheckOptions
{
ResultStatusCodes =
{
[HealthStatus.Healthy] = StatusCodes.Status200OK,
[HealthStatus.Degraded] = StatusCodes.Status400BadRequest,
[HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
}
});
foreach (var name in options.Registrations.Select(e => e.Name))
{
app.UseHealthChecks($"/health/{name}", new HealthCheckOptions
{
Predicate = registration => registration.Name == name,
ResultStatusCodes =
{
[HealthStatus.Healthy] = StatusCodes.Status200OK,
[HealthStatus.Degraded] = StatusCodes.Status400BadRequest,
[HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
}
});
}
}
```
With a setter, this code could be rewritten in a *don't repeat yourself* (DRY) way:
```csharp
private static void ConfigureHealthChecks(IApplicationBuilder app, HealthCheckServiceOptions options)
{
var resultStatusCodes = new Dictionary<HealthStatus, int>
{
[HealthStatus.Healthy] = StatusCodes.Status200OK,
[HealthStatus.Degraded] = StatusCodes.Status400BadRequest,
[HealthStatus.Unhealthy] = StatusCodes.Status503ServiceUnavailable
};
app.UseHealthChecks("/health", new HealthCheckOptions
{
ResultStatusCodes = resultStatusCodes
});
foreach (var name in options.Registrations.Select(e => e.Name))
{
app.UseHealthChecks($"/health/{name}", new HealthCheckOptions
{
Predicate = registration => registration.Name == name,
ResultStatusCodes = resultStatusCodes
});
}
}
```