Commit Graph
183 Commits
Author SHA1 Message Date
Jeremy Kuhne 3d97204233 Merge pull request dotnet/corefx#2313 from JeremyKuhne/MinorCleanup
Move Windows File I/O helper methods into common.

Commit migrated from https://github.com/dotnet/corefx/commit/1701015acd323e7ba8def2e7a45770f63f9b03a9
2015-07-17 13:10:33 -07:00
Stephen Toub b8ed353401 Merge pull request dotnet/corefx#2118 from Maxwe11/FileStreamCompletionSource-cleanup
Remove unnecessary IAsyncResult implementation

Commit migrated from https://github.com/dotnet/corefx/commit/785e22118fd136651285c1f16312a667dd6dd52b
2015-07-16 16:09:29 -04:00
Stephen Toub 2b05e04fd9 Merge pull request dotnet/corefx#2367 from stephentoub/filestream_comments
Fix stale async-related comments in FileStream

Commit migrated from https://github.com/dotnet/corefx/commit/01a4dd8d3915965900e7a66f441d2b7f59881858
2015-07-15 14:27:15 -04:00
stephentoub ba06e5b368 Fix stale async-related comments in FileStream
Leftover after the async rewrite in dotnet/corefx#972.

Fixes dotnet/corefx#2117.


Commit migrated from https://github.com/dotnet/corefx/commit/07b5a17825f0c0130b2fae647ed36086d8562160
2015-07-15 12:46:41 -04:00
stephentoub bab02c72eb Ensure all Common includes use a <Link/>
Modifies various .csproj files to ensure that all Includes for files under Common use a <Link/> so that Visual Studio shows the files under a Common folder rather than flattened in the root.

Fixes dotnet/corefx#144


Commit migrated from https://github.com/dotnet/corefx/commit/264d92084d6c6366c3c23edaaab54a32f61d501b
2015-07-15 10:21:33 -04:00
Matt Ellis fdb8be4f7b Convert UTF-16 encoded files into UTF8
UTF16 encoded files trip up both Git and GitHub since the huristic they
use to determine if a file is binary or not depends on the existence of
null bytes in a file, which is common in UTF-16 encoded source.

This converts all the UTF-16 encoded files into UTF-8 with an explicit
byte order marker.


Commit migrated from https://github.com/dotnet/corefx/commit/b660da388085b5048f7dfc101d6d0634661a30dd
2015-07-13 15:37:11 -07:00
Ian Hays 98b6021d8d -System.IO.UnixFileSystem has an issue with the "overwrite" being interpreted backwards. I simply reversed the conditional statement to be correct. There were previously no tests to cover this possibility. Resolves dotnet/corefx#2276
-Updated over a dozen test files to use the modern Xunit syntax.
-Solved file-in-use concurrency issues in the altered tests. Resolves dotnet/corefx#1313, dotnet/corefx#2227
-Tests will no longer intermittently fail.
-Slightly improved code coverage for the FileSystem files whose tests I altered (Directory, DirectoryInfo, File, FileInfo)
-Most tests altered now inherit from similar tests to consolidate the testing robustness into as few locations as possible. For example, Directory_GetFiles_str now inherits from Directory_GetFileSystemEntries_str since the tests for Directory_GetFiles_str were the exact same ones as in Directory_GetFileSystemEntries_str anyways.
-All altered tests now use the System.IO.FileSystem.Tests namespace
-Renamed the File_WriteAll_all class name/file name to File_WriteAllText.
-I tested my changes on Windows overnight to verify that there is no more intermittent test failures. I didn't have to modify all of the files listed in dotnet/corefx#2227 to get them to pass; this concerns me but I found no way to replicate the errors I was receiving before. My guess would be that the tests in the files I didn't alter (e.g. File_WriteAll and File_ReadAll) used the same names as the tests I did alter but now that the tests I altered are changed they no longer share test file names and no longer fail as a result.


Commit migrated from https://github.com/dotnet/corefx/commit/d21ce06332afe7aba0a52491187983744c10b4a4
2015-07-13 13:00:43 -07:00
Jeremy Kuhne 8eed78fc4e Move helper methods into common.
This facilitates further IO work around long paths.


Commit migrated from https://github.com/dotnet/corefx/commit/b5982a3580e171b5f1fa086b93e7862a739dac4d
2015-07-10 16:09:09 -07:00
Stephen Toub a27f80706d Merge pull request dotnet/corefx#2289 from justinvp/ioiterator
Check the state before fetching the thread id

Commit migrated from https://github.com/dotnet/corefx/commit/d9f76a83d72afcea2902a1d4f7ab86cbc66a8a20
2015-07-09 13:43:52 -04:00
Justin Van Patten fdfe13b0b7 Check the state before fetching the thread id
To be consistent with a similar change to LINQ's Iterator.


Commit migrated from https://github.com/dotnet/corefx/commit/2b8337a37c1870acdf62810305d7d915154ad035
2015-07-09 10:06:44 -07:00
stephentoub 8ca4fb4dd8 Separate platform-specifics out of shared FileSystem code
In a few places, we still have platform-specific code in shared System.IO.FileSystem code.  In particular, DirectoryInfo is doing various manipulations related to Windows path roots that can result in doing the wrong thing on Unix, e.g. creating a DirectoryInfo for "C:" on Unix should be for the directory named "C:", but instead today it'll follow the Windows-specific logic of rerouting to target the current directory.  This commit fixes that.  It also moves some code used only in the Windows implementation into Windows-specific files (e.g. Directory.SearchData).


Commit migrated from https://github.com/dotnet/corefx/commit/2450018290375fd5a736d67cca8beec7db3a7c5c
2015-07-09 12:54:32 -04:00
Jonathan Miller 1f9230cbd4 Merge pull request dotnet/corefx#2140 from sokket/fsw
Fixing bugs in the OS X FileSystemWatcher so all tests pass

Commit migrated from https://github.com/dotnet/corefx/commit/67f73d03c8be9b36f924d510d495809440772bfb
2015-07-08 14:47:31 -07:00
Stephen Toub 77a4b37c2e Merge pull request dotnet/corefx#2270 from stephentoub/directory_iterate_list
Remove List<T> allocation from directory enumeration

Commit migrated from https://github.com/dotnet/corefx/commit/c5bb21f78468aa4646581cb0501290b878e1d18e
2015-07-08 16:02:55 -04:00
Jonathan Miller 6f59447d62 Fixing bugs in OS X FileSystemWatcher to make all tests pass
Commit migrated from https://github.com/dotnet/corefx/commit/b4e803af9e5974f0ea1278bc34755fe02663dc97
2015-07-08 12:27:29 -07:00
stephentoub 33da802f6b Remove List<T> allocation from directory enumeration
While working on some path-related functionality in System.IO.FileSystem, I noticed that our methods for iterating a directory are taking the enumerable of results, storing that into a list, and then converting that list into an array.  This commit changes four such methods to skip the middle-man.


Commit migrated from https://github.com/dotnet/corefx/commit/7b5006b867ffd73e870e1fa56a5be9622d356e7a
2015-07-08 10:09:46 -04:00
stephentoub 6a4d9d4794 Fix System.IO.FileSystem's PathHelpers for Unix
The FileSystem's PathHelpers internal class contains some utility functions for processing paths.  Some of these functions are copies of non-exposed Path members, while others are unique.  A bunch of those members have Windows-specifics coded into them, which is causing problems when dealing with various special paths on Unix, for example paths that end with double dots, relative paths that begin with a space, etc.

This commit splits PathHelpers into a PathHelpers.cs, PathHelpers.Windows.cs, and PathHelpers.Unix.cs, and implements the Unix functions appropriately.

It also fixes up a variety of tests that are now failing because they were expecting the Windows behavior.


Commit migrated from https://github.com/dotnet/corefx/commit/5945d8ced21c36e091290fb92f15a5c1f4cb2274
2015-07-07 22:12:38 -04:00
stephentoub f574e42e5c Fix FileSystem tests for Unix
A bunch of the FileSystem tests assume that certain paths are always invalid, but many such paths are valid on Unix.  This commit fixes the tests that are failing after the revised Path implementation.


Commit migrated from https://github.com/dotnet/corefx/commit/f0882d6673308cded7726cd5f3fd8e2b448a3415
2015-07-06 20:53:20 -04:00
stephentoub ea70db5dc5 Implement System.IO.Path on Unix
Previously, System.IO.Path was implemented in mscorlib (with calls into Win32 on Windows / the Win32 PAL layer in libcoreclr on Unix) and type-forwarded from System.Runtime.Extensions.  With dotnet/corefx#2234, we switched the Windows build to using System.IO.Path from System.Runtime.Extensions and Path.cs from corefx, but the Unix version was left still using the mscorlib implementation.  One of the reasons for switching to the Path.cs in corefx, however, was to better enable a bunch of fixes to the behavior of the Unix implementation.

This change implements Path.cs in corefx for Unix and switches the Unix builds (Linux, OS X, and FreeBSD) over to using the implementation in corefx rather than type-forwarding to mscorlib.

Primary changes:
- Defined MaxPath / MaxComponent length in the Unix build in terms of pathconf
- Implemented the Unix build's NormalizePath to properly handle normalizing unnecessary "/", ".", and ".."s in the path.
- Implemented the Unix build's GetTempPath in terms of the TMPDIR environment variable (same logic that's in the Win32 PAL layer's implementation).
- Implemented the Unix build's GetTempFileName in terms of mkstemps.
- Implemented the Unix build's GetRandomFileName in terms of OpenSSL's RAND_pseudo_bytes, same as is done in System.Security.Cryptography.RandomNumberGenerator (which we can't reference due to layering).
- Centralized the wrapping of getcwd, which is now used from both System.Runtime.Extensions and System.IO.FileSystem.  The previous usage of it always created a temporary array of size MaxPath, which can now be quite big, so the wrapper first tries to use stack space, and then graduates to retrying with larger and larger buffer sizes.
- Centralized the MaxPath and MaxName logic, which is now used by three libraries: System.Diagnostics.Process, System.IO.FileSystem, and now System.Runtime.Extensions.
- Centralized the throwing of PathTooLongException, as it now requires arguments for how long are the maximum path and component names.
- Cleaned up a few other minor things in the shared Path.cs (e.g. naming Boolean arguments) that were confusing me as I was working through the code.
- Added FreeBSD to the .sln and .csproj files, as otherwise the FreeBSD build for this library would be broken (previously it inherited the mscorlib implementation as did the other Unix OSes).
- Added a bunch of tests, some general across both Windows and Unix, but others specifically focused on Unix, which is more lenient than is Windows in the paths it allows.


Commit migrated from https://github.com/dotnet/corefx/commit/c4bc3bbfae8a9bf50defcfb8d6e13905f1209240
2015-07-06 20:53:17 -04:00
stephentoub 4f3ed512b0 Fix FileSystem enumeration with broken symlinks
Today when enumerating directories, we look only for entries with DT_DIR (directory) or DT_REG (regular file); if we encounter something unknown or a symlink, we stat to resolve it and determine whether it's actually an S_IFDIR (directory) or S_IFREG (regular file). There are (at least) two problems with this:

1) The stat to a symlink will fail if the symlink points to a non-existent entry.
2) We end up skipping lots of special files, e.g. FIFOs.

The commit changes our logic to simply special case directories: we treat everything as a file unless we're sure it's a directory. This directly fixes (2), and indirectly fixes (1): our logic for DirectoryExists already ignores any stat errors, returning false if the symlink couldn't be resolved, such that this naturally maps to our desired behavior of broken symlinks being categorized as a file.


Commit migrated from https://github.com/dotnet/corefx/commit/5428c98a421fe7e5907c050a7e820f5045b61e61
2015-07-06 17:28:08 -04:00
Ian Hays f0f11fb21b -Updated with responses to PR feedback
-Added OSX checks for Case Sensitivity tests
-Fixed a bug within several Enumerable tests that was causing a test directory to be left over.
-Increased code coverage slightly for Directory.
-Added tests to ensure whitespace file names are acceptable on Unix machines and marked those tests with an ActiveIssue referencing the newly created dotnet/corefx#2205


Commit migrated from https://github.com/dotnet/corefx/commit/b86274bbc18186768156cf3534c25c4d48656a67
2015-07-06 09:07:05 -07:00
Ian Hays 1f363026a5 -Running the FileSystem tests no longer leaves test directories or files in the running directory. fixes dotnet/corefx#1412
-Modernized the tests for GetFIleSystemEntries and GetFiles, splitting each test case into a standalone method runnable through xunit. Similar versions of these tests now inherit from each other rather than just being copy-pasted like they were previously. Moved most test cases from using hardcoded file names to instead use GetTestFileName() in FileSystemTest.cs. Tested on Linux and Windows.
-Changed the names of some files and classes to better follow the naming conventions of the other FileSystem tests.


Commit migrated from https://github.com/dotnet/corefx/commit/9e20082a9498f2f9bf79bcebe80fd1f9efc1e39b
2015-06-30 11:31:01 -07:00
Nick Guerrera f11f9a5741 Merge pull request dotnet/corefx#2158 from dotnet-bot/from-tfs
Merge changes from TFS

Commit migrated from https://github.com/dotnet/corefx/commit/f3a7195e5f4a4bfb0cd00cbabe2a3d6059965c91
2015-06-24 17:50:22 -07:00
Nick Guerrera 5290bd052a Merge pull request dotnet/corefx#2156 from nguerrera/update-packages
Update packages to latest

Commit migrated from https://github.com/dotnet/corefx/commit/53b3e95a234ca4d87e42d32d6213b42e54160f4f
2015-06-24 17:49:50 -07:00
Eric St. John 361ffe8e78 Ensure we set ParamName of ArgumentException where applicable.
[tfs-changeset: 1493461]


Commit migrated from https://github.com/dotnet/corefx/commit/23f8d695275b8c41c1e0e4e03156597499a035ce
2015-06-24 17:09:38 -07:00
Stephen Toub eb24238114 Merge pull request dotnet/corefx#2136 from sokket/driveinfo
Refactoring DriveInfo on OS X, Linux, and FreeBSD

Commit migrated from https://github.com/dotnet/corefx/commit/f2acba353843c3898033c058529f34070ed3a9d7
2015-06-24 16:46:41 -07:00
Nick Guerrera 4c28436d2e Update package dependency versions
Commit migrated from https://github.com/dotnet/corefx/commit/0c6b87e4e67e80b5d751bcd6883ca6e89fb68157
2015-06-24 14:04:15 -07:00
Maxwe11 d6e6056b19 Remove unnecessary IAsyncResult implementation
Remove IAsyncResult implementation from classes which used with new Overlapped API.
New API doesn't require implementation of IAsyncResult.


Commit migrated from https://github.com/dotnet/corefx/commit/e66911b80621bf2b53f7b33e170ad18b3741426c
2015-06-24 14:47:06 +03:00
Matt Mitchell 9d11745057 Update build tools. Contains changes to support FreeBSD in xunit.
Float package versions to get the latest version of the netcore extensions (has FreeBSD support)


Commit migrated from https://github.com/dotnet/corefx/commit/c760824a531ffc3981148a8ef9b97f56af9ff643
2015-06-23 16:06:50 -07:00
Jonathan Miller 951c3a99fe Refactoring to a Unix DriveInfo for basic info and OS specific DriveInfo
instances for the GetDrives call


