- pre-restore and prebuild the project before anything that depends on it
- avoid references from other test projects doing any real work
- make ordering even more explicit
- avoid confusion between batching builds and `$(BuildInParallel)`
- turns out this also reduces the number of double writes binary logs show significantly
* Use `msbuild` from VS 2022 if available
- should ease local and TeamCity builds
- make `%InstallDir%` unquoted (unlike `%vswhere%`)
- shorten `%Path%` slightly
- nits:
- use script location more; no need to change directories
* React to new build issues
- follow up to #396
(unsure why new FxCop and "spelling" errors didn't fail that PR)
* Put `PortReserver` users into an xUnit collection
- stop trying to use DCS in the JSON and XML formatters
- if `UseDataContractSerializer` or `!UseXmlSerializer`:
- `CanReadType(...)` and `CanWriteType(...)` always return `false`
- `ReadFromStreamAsync(...)` and `WriteToStreamAsync(...)` always `throw`
- change default XML formatter configuration to use `XmlSerializer`
- adjust and disable tests in reaction
- add tests of new `netstandard1.3` behavior
- nits:
- correct namespace of `SerializerConsistencyTests`; was alone in previous namespace
- s/DataContractFormatter/XmlSerializerFormatter/ to reflect actual `XmlMediaTypeFormatter` test actions
* 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
- fix#389
- check `Stream` before first read attempt
- check `CanRead` (not `CanSeek`) before second or later read attempts
- add lots of tests of related scenarios
- nit: correct a recent `HttpContentMessageExtensions` comment
Apply suggestions from code review
- specifically, correct an `HttpMessageContent` comment
Co-authored-by: Chris Ross <Tratcher@Outlook.com>
- fix#386
- reenable `net6.0` tests disabled in #384 for this issue
- also, check `Stream.CanSeek` less when calculating `HttpMessageContent.ContentLength` value
- use inner `HttpContent.Headers.ContentLength` if available
- this changes behaviour slightly for both requests and responses
- observable as `HttpMessageContent.Headers.ContentLength!=null` for empty messages
- for responses, avoids `ContentLength==null` versus `ContentLength==0` inconsistencies (depending on platform)
- `ContentLength==null` may still occur in some corner cases (which existed before)
- e.g. when inner `HttpContent` doesn't know its length and `ReadAsStreamAsync()` hasn't completed
- main change means `HttpResponseMessage`s we expose to user code are consistent across platforms
- note: user code won't see `EmptyContent` in `HttpResponseMessage`s we create
- expand our text matrix to include a modern (and LTS) TFM
- change how Formatting test assemblies are found
- `netcoreapp` is no longer the only relevant folder prefix
- use the latest .NET 6 SDK
- install the 2.1.x runtime in the pipeline
- don't require .NET in VS
- will use binplaced `msbuild` instead
- have `git` ignore the new .msbuild/ folder
- react to new `Exception.Message`s in `netcoreapp3.1`
- handle different formatting of argument info in `ArgumentException.Message`s
- handle slightly greater `decimal` precision in a `JsonReaderException.Message`
- react to new `Exception.Message`s and other changes in `net6.0`
- handle different `Message` in `InvalidOperationException`s about invalid request URIs
- react to other changes in `net6.0`
- handle inability to mock a `Stream` if a writer passes a `ReadOnlySpan<byte>` in `net6.0`
- see moq/moq4#829, moq/moq4#979, and dotnet/runtime#45152 about the issue
- skip tests failing due to `HttpResponseMessage` changes
- see #386 and dotnet/runtime@b48900f3b3 (which introduced this)
- fix coming **Real Soon Now™️** 😁
- nits:
- simplify define use now that `NETCOREAPP3_1_OR_GREATER` and so on are available
- clean up .gitignore
- clean up a few comments and tighten scripting up
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
- noticed CI builds were using old 2.1.500
- `UseDotNet@2` seems to ignore `rollForward` when using global.json :frown:
- nits:
- quiet `dotnet` in CI (where `dotnet` is always new)
- complain about all potentially missing components when VS isn't found
- add a missing blank line
- 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`
- avoid obsolete `BsonReader` and `BsonWriter` classes
- use `NETFX_CORE` for remaining legacy case (for now)
- remove `NEWTONSOFTJSON10` define; need only `NETFX_CORE` now
* Bump Newtonsoft.Json to 13.0.1
- also bump Newtonsoft.Json.Bson to 1.0.2 in System.Net.Http.Formatting.NetStandard
- incorporates changes from 23 Dependabot PRs; they are now obsolete
- Dependabot also left `@(Reference)` items alone in project files 😦
- fixed what Dependabot didn't do i.e. corrected paths and assembly identities in those items
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/JamesNK/Newtonsoft.Json/releases">Newtonsoft.Json's releases</a>.</em></p>
<blockquote>
<h2>13.0.1</h2>
<ul>
<li>New feature - Add JsonSelectSettings with configuration for a regex timeout</li>
<li>Change - Remove portable assemblies from NuGet package</li>
<li>Change - JsonReader and JsonSerializer MaxDepth defaults to 64</li>
<li>Fix - Fixed throwing missing member error on ignored fields</li>
<li>Fix - Fixed various nullable annotations</li>
<li>Fix - Fixed annotations not being copied when tokens are cloned</li>
<li>Fix - Fixed naming strategy not being used when deserializing dictionary enum keys</li>
<li>Fix - Fixed serializing nullable struct dictionaries</li>
<li>Fix - Fixed JsonWriter.WriteToken to allow null with string token</li>
<li>Fix - Fixed missing error when deserializing JToken with a contract type mismatch</li>
<li>Fix - Fixed JTokenWriter when writing comment to an object</li>
</ul>
<h2>12.0.3</h2>
<ul>
<li>New feature - Added support for nullable reference types</li>
<li>New feature - Added KebabCaseNamingStrategy</li>
<li>Change - Package now uses embedded package icon</li>
<li>Fix - Fixed bug when merging JToken with itself</li>
<li>Fix - Fixed performance of calling ICustomTypeDescriptor.GetProperties</li>
<li>Fix - Fixed serializing Enumerable.Empty and empty arrays on .NET Core 3.0</li>
<li>Fix - Fixed deserializing some collection types with constructor</li>
<li>Fix - Fixed deserializing IImmutableSet to ImmutableHashSet instead of ImmutableSortedSet</li>
<li>Fix - Fixed deserializing IImmutableDictionary to ImmutableDictionary instead of ImmutableSortedDictionary</li>
<li>Fix - Fixed deserializing into constructors with more than 256 parameters</li>
<li>Fix - Fixed hang when deserializing JTokenReader with preceding comment</li>
<li>Fix - Fixed JSONPath scanning with nested indexer</li>
<li>Fix - Fixed deserializing incomplete JSON object to JObject</li>
<li>Fix - Fixed using StringEnumConverter with naming strategy and specified values</li>
</ul>
<h2>12.0.2</h2>
<ul>
<li>New feature - Added MissingMemberHandling to JsonObjectAttribute and JsonObjectContract</li>
<li>New feature - Added constructor to JTokenReader to specify initial path</li>
<li>New feature - Added JsonProperty.IsRequiredSpecified</li>
<li>New feature - Added JsonContract.InternalConverter</li>
<li>Change - Moved embedded debug symbols in NuGet package to a symbol package on NuGet.org</li>
<li>Fix - Fixed deserializing nullable struct collections</li>
<li>Fix - Fixed memory link when serializing enums to named values</li>
<li>Fix - Fixed error when setting JsonLoadSettings.DuplicatePropertyNameHandling to Replace</li>
</ul>
<h2>12.0.1</h2>
<ul>
<li>New feature - Added NuGet package signing</li>
<li>New feature - Added Authenticode assembly signing</li>
<li>New feature - Added SourceLink support</li>
<li>New feature - Added constructors to StringEnumConverter for setting AllowIntegerValue</li>
<li>New feature - Added JsonNameTable and JsonTextReader.PropertyNameTable</li>
<li>New feature - Added line information to JsonSerializationException</li>
<li>New feature - Added JObject.Property overload with a StringComparison</li>
<li>New feature - Added JsonMergeSettings.PropertyNameComparison</li>
<li>New feature - Added support for multiple Date constructors with JavaScriptDateTimeConverter</li>
<li>New feature - Added support for strict equals and strict not equals in JSON Path queries</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="ae9fe44e13"><code>ae9fe44</code></a> Remove compiler package and update sourcelink (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2498">#2498</a>)</li>
<li><a href="8ef662189d"><code>8ef6621</code></a> Remove prerelease for 13.0.1</li>
<li><a href="11331f50fd"><code>11331f5</code></a> Update SDK to 5.0.200 (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2495">#2495</a>)</li>
<li><a href="c7e8abc09d"><code>c7e8abc</code></a> Update to 13.0.1-beta2</li>
<li><a href="1745d7c14e"><code>1745d7c</code></a> Fix JTokenWriter when writing comment to an object (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2493">#2493</a>)</li>
<li><a href="583eb12015"><code>583eb12</code></a> Fix missing error when deserializing JToken with a contract type mismatch (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2">#2</a>...</li>
<li><a href="b6dc05be5a"><code>b6dc05b</code></a> Change MaxDepth default to 64 (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2473">#2473</a>)</li>
<li><a href="15525f1c44"><code>15525f1</code></a> Fix JsonWriter.WriteToken to allow null with string token (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2472">#2472</a>)</li>
<li><a href="926d2f0f42"><code>926d2f0</code></a> Enable embed untracked sources (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2471">#2471</a>)</li>
<li><a href="0a56633b6c"><code>0a56633</code></a> Fixes <a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2372">#2372</a> - variable typos (<a href="https://github-redirect.dependabot.com/JamesNK/Newtonsoft.Json/issues/2465">#2465</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/JamesNK/Newtonsoft.Json/compare/6.0.4...13.0.1">compare view</a></li>
</ul>
</details>
* React to Newtonsoft.Json changes
- react to `BsonReader`, `BsonWriter` deprecation
- one of our `DateTime` tests now consistently hits `5` errors
- `s/True/true/` also consistent now in another test
- `decimal` overflow now `throw`s a `JsonReaderException`
* Remove Newtonsoft.Json binding redirects
- where possible, entirely remove app.config files
- w/ consistent Newtonsoft.Json versions, these special cases are mostly not needed
- auto-generation of .config file handles the special case just fine in
System.Net.Http.Formatting.NetStandard.Test.csproj and System.Web.Http.SignalR.Test.csproj
- 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
- add azure-pipelines.yml
- clean workspace when checking out the repo
- build about the same matrix as we have on TeamCity in Main.Integration builds
- run tests only in Release job by default
- do component governance work only in Release job
- do not inject CodeQL3000 tasks (when building main)
- publish test results
- jobs usually take less than 10 minutes
- change build.cmd to enable overrides of its command line parameters
nits:
- touch up .codeql.yml to avoid test code and include portable projects
- react to a smallish breaking change in newer Owin packages
- add new test of `%` decoding to URI
- do not restore RuntimePortable.sln directly
- ignore binary logs
- ensure the .NET Core 2.1 VS component is installed
- allow use of any 2.1.5xx .NET SDK
- add a few words to code analysis dictionary
- exclude files generated for `net45` legacy projects don't cause problems when compiling for `netstandard2.0`
- handle additional `ReflectionTypeLoadException`s when using the xUnit `msbuild` runner
nits:
- capitalize "MSBuild" consistently
- reduce indentation slightly
react to a smallish breaking change in newer Owin packages
- add new test of `%` decoding to URI
- do not restore RuntimePortable.sln directly
- NuGet.exe is no longer happy w/ that solution
- ignore binary logs
- ensure the .NET Core 2.1 VS component is installed
- allow use of any 2.1.5xx .NET SDK
- add a few words to code analysis dictionary
- exclude files generated for `net45` legacy projects don't cause problems when compiling for `netstandard2.0`
- handle additional `ReflectionTypeLoadException`s when using the xUnit `msbuild` runner
nits:
- capitalize "MSBuild" consistently
- reduce indentation slightly
- see https://github.com/aspnet/AspNetWebStack/releases/tag/v3.2.8 for prominent issues resolved as well as a more detailed list of changes
Co-authored-by: Pranav Krishnamoorthy <prkrishn@microsoft.com>
Co-authored-by: Pranav K <prkrishn@hotmail.com>
Co-authored-by: dotnet-bot <dotnet-bot@microsoft.com>
- remove mention of MyGet.org since we currently do not have available nightly builds
- we hope to restore this availability soon though it's likely builds will remain infrequent
- remove `<requireLicenseAcceptance/>` as well
- can't require a license w/o `<license/>` or `<licenseUrl/>`
- also, don't need to ignore NU5125 anymore
* Configure max request line size limits to be the same as maxHeaderSize
As part of ReadAsHttpRequestMessageAsync, the parsing of the HTTP request line is limited
by a non-configurable 2k limit. The size does not affect buffer sizes, only the maximum allowed length.
This PR updates the ReadAsHttpRequestMessageAsync API to use the same limits for HTTP request line
as the HTTP header line, the latter which is configurable by user code.
In the default case, this means the HTTP request line size now supports a 16k limit before it throws.
Fixes https://github.com/aspnet/AspNetWebStack/issues/307
* Move to a current .NET SDK
- cherry-picked from release/3.2.8 commit ffbf707ddd
* Rebrand to v3.2.9 / v5.2.9
- cherry-picked from release/3.2.8 commit bc83a3a7ec (#298)
- then, switched to 3.2.9 instead of 3.2.8
- reformat README.md
- merge 'Git tag' and 'Git branch' columns
- remove old v3.2.4 / v5.2.4 information
- add v3.2.7 / v5.2.7 information