Commit Graph
1474 Commits
Author SHA1 Message Date
Adam SitnikandStephen Toub 78579ef0e7 move the validaiton logic to FileStreamOptions (#53869)
Co-authored-by: Stephen Toub <[email protected]>
2021-06-09 15:49:14 +02:00
Radek Doulik d43b00abe0 [wasm] Bump emscripten to 2.0.21 (#52870)
* Bump emscripten version

* Rename __padding to _padding to avoid warnings

And errors as we use `-Werror`:

    error G94F6014A: identifier '__padding' is reserved because it starts with '__'

C99 and C++ standard defines indentifiers with `__` prefix as reserved.

* Fix cast warning/error

With latest emscripten we get this warning (and error as we use
 `-Werror`):

    src/libraries/Native/Unix/System.Native/pal_process.c(374,92): error G3DC5E52A: cast from 'void (*)(int, siginfo_t *, void *)' to 'void (*)(int)' converts to incompatible function type [-Werror,-Wcast-function-type]
                  void (*oldhandler)(int) = (((unsigned int)sa_old.sa_flags) & SA_SIGINFO) ? (void (*)(int))sa_old.sa_sigaction : sa_old.sa_handler;

* Add `-s DISABLE_EXCEPTION_CATCHING=0`

when building dotnet.js

* Use EMSDK_PYTHON

* Use delayed expansion

Before the `EMSDK_PYTHON` was evaluated before running
the `emsdk_env.bat` script.

* Replace deprecated EXTRA_EXPORTED_RUNTIME_METHODS

with EXPORTED_RUNTIME_METHODS

Build warning/error:

    emcc : warning : EXTRA_EXPORTED_RUNTIME_METHODS is deprecated, please use EXPORTED_RUNTIME_METHODS instead [-Wdeprecated]

* Don't need to cast anymore

* 2.0.21 was just released, so try our luck ;-)

* Use new docker images with 2.0.21

* Use the sys includes fix on all platforms

* Remove deprecated --llvm-opts usage

Context: https://github.com/emscripten-core/emscripten/commit/0691cc68eef89fe59f66eacdba245470bea2a113

* Update emscripten version in the workload manifest

* Update emscripten versions in the docs

* Update eng/ versions

* Add ActiveIssue attr in the MemoryCacheTest

* Add ActiveIssue attr to the FileSystem tests

* Update after merge

* Resolve one more conflict

* Add ActiveIssue to the MemoryMappedFiles tests

* Revert "Fix cast warning/error"

This reverts commit 0a1aa4a88c07bc48d3d35c68369d1dca4897d849.

* Unset HAVE_FORK for Browser

* Remove active issue

Fixed by https://github.com/dotnet/runtime/commit/93cf5df65fc13bfbc29256acc8c9c0e102a1170b

* Set HAVE_FORK to 0

* Set HAVE_FORK to 0 instead if unsetting

* Remove -s DISABLE_EXCEPTION_CATCHING=0

It might not be needed anymore
2021-06-02 12:21:53 +02:00
Levi Broderick b759ac9716 Expose Array.Clear(Array) as public API (#53388) 2021-05-27 21:08:53 -07:00
Adam Sitnik 44f050acc0 Fold System.IO.FileSystem into CoreLib (#53231)
* move Queue<T> to System.Private.CoreLib

* fold System.IO.FileSystem into System.Private.CoreLib
2021-05-27 12:56:30 +02:00
e329c2dfcd Fix: Avoid throwing if a symbolic link cycle to itself is detected while enumerating (#52749)
* Fix: Avoid throwing on FileSystemEntry.Initialize

* Add unit tests that verify cyclic symbolic links

* Fix Windows-specific unit test failures

* Use OperatingSystem.IsWindows()

* CHange 'Assert.Equal(1, ' to 'Assert.Single('

* Rename helper method that creates self referencing symlink

* Spacing

* ConditionalClass for CanCreateSymbolicLinks

* ConditionalClass does not work in browser/ios/android, use ConditionalFact/ConditionalTheory

Co-authored-by: carlossanlop <Carlos Sanchez [email protected]>
Co-authored-by: carlossanlop <[email protected]>
2021-05-24 10:48:40 -07:00
Mitchell HwangandMitchell Hwang 5b57479fcb [MacCatalyst][libraries] Add specific SkipOnPlatform and ActiveIssues instead of test level skip (#52859)
* [MacCatalyst][libraries] Add System.Console.Tests SkipOnPlatform

* [MacCatalyst][libraries] Add System.Diagnostics.Process.Tests SkipOnPlatform

* [MacCatalyst][libraries] Add Microsoft.Extensions.Hosting.Unit.Tests SkipOnPlatform

* [MacCatalyst][libraries] Add System.Net.NetworkInformation.FunctionalTests SkipOnPlatform

* [MacCatalyst][libraries] Add System.IO.FileSystems.Tests SkipOnPlatform

* [MacCatalyst][libraries] Add Microsoft.VisualBasic.Core.Tests ActiveIssue

* [MacCatalyst][libraries] Add System.Diagnostics.Process.Tests ActiveIssue

* [MacCatalyst][libraries] Add System.Threading.Thread.Tests ActiveIssue

* [MacCatalyst][libraries] Add System.IO.FileSystem.Tests ActiveIssue

* [MacCatalyst][libraries] Add System.Runtime.Extensions.Tests ActiveIssue

* [MacCatalyst][libraries] Remove test project level skips

* [MacCatalyst] Add forgotten PNSE and ActiveIssue

* [MacCatalyst][libraries] Coalesce MacCatalyst into iOS tvOS SkipOnPlatform

Co-authored-by: Mitchell Hwang <[email protected]>
2021-05-19 11:18:00 -04:00
Adam SitnikandDavid Cantú 82289b2559 Extend FileStreamOptions with BufferSize, allow to specify 0 to disable the buffering (#52928)
* extend FileStreamOptions with BufferSize

* allow to disable the buffering by setting bufferSize to 0

* Apply suggestions from code review

Co-authored-by: David Cantú <[email protected]>
2021-05-19 09:58:32 +02:00
4e4b8bf2d9 Allow to specify file preallocation size (#51111)
Co-authored-by: Carlos Sanchez <[email protected]>
Co-authored-by: David Cantú <[email protected]>
2021-05-18 09:52:03 +02:00
Elinor Fung 63ea9c6b96 Stop including some unused files for p/invokes (#52865) 2021-05-17 18:17:23 -07:00
5297337e5b [iOS][libraries] Skip failing iOS tests with ActiveIssues and proj level skips (#51491)
In effort to assess the state of the iOS library tests, a number of tests will be skipped

Test suites that crash, hang, or have a significant number of failures (mostly 20+ failing unique test methods) are skipped on at the `tests.proj` level. Otherwise, `[ActiveIssue]` attributes have been attached to either the individual test methods that fail or the entire class if the whole test class fails. Any pre-existing `ActiveIssue` attribute associated with iOS had been reassessed to either remain or be closed.

A few test suites have been skipped because they fail with some form of `PlatformNotSupportedException`. `[SkipOnPlatform]` attributes are attached to the failing test methods.

All of the Issues can be tracked at https://github.com/dotnet/runtime/projects/48#column-9236436

The ActiveIssues and `tests.proj` exclusions have been tested on https://github.com/dotnet/runtime/pull/49917 as well.

-----------
This PR makes the following changes in the following files:
`src/libraries/System.IO.Ports/tests/System.IO.Ports.Tests.csproj` - Removed `$(NetCoreAppCurrent)-iOS` from target frameworks as it is stated to currently only supported on Windows.

`src/libraries/tests.proj` - Update the test suites that need to be skipped at the project level, reducing the number and categorizing as a skip due to PNSE, a skip due to numerous failures, and a skip due to the suite crashing.

The remaining files changed are either:
`[ActiveIssue("<issue-url>", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]`
`[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not supported on iOS or tvOS.")]`

Co-authored-by: Mitchell Hwang <[email protected]>
Co-authored-by: Tammy Qiu <[email protected]>
2021-05-12 17:40:55 +02:00
Kareem ZedanandJan Kotas b08a97afb8 Task/use get last p invoke error (#52212)
* replacing GetLastWin32Error with GetLastPInvokeError in remaining assemblies

* replace GetLastWin32Error with GetLastPInvokeError in assemblies outside system.private.corelib

* Apply suggestions from code review

Co-authored-by: Jan Kotas <[email protected]>
2021-05-09 12:42:21 -07:00
Carlos Sanchezandcarlossanlop 6a81cfa4e8 Fix: FileSystemEntry.Attributes property is not correct on Unix (#52235)
* Hidden and ReadOnly unit tests.

* Unix: Correctly collect ReadOnly and Hidden flags from files and directories.

* Remove the _initialAttributes field from FileStatus. Directly call _status.GetAttributes from FileSYstemEntry.Attributes since the disk hit is necessary anyway.

* Address simplication and nullcheck suggestions

* Defering some more file checking actions to FileStatus. Addressing accessibility of methods/properties. Addressing suggestions.

* Address feedback: Remove unnecessary asserts but document why. Remove struct initialization. Simplify the order in which Initialize checks for unknown and symlink and add a comment.

* Cache egid and euid, and refresh should reset them

* Check IsNameHidden before ensuring cache initialized and checking HasHiddenFlag.

* The ifs inside FileSystemEntry.Initialize has two mutually exclusive conditions: symlink and unknown, so use else if.

* Use entry.IsSymbolicLink directly inside Initialize.

* Remove extra symlink check in FileSystemEnumerator.MoveNext, not needed and could cause unnecessary disk hit.

* Remove unused cache checks.

* Use HasHiddenFlag as expression body

* No need to soft retrieve hidden and read-only in FileSystemEntry.Initialize if in AttributesToSkip we are going to retrieve it anyway with a disk hit. Only in the case of DT_UNKNOWN, we will pre-retrieve the file cache, but we only need it when ShouldSkip is checked, and in that case, we won't have a disk hit.

* Make FileStatus.Initialize inlined in the only place where its called.

* EnsureCacheInitialized bring back order of conditions

* Syntax sugar for nullable egid and euid lazy retrieval

Co-authored-by: carlossanlop <Carlos Sanchez [email protected]>
2021-05-08 12:07:03 -07:00
Levi Broderick 65020c9462 Don't run "reserved device names" tests on Win10 (#52282) 2021-05-04 22:14:04 -07:00
Adam Sitnik 4f3fd1a907 Fix the buffering bug that blocks SDK (#51151)
* add a failing test that mimcs the SDK bug

* fix the buffering bug
2021-04-12 23:56:38 -07:00
Alexander Köplinger bc9f00c226 Cleanup PlatformSpecific/SkipOnMono attributes that skip a platform (#50907)
We have a bunch of test assemblies that don't make sense on some platforms, e.g. Browser.
Right now we're skipping them via `[SkipOnMono("reason", TestPlatforms.Browser)]` but there's nothing that inherently ties this to Mono other than the current implementation.

The more generic `SkipOnPlatform` attribute can be used instead.
We can also use it in places where we do `[PlatformSpecific(~TestPlatforms....)]` to avoid the double inversion.
2021-04-09 13:20:18 +02:00
Adam Sitnik 8b2ad5bccf Disable Net5CompatFileStream by default (#50166) 2021-04-08 12:40:17 +02:00
Ankit Jain 8a1101d2b5 [wasm][tests] Add properties to allow passing args to xharness (#50678)
* [wasm][tests] Add properties to allow passing args to xharness

New properties:
- `$(WasmXHarnessArgs)`
- `$(WasmXHarnessMonoArgs)`
- `$(WasmTestAppArgs)`

Xharness command line is built with these:

`dotnet xharness wasm test .. $(WasmXHarnessArgs) .. -- $(WasmXHarnessMonoArgs) .. --run .. $(WasmTestAppArgs)`

* [wasm][tests] extract wasm bits into tests.wasm.targets

* [wasm] set EMSDK_PATH for makefile run-tests- targets

* [wasm] Update target dependencies for wasm

* Don't overwrite RunScriptCommand, thus fixing wasm build tests

* Track property name changes
2021-04-07 13:06:55 -04:00
Adam Sitnik 76b7dd66a3 [FileStream] Rename "Legacy" to "Net5Compat" (#50470)
* rename Legacy => Net5Compat (System.Private.CoreLib)

* rename Legacy => Net5Compat (test projects)
2021-03-31 07:01:20 -04:00
cee9df8b3f Add tracking a recursion depth in System.IO.FileSystem (#48148)
* Add tracking a depth recursion in System.IO.FileSystem

* Update src/libraries/System.IO.FileSystem/src/System/IO/EnumerationOptions.cs

Co-authored-by: Carlos Sanchez <[email protected]>

* Fix docs

* Address feedbacks

* Fix typo

* Add MaxRecursionDepth value check

* Fix net48 build: Add string to MS.IO.Redist resx file

* Fix test and initialization.

* Address feedback

Co-authored-by: Carlos Sanchez <[email protected]>
Co-authored-by: David Cantu <[email protected]>
2021-03-31 01:02:48 -07:00
Adam Sitnik 4f819108ca Dont cache file length when handle has been exposed (#50424) 2021-03-31 08:42:18 +02:00
Adam SitnikandStephen Toub db65d3761f Fix buffering bug (#50277)
Co-authored-by: Stephen Toub <[email protected]>
2021-03-26 19:57:14 +01:00
Stephen Toub 0817e748b7 Seal internal types in libraries (#50225) 2021-03-25 20:50:33 -04:00
David CantúandAdam Sitnik 010cbfe576 FileStream optimizations (#49975)
* don't verify OS handle position

* track the file offset in memory, don't use expensive syscalls to synchronize it

* there is no need to set the Length since we are now tracking the offset in memory

* Cache GetFileInformationByHandleEx (Length) when FileShare does not allow other processes to modify it

Co-authored-by: Adam Sitnik <[email protected]>
2021-03-23 10:00:46 +01:00
Adam Sitnik 5da6ba348f FileStreamStrategies refactor (#49750)
* move all strategy-related types to Strategies subfolder and namespace

* make FileStreamHelpers a partial class, move some cross-platform helper methods there

* rename config switch

* address code review feedback
2021-03-18 17:35:24 +01:00
Adam Sitnik 78027273b3 More tests for FileStream edge cases (#49754)
* add StreamConformanceTests to the solution file so we can read source code from VS

* add FileOffsetIsPreservedWhenFileStreamIsCreatedFromSafeFileHandle tests

* add WriteAsyncStartsWherePreviousReadAsyncHasFinished test
2021-03-17 19:53:43 +01:00
6ef4b2e7ab FileStream rewrite part II (#48813)
* introduce WindowsFileStreamStrategy

* introduce SyncWindowsFileStreamStrategy

* introduce AsyncWindowsFileStreamStrategy

* only DerivedFileStreamStrategy needs to have a reference to FileStream

remove finalizer from FileStream, keep it only in DerivedFileStreamStrategy and LegacyFileStreamStrategy

* use the new strategies when buffering is not enabled

* introduce BufferedFileStreamStrategy

* use the Legacy strategy by default for now, add tests for the other implementation

* Apply suggestions from code review

Co-authored-by: David Cantú <[email protected]>
Co-authored-by: Stephen Toub <[email protected]>
2021-03-17 11:55:35 +01:00
Geoff KizerandGeoffrey Kizer 027c093de1 Improve zero-byte read handling in SslStream to reduce memory usage (#49123)
* add ZeroByteRead_PerformsZeroByteReadOnUnderlyingStreamWhenDataNeeded to stream conformance tests

* remove dead code

* change SslStream zero byte read implementation to issue zero-byte read on underlying stream when appropriate

* ensure buffer is always freed when not needed, and assert this

* create StreamConformanceTests assembly and reference from appropriate test projects

Co-authored-by: Geoffrey Kizer <[email protected]>
2021-03-07 13:02:28 -08:00
87a7159be8 Introduce FileStreamStrategy as a first step of FileStream rewrite (#47128)
Co-authored-by: Stephen Toub <[email protected]>
Co-authored-by: David Cantú <[email protected]>
2021-02-24 08:28:12 +01:00
Huo Yaoyuan eba5b50216 Add NotNullWhen(true) on Directory/File.Exists (#47579)
* Add NotNullWhen(true) on Directory/File.Exists.

* Apply suggestions.
2021-01-28 15:30:21 -05:00
Konstantin GukovandKonstantin Gukov 661885ae01 Make File.Move(..., ..., overwrite: true) more efficient. (#47118)
The current implementation has an inefficiency. When moving a file across volumes, and when
the target file doesn't exist, the "rename" syscall will be called twice (unsuccesfully) instead of once.

By branching on "overwrite" from the beginning, we avoid calling the first "rename" in vain.

Co-authored-by: Konstantin Gukov <[email protected]>
2021-01-21 17:04:36 -05:00
Kenneth Pouncey c72b54243a [browser][tests][outerloop] Standup OuterLoop tests on CI (#45949)
* [browser][tests][outerloop] Standup OuterLoop tests on CI

* System.Collections.NonGeneric.Tests passing

* System.Console.Tests passing

* System.Diagnostics.DiagnosticSource.Tests passing

* System.Globalization.Tests passing

- See active issue https://github.com/dotnet/runtime/issues/45951

* System.IO.FileSystem.Tests passing after deactivating test cannot wait on monitors on this runtime.

* System.IO.FileSystem.Tests passing - See active issue: https://github.com/dotnet/runtime/issues/45954

* Remove fat fingered code.

* Threads not supported on Browser

* Browser does not support monitor

* Browser does not support monitor

* Browser does not support wait on monitors

* Browser does not support wait on monitors

* Add ActiveIssue for DataFlow tests TestNullTarget_CompletionNoCaching

* Add ActiveIssue for DataFlow tests

* Add ActiveIssue for DataFlow tests

* Add threading support conditional

* Change all Cannot wait on monitors on this runtime Browser platform checks to

[ConditionalXXXX(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))]

As was suggested in comments

* Address review comment for monitors not supported

* Address review comments

* Add threading supported condition.

```
fail: [FAIL] System.Text.Json.Serialization.Tests.EnumConverterTests.VeryLargeAmountOfEnumsToSerialize
[08:10:56] info: System.PlatformNotSupportedException : Cannot wait on monitors on this runtime.
```
2021-01-20 14:45:27 +01:00
d448461805 Implement and use MultiArrayBuffer (#44980)
* add MultiArrayBuffer and use in StreamBuffer and Http2Stream

* rework EnsureAvailableSpace and add tests for it

* make dispose handling more robust, plus minor tweaks

* add AssertExtensions.SequenceEqual for providing more useful information about sequence differences, and use in StreamConformanceTests

* tweaks

* replace _blockCount with _allocatedEnd

* use uint instead of int internally to assure bitop optimizations

* fix _allocatedEnd calculation

* address PR feedback

* more PR feedback and some minor fixes/improvements

* small test improvements

* Apply suggestions from code review

Co-authored-by: Günther Foidl <[email protected]>

* address review feedback

Co-authored-by: Geoffrey Kizer <[email protected]>
Co-authored-by: Günther Foidl <[email protected]>
2021-01-06 11:06:15 -08:00
Larry Ewing 8e913a2a81 remove workaround in #40310 (#46154) 2020-12-16 16:41:52 -06:00
Dan Moseley 264af40e62 Enable File.Copy to EXFAT volumes when not running as root (#46027)
* Allow File.Copy to succeed when futimens fails with EPERM

* Manual test

* Update pal_io.c
2020-12-15 03:20:09 +00:00
Viktor Hofer ed295782bf Add workflow to update solution files with SlnGen and update them initially (#44703)
* Add slngen infra

* Update all solution files
2020-11-17 18:23:30 +01:00
Ilya 9e4ac8bac8 File.Exists() is not null when true (#44310)
* File.Exists() is not null when true

* Fix compile

* Fix compile 2
2020-11-05 15:57:46 -05:00
Stephen Toub 16b96beeb8 Workaround xunit bug for disabling FileStreamStandaloneConformanceTests (#44295) 2020-11-05 11:20:50 -05:00
David Cantú 5e5c4ebf1d Use shared lock for files opened without FileAccess.Write on Linux (#44185)
* Use shared lock for readonly files on Linux

* Add suggested tests

* Exclude test from OSX

* Add RemoteExecutor.IsSupported condition to tests
2020-11-04 16:32:38 -08:00
David Cantú c4feddbc1d Use SetFileInformationByHandle on FileStream.SetLength (#44170)
* Use SetFileInformationByHandle on FileStream.SetLength

* Remove Interop.SetEndOfFile since is no longer used

* Add manual test

* Address feedback
2020-11-04 14:27:24 -08:00
Stephen Toub ad6ddf6469 Add stream conformance tests for SocketsHttpHandler HTTP/1.1 streams (#44204)
* Add stream conformance tests for SocketsHttpHandler HTTP/1.1 streams

* Address PR feedback
2020-11-04 08:52:08 -05:00
Stephen Toub 7de7895e37 Add stream conformance tests for standalone streams (#44069)
* Nullable-enable stream conformance tests

* Add standalone stream conformance tests

* Address PR feedback
2020-11-02 20:53:00 -05:00
Anirudh Agnihotry b37f10a504 Changing Windows_NT -> Windows for enabling TargetPlatformMoniker feature of the sdk for platform specific tfms. (#43651)
* eng change

* coreclr change

* libraries change

* tests change

* installer & mono change

* py files changed

* .md change

* .yml change

* remove redundant targetos property

* Windows_NT -> windows after ninja change

* fixing runtime build failure
2020-11-02 14:25:58 -08:00
Jan Kotas c03edcaaee Delete unnecessary seek from SetLengthInternal on Unix (#44097)
Also, improve test coverage for FileStream.SetLength
2020-11-01 06:08:42 -08:00
Stephen Toub a112379a67 Add Stream argument validation helpers and use throughout dotnet/runtime (#43968)
* Add Stream argument validation helpers and use throughout dotnet/runtime

* Delete unnecessary code in Stream

Stream.Null was using BlockingBegin/EndRead/Write, but the operations are nops (they don't even do argument validation), so the functionality was unnecessary complication.  We can just use TaskToApm instead, with already completed tasks, and then also delete the SynchronousAsyncResult that was used by these operations.

Also, the Begin/EndRead/Write methods were checking CanRead/Write and throwing if they return false, but this is a private sealed type with CanRead/Write hardcoded to return true! Delete.

Finally added consistency across Stream.Null to checking for cancellation.

* Clean up some style on Stream

Also consolidate a few resources and use a few existing ThrowHelpers where appropriate.

* Fix a few issues, and remove duplicative tests missed in conformance tests rollout

* Address PR feedback
2020-10-30 05:50:49 -04:00
Stephen Toub 0acbafe061 Add initial set of conformance tests for Stream (#43834)
* Fix invalid assert in StreamBuffer

This can be hit by calling code and thus shouldn't be an assert.  As an assert it prevents testing.

* Add ConnectedStreams.CreateUnidirectional

* Add initial set of Stream conformance tests

These primarily focus on "connected streams", ones that can be arranged to communicate with each other in a producer/consumer pattern or as a bidirectional communication mechanism, e.g. NetworkStream, PipeStream, SslStream wrapped around a NetworkStream, FileStream created around pipes, etc.  Later we can add more tests focused on standalone streams, e.g. FileStream created for an on-disk file, MemoryStream, etc.

* Add ConnectedStreams tests

These are currently helpers used by many other tests.  At some point they could become public API as well.

* Fix NetworkStream argument names

Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).

* Add stream conformance tests for NetworkStream

* Add stream conformance tests for QuicStream

* Fix several CryptoStream behaviors

1. Flushing a stream that wraps another stream for writing should always flush that underlying stream, even if no additional data was written as part of the flush.
2. Argument validation should validate buffers are not null rather than null ref'ing on a null buffer.
3. Checks for the CryptoStream mode should come after argument validation.

* Add stream conformance tests for CryptoStream

* Fix FileStream argument names

Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).

* Fix BufferedStream argument names

Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).

* Add stream conformance tests for FileStream

Specifically when used in a connected fashion, wrapped around an anonymous or named pipe.

* Add stream conformance tests for BufferedStream

Specifically when used in a connected fashion, wrapped around some other connected stream.

* Add stream conformance tests for SslStream and NegotiateStream

* Fix PipeStream.Flush to not fail on readable streams

Consumers may expect Stream.Flush to be a nop if the stream is readable only, but PipeStream.Flush is throwing in that case.  Stop doing that.

* Add stream conformance tests for PipeStream

* Fix several BrotliStream behaviors

1. When passed a null buffer, it's throwing an exception with the argument name "array", even though the parameter's name is "buffer".
2. Even if there's no data written as part of the Flush{Async} call on a writeable stream, it should be calling flush on the wrapped stream.

* Fix several DeflateStream (and friends) issues

1. DeflateStream.Flush{Async} when writing needs to always flush the underlying stream, even if there's no data written as part of the flush call itself.
2. Several byte[] array arguments should be byte[] buffer. Technically a breaking change, but the current divergence from the base Stream class is a bug, and bringing them into sync means argument exceptions that emerge from the derived type make sense when used via the base type, as well as then being able to use shared validation logic across all streams (subsequent to these changes).
3. DeflateStream.EndRead/Write needs to do additional state validation.
4. Not a bug, but simplify ReadAsync to match the sync Read implementation flow.

* Add stream conformance tests for Deflate/ZLib/GZip/BrotliStream

* Fix PipeReader/WriterStream argument validation

* Add stream conformance tests for PipeReader/WriterStream

* Remove erroneous asserts from Stream.ReadWriteTask

* Address PR feedback

* Fix a few tests in CI
2020-10-28 09:36:23 -04:00
Stephen Toub 5104f58eb4 Disable SetDateTimeMax test on Linux (#43178) 2020-10-08 15:44:23 -04:00
Stephen Toub 3b6600cbef Add IDE warnings to code analysis ruleset (#42566)
- Add all IDEXXXX warnings to ruleset, but as hidden for now
- Enable IDE0073: file header mismatch
2020-09-23 22:26:31 -04:00
Tammy QiuandAnkit Jain 876980c5ed [wasm][filesystem] add arg to testharness for setting working dir (#42020)
* [wasm][tests] Fix failing System.IO.Tests.DirectoryInfo_Name.CurrentDirectory

Co-authored-by: Ankit Jain <[email protected]>
2020-09-17 16:44:33 -04:00
David Cantú 81f52e9550 Re-enable tests for Directory.GetFileSystemEntries (#42242) 2020-09-15 14:33:05 -07:00
Carlos Sanchezandcarlossanlop 1d17ce6a48 Revert #40641 (#41817)
Reverts "Ensure FileStatus and FileSystemEntry Hidden and ReadOnly attributes are retrieved the same way"
(commit 6ed1e41e59) which introduced a perf regression.

Co-authored-by: carlossanlop <[email protected]>
2020-09-03 17:40:36 -07:00