Commit migrated from https://github.com/dotnet/corefx/commit/2589d830efed209ab9705c404c2c8c97df57981e
2015-06-23 11:01:34 -07:00
Eric StJohn 1a58e04134 Update corefx packages to version 23011
Commit migrated from https://github.com/dotnet/corefx/commit/3bb2f035a7c1f6168a6bd34fbf3851f7eedf76bf
2015-06-19 16:33:53 -07:00
stephentoub 8eeec0143e Remove <AllowUnsafeBlocks/> from various test projects
Most test projects don't need unsafe code, but many were forced to allow unsafe blocks due to Interop.PlatformDetection.cs using pointers, and others were allowing it for no apparent reason.  I've modified Interop.PlatformDetection.cs to not use unsafe code, and updated the relevant test projects accordingly. (Eventually we'll switch it over to using the new RuntimeInformation assembly, anyway.)


Commit migrated from https://github.com/dotnet/corefx/commit/3ae04f6ec948331c85c5f8441cd6d9eda868603f
2015-06-16 09:59:32 -04:00
Stephen Toub 6892255f8a Merge pull request dotnet/corefx#2049 from janhenke/System.IO.FileSystem
Implement System.IO.FileSystem assembly on FreeBSD

Commit migrated from https://github.com/dotnet/corefx/commit/6dba5e55338a3cab7e4193291de99e2cb3d5d8de
2015-06-15 13:22:19 -04:00
Jan Henke 8d4d6ad8ce Implement System.IO.FileSystem assembly on FreeBSD
This adds the bits necessary to build the System.IO.FileSystem assembly for FreeBSD. I moved the Interop.posix_fdadvise.cs from Linux to Unix, since that system call is identical between Linux and FreeBSD. That file is only used for Linux and FreeBSD.


Commit migrated from https://github.com/dotnet/corefx/commit/1dd39be66ac96730992dd89ff775b245582d42b7
2015-06-15 17:14:54 +02:00
Stephen Toub 6d661838bc Merge pull request dotnet/corefx#2018 from justinvp/stringequals
Use String.Equals instead of String.Compare for equality checks

Commit migrated from https://github.com/dotnet/corefx/commit/f953d7422c5342a1a7f939c915e37004252e0fb0
2015-06-15 06:25:35 -04:00
stephentoub 92e0e0a8f3 Refactor PathInternal.*.cs partial files
To better support additional platform implementations and to help the FreeBSD port folks make forward progress, I'm refactoring our PathInternal.*.cs files to make it easier to share portions of it across platforms.


Commit migrated from https://github.com/dotnet/corefx/commit/f16697a6d6195fc1162c3691eb8c4be0388780f7
2015-06-14 14:23:00 -04:00
Justin Van Patten 43bf236f33 System.IO: String.Compare -> String.Equals
Per the Best Practices for Using Strings at
http://msdn.microsoft.com/en-us/library/dd465121(v=vs.110).aspx

* Use an overload of the String.Equals method to test whether two
strings are equal.
* Use the String.Compare and String.CompareTo methods to sort strings,
not to check for equality.


Commit migrated from https://github.com/dotnet/corefx/commit/d5a88250ddedd393270b0aece46291c53300170b
2015-06-11 19:55:48 -07:00
stephentoub 68b0c18d2d Update all project.lock.json files
Used:
build.cmd /t:RestorePackage /p:LockDependencies=true


Commit migrated from https://github.com/dotnet/corefx/commit/76fcb7ab9444f68577ca0ec17055ca8c4e574b75
2015-06-10 10:19:11 -04:00
stephentoub 200cfdfdb7 Update project.jsons to use xunit.netcore.extensions "1.0.0-prerelease-*"
Some of the project.json files were referencing xunit.netcore.extensions with ""1.0.0-prerelease" rather than "1.0.0-prerelease-*".  As a result, I was unable to use more recent additions, like PlatformID.AnyUnix.  This change just updates them to use the -* versions, and changes the few remaining places that were using PlatformID.Linux | PlatformID.OSX to instead use PlatformID.AnyUnix.  The project.lock.json files were automatically updated by my building locally.


Commit migrated from https://github.com/dotnet/corefx/commit/f28722e261368de16adc2600fa1f1d3c0993ee8d
2015-06-03 12:31:17 -04:00
Stephen Toub 4ddc414900 Merge pull request dotnet/corefx#1867 from mmitche/stress-unittests
Fix a couple issues discovered during unit test stress

Commit migrated from https://github.com/dotnet/corefx/commit/5dbb962d889478452b96c9ca755cf2ca1b3de83e
2015-06-01 12:24:37 -04:00
Matt Mitchell da7f2b4ca9 Fix a couple issues discovered during unit test stress
Commit migrated from https://github.com/dotnet/corefx/commit/98b480e13e87542b27330fc71deb1a2d7bd8b7e1
2015-05-28 17:08:10 -07:00
Eric StJohn e8454e28a5 Update projects to latest CoreFx packages
This is the result of build /t:RestorePackages /p:LockDependencies=true from the root.

This adds all missing project.lock.json files and updates existing ones to the latest package versions.


Commit migrated from https://github.com/dotnet/corefx/commit/38e0d2a0f8513afe6dc7d86a67e5776ab7b99df1
2015-05-27 12:18:06 -07:00
Eric St. John 56de195c14 Don't call DeleteVolumeMountPoint in appx.
Directory.RemoveDirectory is careful not to delete recursively across a volume mount point.  It does this by detecting the mount point via file attribute data then using DeleteVolumeMountPointW to break the mount point.  This will not work for store apps for two reasons a) unless someone has very loosely ACLed the mount point the API is going to fail with ACCESS_DENIED (UnauthorizedAccessException) b) DeleteVolumeMountPointW is not permitted as part of the modern SDK.  To adress b we are just making this API fail in the same way it would normally.  We discussed this issue with Windows and this was the reccomended approach.

[tfs-changeset: 1474880]


Commit migrated from https://github.com/dotnet/corefx/commit/184b7bb409be13e1234e411c3f2945d16c1f62ab
2015-05-21 05:51:49 -07:00
Eric St. John a8788d6383 Lock dependencies to ensure we build against a predictable package version
This change adds the lock files to repo to ensure we build against a stable set of dependencies.  To explicitly update dependencies use build.cmd /T:RestorePackages /P:LockDependencies=true and this will pick up the latest depenedencies.

Existing projects adding new dependencies will automatically update the lock file incrementally.

New projects should make sure to check their lock file in with locked set to true.

