Skip to content

Data(contentsOf:) regression on Windows in Swift 5.10 #4921

Open
@tishin

Description

@tishin

A simple script to reproduce the issue:

import Foundation

let url = URL(fileURLWithPath: "/Projects/file.txt")
if FileManager.default.fileExists(atPath: url.path) {
    print(try Data(contentsOf: url))
}

It works in Swift 5.9.2 release, but throws an error in Swift 5.10 release:

Swift/ErrorType.swift:200: Fatal error: Error raised at top level: Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"
Current stack trace:
0    (null)                             0x00007ffca6a24ae0 swift_stdlib_reportFatalErrorInFile + 132

Swift version 5.10 (swift-5.10-RELEASE)
Target: x86_64-unknown-windows-msvc
OS Version: 10.0.19045 N/A Build 19045

Possibly introduced by #4802

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions