Different issues after Swift 6 migration

Hello,

I tried last weekend to migrate my project from swift 5.10 to 6 (it's using vapor), and I've found multiple problems:

  1. For some reason some file parsing is not working anymore:
// I have this code
				guard let fileData = FileManager.default.contents(atPath: filePath)
				else {
					throw Exception(.E10006, context: ["fileName": filePath])
				}
				guard let fileString = String(data: fileData, encoding: encoding)
				else {
					throw Exception(.E10007, context: ["fileName": filePath])
				}

With swift 5, was working, but with 6 I've got the Exception code E10007. The codification of the file is ".windowsCP1252", I was using in python the codification "cp1252". Which should be right.

  1. Since I had some services to remove logic from the endpoints, this services were injected in the application, now all this services seems to be Sendable, and I've got some inheritance on the services. Which makes Sendable impossible. There is some better way to do the dependency injection? I used the docs from vapor: https://docs.vapor.codes/advanced/services/#writable
  2. Sendable seems to propagate everywhere. At some point I created a small helper class to process the data from the files I'm processing, and I ended creating a protocol to be able to support lists or dictionaries. When start propagating all the Sendables, it ended in some weird problem that the Protocol required the key to be sendable, but I was not able to modify the extension to support that.
// this is the code

// Define a protocol for collections that use a specific type as an index
protocol IndexedCollection {
	associatedtype IndexType: Hashable
	associatedtype ValueType

	func get(_ index: IndexType) -> ValueType?
}

// Extend Array to conform to IndexedCollection with IndexType as Int
extension Array: IndexedCollection {
	typealias IndexType = Int
	typealias ValueType = Element

	func get(_ index: Int) -> Element? {
		if self.count > index {
			return self[index]
		}
		return nil
	}
}

// Extend Dictionary to conform to IndexedCollection with IndexType as the Dictionary's Key
extension Dictionary: IndexedCollection {
	typealias IndexType = Key
	typealias Element = Value

	func get(_ index: Key) -> Value? {
		return self[index]
	}
}
  1. When I run the tests, right now, it takes like the double of time that it took with swift 5.10. Is this normal?

Thanks a lot for the help.