[tfs-changeset: 1474296]


Commit migrated from https://github.com/dotnet/corefx/commit/d2fbc005707933db1cebca035d6cd6073af6cae4
2015-05-21 15:23:27 -07:00
Eric Eilebrecht 40a96f0d15 Fix FileStream bug when using async mode on a handle that's already been bound.
[tfs-changeset: 1474082]


Commit migrated from https://github.com/dotnet/corefx/commit/6cae657a38ca793c6da786911a166260c7f6469d
2015-05-21 15:19:16 -07:00
Eric Eilebrecht f1814699e8 Fix build issue in System.IO.FileSystem introduced by my previous change.
[tfs-changeset: 1474075]


Commit migrated from https://github.com/dotnet/corefx/commit/e93c72f899f86ac4d6294c9e253c4af000fece2f
2015-05-21 15:17:56 -07:00
Eric Eilebrecht 56a50f9f1b Remove old Overlapped usage from Pipe, FileStream, and FileSystemWatcher
Switch usage to new ThreadPoolBoundHandle API.  This is relatively
straightforward, since this code didn't really do anything "tricky" like
re-use NativeOverlapped pointers.

Also, Enable overlapped operations in FileStream on N, now that they use
the supported API.

[tfs-changeset: 1474072]


Commit migrated from https://github.com/dotnet/corefx/commit/87270686b2e8d78953d1787422671faaf25eccb9
2015-05-21 15:17:24 -07:00
Stephen Toub 4269ca39a2 Merge pull request dotnet/corefx#1758 from stephentoub/fix_async_cancellation
Fix canceled async I/O tasks to be Canceled instead of Faulted

Commit migrated from https://github.com/dotnet/corefx/commit/d35c36c2732b462392048b84f446062a11232ce2
2015-05-16 15:49:11 +03:00
Stephen Toub 63558f222c Pass user's CancellationToken through to FileStream async Task
When we call TrySetCanceled, we want to do so using the CancellationToken that issued the cancellation request.  This will ensure that the OperationCanceledException that gets propagated contains that token and can be used for comparisons.


Commit migrated from https://github.com/dotnet/corefx/commit/b85128ccd03808e07678d9c823193cc63c1e20b4
2015-05-15 19:21:36 -04:00
Eric St. John de6614c63a Update to latest CoreFx packages
Latest packages are now on dotnet-core myget feed.

This should address a many of the warnings in the build.  I will follow up with another change to address the rest.

This change brings in the latest build tools with updates to consume "latest" packages (* versions).

I've updated every project in the repo to use * versioning for dependencies.

The new packages can be used to resolve runtime assets as well (like clrcompression.dll) so I have removed the custom code in System.IO.Compression to copy this dll.  Instead the test project references the actual System.IO.Compression package and sets the correct runtime IDs to pull out the resources.  The System.IO.Compression.dll from the package is not used since the project reference takes precedence.

I had to workaround an issue in System.Xml.XmlSerializer with the current packages: System.Runtime.WindowsRuntime 4.0.0 has a depedendency on "windows" package which doesn't exist.  This was caused by our auto-generation task not filtering the winrt reference in the reference assembly's surface area.  I've fixed this in a separate change and we can remove the workaround once we have a new set of packages.  https://github.com/dotnet/corefx/issues/1761

I also had to add a dependency to System.Security.Cryptography.Hashing.Algorithms\tests due to an issue with DNX.  It's not honoring the dependency group with no targetFramework when another dependency group exists in the nuspec.  This is inconsistent with nuget v2 and should be fixed in DNX.  https://github.com/aspnet/dnx/issues/1881

[tfs-changeset: 1471885]


Commit migrated from https://github.com/dotnet/corefx/commit/08c0d8628ef621fbd44d7aaa85b3239616a6b108
2015-05-15 12:40:33 -07:00
Stephen Toub ded8f8346b Fix canceled async I/O tasks to be Canceled instead of Faulted
When FileStream async I/O completes due to cancellation, Windows gives back an error code of ERROR_OPERATION_ABORTED.  FileStream is translating this to an OperationCanceledException and then faulting the task with that exception, rather than canceling the task.  This commit changes it to cancel the task so that it ends in the Canceled rather than Faulted state.

This fixes a regression introduced by dotnet/corefx#972.


Commit migrated from https://github.com/dotnet/corefx/commit/1e1b8ae3246e722cc082bb53e9ecedfd9c0a0434
2015-05-15 11:57:18 -04:00