* Rename `netstandard` Formatting projects
- Formatting.NetCore and Formatting.NetStandard names no longer make sense
* Adjust `netstandard` Formatting output paths
- align w/ new project names
* Use `NETSTANDARD1_3` and `Testing_NetStandard1_3`
- `NETFX_CORE` name no longer makes much sense
- remove both `NETFX_CORE` C# defined constant and `msbuild` property
- manually-defined constant completely unnecessary in src/ code
* Remove RuntimePortable.sln
- solution name no longer makes much sense and division adds little or no value
- add .NET Standard projects to Runtime.sln
- add solution filters for .NET Framework and .NET Standard projects
- remove `$(BuildPortable)` property and `@(SolutionsToBuild)` item group
Bump test project dependencies
- Castle.Core, Moq, and xUnit versions were all out of date
- hold xunit.runner.visualstudio version back in .NET SDK test projects
- can be moved to latest version after we stop testing on netcoreapp2.1
- add missing xunit.analyzers reference to System.Web.Razor.Test project
- move all test projects to .NET v4.6.2 (a supported framework)
- remove `netstandard` reference in System.Net.Http.Formatting.Test; not needed w/ new TFM & updated references
- further separate build of Microsoft.TestCommon project when invoked from NetCore.Test project
- special case `RestorePackages` for this case
- add System.Net.Http references to avoid conflicting versions e.g. src/ and test/ TFMs differ
React to changed xUnit APIs
- adjust Microsoft.TestCommon code
- nit: use `Array.Empty<byte>()` in `TranscodingStreamTests`
- `TranscodingStream` `internal`s can be `private` instead
Resolve xUnit issues new analyzers find
- address xUnit2000 warnings
- pass expected values to `Assert.Equal(...)` as correct (left) argument
- make generic method types explicit to avoid
`error CS0121: The call is ambiguous between the following methods or properties: ...`
- note: cannot remove unnecessary xUnit1013 suppression
- related bug (xunit/xunit#1466) apparently not fixed in 1.0.0 analyzers package
- was xunit/xunit.analyzers#82 fix (in 2017) insufficient?
React to new Moq changes
- avoid `ProtectedMock\`1.ThrowIfPublicMethod(...)` `throw`ing
- use new overloads introduced in the Moq 4.11.0 release
- adjust to Moq hiding the `ObjectProxy` type better
- update `ControllerContext` mocking to avoid NREs
- setting `HttpContext.User` on the `Object` left `get` value `null` (did nothing)
- nit: use `SetupGet(...)` for another property
Move NetCore project to use .NET SDK
- Formatting.NetCore now targets `netstandard1.3`
- was `Profile259` aka `portable-net45+wp80+win8+wpa81`, approximately `netstandard1.0`
- but Newtonsoft.Json.Bson supports `netstandard1.3` and up
- use Newtonsoft.Json.Bson in NetCore projects
- can now multi-target NetCore.Test as well
- nits:
- align src/ Formatting projects as much as possible
- align test/ Formatting projects as much as possible
- clean up the Microsoft.TestCommon project slightly
- note: NetCore project names make no sense but I'm leaving them alone for this PR
React to using Newtonsoft.Json.Bson everywhere
- remove deprecated `BsonWriter` mentions entirely
- remove legacy BSON writer test workaround
Remove unnecessary `ConcurrentDictionary` class
- was not available in `Profile259`
- leave tests to confirm correct operation w/ "real" class
Remove `UriQueryUtility` because `WebUtility` is available everywhere
- leave test to confirm `WebUtility` continues to behave about the same
- handle `WebUtility` being a `public` class
- change other tests to handle `WebUtility.UrlEncode(...)` encoding to uppercase
- unlike `UriQueryUtility.UrlEncode(...)`
Add simple classes to NetCore project
- use `ICloneable` copy to get more classes compiling
- helps NetCore in similar way to existing `MediaTypeHeaderValueExtensions`
- use `InvalidEnumArgumentException` copy to simplify code and testing
- both not available in `netstandard1.3` (or available packages) but easily duplicated
Remove unnecessary NetCore-specific GlobalSuppressions.cs file
Use `NameValueCollection` everywhere
- available (but not serializable) in `netstandard1.3`
Add `MaxDepth` support in NetCore assembly
- remove an unnecessary suppression about `MaxDepth` in `BaseJsonMediaTypeFormatter`
Add `UseDataContractJsonSerializer` support in NetCore assembly
- `XsdDataContractExporter` remains unavailable
- update XML DCS tests to handle this (previously not in NetCore assembly)
- try various workarounds
- `ReadOnlyStreamWithEncodingPreamble` causes tests to hit dotnet/runtime#80160
- restriction to UTF8 when writing is a significant issue
Copy `TranscodingStream` and related files from dotnet/runtime
- my runtime clone was at 88868b7a781f4e5b9037b8721f30440207a7aa42
Adjust `TranscodingStream` and related code to compile and run here
- add conditions to avoid references to version-specific API
- remove references to internal dotnet/runtime code
- rewrite some code more generically if performance impact likely minor
- use Microsoft.TestCommon instead of directly relying on Xunit in tests
- use C# 9.0
Use `TranscodingStream` in JSON and XML formatters
- remove `ReadOnlyStreamWithEncodingPreamble` and its tests
- was insufficient in general and doesn't work correctly in `netstandard1.3`
- see dotnet/runtime#80160
- now support a much broader set of encodings in JSON and XML formatters
- not just UTF8, UTF16BE, and UTF16LE
- JSON formatter already supported every encoding when `UseDataContractJsonSerializer` was `false`
- no longer have this downside when property is `true`
- however, quotas remain unsupported in `netstandard1.3` version of this formatter when property is `true`
- XML formatter requirement for an XML declaration in non-UTF8 content was general and is no longer an issue
Add `MediaTypeMappings` support in NetCore assembly
Add `IRequiredMemberSelector` support in NetCore assembly
Remove unnecessary NETFX_CORE workarounds
- use `DefaultContractResolver`, `GuidAttribute`, `TypeDescriptor`, `XmlElement`, `XmlNode` classes
- use `IRequiredMemberSelector` interface
- use `RequestMessage.CreateResponse()` extension method
- all available in `netstandard1.3`
- `JsonContractResolver` use is something of a late Newtonsoft.Json version reaction
- was held back by missing `IRequiredMemberSelector`
Work around missing features in `netstandard1.3`
- get classes now included in NetCore assembly compiling
- `SerializationAttribute` is not available
- therefore `Exception` is not serializable
- therefore `DefaultContractResolver.IgnoreSerializableAttribute` is not available
- `Stream.(Begin|End)(Read|Write)` and `Stream.Close()` are not available
- nit: clean up `MultipartFormDataStreamProvider` whitespace
- Use .NET SDK in NetCore.Test project
- for now, unable to target `netcoreapp2.1` in NetCore.Test project
- Microsoft.Net.Http is not compatible
- System.Net.Http types have different identities, causing compilation failures
- switch to use `dotnet vstest` for any .NET Core assemblies (just one currently)
- can use `Xunit` target for all .NET Framework assemblies
- make XunitXml.TestLogger available for .NET Core App testing
- use above test logger in repo-level testing
- integrate w/ tests that use the `Xunit` target
- don't import from xunit.msbuild.runner when targeting .NET Core; not needed
- add `$(CopyLocalLockFileAssemblies)` to these (now both .NET SDK) test projects
- xUnit assemblies were not copied (when they should have been) w/o this
- Use .NET SDK in Microsoft.TestCommon
- allows reference in .NET SDK test projects
- Create general `TestAssembly` target
- rename WebStack.xunit.targets -> WebStack.testing.targets
- rename `Xunit` target -> `TestAssembly`
- move `dotnet vstest` use into new target
- handle exit codes more consistently
- handle both SDK-style and legacy projects in one way
- set `$(RestorePackagesConfig)` to cover both project types
- allow newer .NET SDKs to align w/ VS components
- make a few `<import/>`s conditional to avoid problems in `Restore` target evaluation
- restore global packages.config before building to make StyleCop available
- move second copies of packages.config packages into packages/ folder
- update FxCop TFM
- .NET 4.0 not supported because current FxCopSdk is built against .NET 4.7.2
- suppress new warnings about old FxCop approach and not using `IFormatProvider`
- combine `RegexReplace` into `PrintTestRunSummary` task
- remove unused `WarnOnNoMatch` parameter; inline other parameters
- capture test summary in `msbuild` logs
- avoid `System.Console` use in the task
- fail task if any tests fail
- collect `xunit` task exit codes in case of catastrophic problems (not test failures)
- fail build if `PrintTestRunSummary` doesn't but errors occurred
also:
- do not test assemblies in parallel; reduce port contention issues
- avoid `CallTarget` task
nits:
- clean some trailing whitespace in C# sources
- mostly files I expect to update soon
- reduce `NuGet.exe restore` verbosity; no longer debugging that
- add console summary when using build.cmd
- reduce duplication in `RestorePackages` target
- only restore NetCore projects when `$(BuildPortable)` is `true`
- restore src NetStandard project transitively through NetStandard.Test project
- pass more properties w/ `Restore` target invocation
- enable app domains in all testing; `denied` now breaks testing in VS
- VS runner previously ignored this setting; see xunit/xunit#1533
- remove `"shadowCopy": false` setting too
- with updated xUnit packages, this setting slows testing down significantly
- handle the nearly-empty `<assembly/>` elements xUnit sometimes writes to the results file
nit:
- use leading-underscore convention for private items in the `RunTests` target
- make `@(_TestDLLsXunit)` items a bit easier to read
- precondition for other tool upgrades; xUnit in particular does not support older framework versions
No-op `test` target in Microsoft.TestCommon project
- change `CultureUtilTest` to use `Thread.CurrentThread`
- when hosted in latest MSBuild, changing `thread.CurrentThread` changes `Thread.CurrentThread` instead
- find current Microsoft.Build.Tasks assembly in WebStack.tasks.targets, not just the WebApiHelpPage project
- add `$(TestInParallel)`
- allows user to e.g. build in parallel but test assemblies serially
- default remains doing everything in parallel
- change build.cmd to set %ErrorLevel% when exiting
- add empty top-level Directory.Build.* files
Use only VS 2017 or later
- ensure same MSBuild features are available in command-line and VS builds
- move `$(MinimumVisualStudioVersion)` project settings to global location and bump required version up
Use Microsoft.NET.Sdk and `<PackageReference/>`s in .NET Standard project
- create a "real" .NET Standard 1.1 assembly, not .NET Portable v5.0
Move to latest version of the xUnit MSBuild runner
- v2.3.0 has a few bugs related to XML results files e.g. xunit/xunit#1515
- switch to current XML results format (required with v2.3.0 but doesn't hurt with later versions)
- make runner discovery version-independent
- add support for `msbuild /t:test` in test project directories
- relates to #3
- FYI CI build was fine w/ `nameof()` but disallowed `string` interpolation
- also disable these features; don't want VS offering features that won't always work
- related to #11 (4 of 4 additions)
- need xUnit.net AppDomain support in console runs but not in VS runs
- setting in `WebStack.xunit.targets` overrides `xunit.runner.json` default
- somewhat avoids issues such as xunit/xunit#353 and xunit/xunit#947
- pre-enumerating `[Theory]`s also slows down test discovery and execution
- remains a good idea to leave the test execution engine running
- #11 (4 of 4)
- newer version of `xunit.abstractions` exists (2.0.1) but it
"is not compatible with 'xunit.extensibility.core 2.1.0 constraint: xunit.abstractions (= 2.0.0)'"
- add xunit.runner.msbuild package to central packages.config
- need this package to execute tests after upgrade to xUnit.net 2.1.0
- need recent Beta to pick up PR xunit/xunit#807; MSBuild crashes otherwise
- for this part, do not make *.csproj changes that NuGet attempts; update our `WebStack.xunit.targets` instead
- use latest `xunit.exe` because Beta xunit.runner.msbuild package needs at least 2.12
- old 2.7 minimum version, 2.8 that is at https://nuget.org/nuget.exe, and 2.12 are also all old
Update TestCommon to match latest xUnit.net APIs
- continue to expose required xUnit.net classes in `Microsoft.TestCommon` namespace
- adjust to `sealed` classes, namespace moves, et cetera
- do not use removed `Assert.ThrowsDelegate` and `Assert.ThrowsDelegateWithReturn` types
- can't use these types with underlying `Assert` using `Action` and `Func<object>`
- remove `StringAssertions` since those assertions are now in xUnit.net
nits
- remove `Console.WriteLine()` from a test
- use new `Assert.Matches()` in tests checking exception messages that contain a Moq proxy type name
- #16
- remove temporary suppression for this rule
- add suppressions for a couple of rules violated only in Debug builds
Tested to confirm all MW120x rule suppresions are needed and therefore that rules work fine.
- removed global override for MW1200; already suppressed in one place it's needed (`RazorParser`)
- #2
- a few manual changes in `License.txt`, `Settings.StyleCop`, `CommonAssemblyInfo.*`, and
`tools\src\Microsoft.Web.FxCop\Properties\AssemblyInfo.cs`
Microsoft.Web.FxCop.csproj attempts to use the 12.0 version of the FxCop
binaries even if the passed in VisualStudio version is 11.0. This causes
it to compile against 12.0 but run using the 11.0 FxCopCmd.exe causing it
to fail. Instead we'll use the passed in VisualStudioVersion to select the
FxCop SDK binaries to compile against
Work Item: 1556
1. Copy System.Web.Http.OData to System.Web.OData
2. Copy System.Web.Http.OData.Test to System.Web.OData.Test
3. Generate new project guids
4. Set new src project InternalsVisibleTo to new test project
5. Update with latest changes from System.Web.Http.OData and the test project
6. Add 2 new projects to SkipStrongNames.xml
7. AssemblyTitle change
8. Move SuppressMessage from AssemblyInfo.cs to GlobalSuppressions.cs
9. Not change test project System.Web.OData.Test's RootNamespace (System.Web.Http) for now, since test resource files depend on it.
10. Suppress CA1704:IdentifiersShouldBeSpelledCorrectly for Unsortable.
1) Enable SkipStrongName for System.Web.Owin and System.Web.Owin.Test
2) updating Runtime.sln to build System.Web.Http.Owin and
System.Web.Owin.Test into CodeAnlaysis directory
Updating all the package references
Upgrading to Json.Net 4.5.11
Fixing the following issues which prevent the projects from building in 4.5:
* MachineKey.Encode/Decode are deprecated in 4.5
* ParameterInfo.GetCustomAttributes<T> was added in 4.5 causing ambiguity
* UnvalidatedRequestValues was added in 4.5 causing ambiguity
The only reason we needed to have TestHttpNamespace.bat is because some tests were taking calls for http://+:50231/ instead of http://localhost:50231/, and this behavior happened only when using HttpSelfHost. Configuring our tests not to take the broader URL space means they don't ever need admin-level access.
1) Use 50231 for all HttpSelfHostServer tests so that url reservation is
simpler
2) http.sys url reservation for integration tests so that they can be run as
non-admin user.