Segmentation fault: 11 While Archiving.
Hello !
First Thanks you for this librairy :)
I have an issue while archiving. I got a Segmentation fault: 11 and the message that comes with this :
While silgen closureexpr SIL function "@$s9TARGET_NAME22DocumentModuleAssemblyV4bodyQrvg7SwiftDI10DIRegisterV2asyQrqd__mlFQOyAA0cD0C_AA0cD4Type_pQo_yXEfU_".
for expression at [PATH_TO_PROJECT/Document/DocumentModuleAssembly.swift:15:17 - line:17:9] RangeText="{
DIRegister({ DocumentModule() }).as(DocumentModuleType.self)"
It seems that this concerns the library. Do you have any idea ? Here is the full code of the DocumentModuleAssembly:
struct DocumentModuleAssembly: DIPart {
var body: some DIPart {
DIGroup {
DIRegister({ DocumentModule() }).as(DocumentModuleType.self)
}
}
}
And AppDelegate:
let container = DIContainer(part:
DIGroup {
DocumentModuleAssembly()
}
)
SwiftDI.useContainer(container)
Note that I have multiple ModuleAssembly, I did not put them in here. I try to remove the code one by one, but the issue appears on all the ModuleAssembly.
Also I am on Xcode 11.4
Thanks you for the help :)
For information, Its seems that the problem occurs when calling one of those methods on the DIRegister :
public func `as`<U>(_ type: U.Type) -> some DIPart
public func lifeCycle(_ value: DILifeCycle) -> some DIPart
I try to remove them and it works correctly. But i don't understand what is the issue with them... Hope this will help you
Hi! Thanks for found a problem, I'll fix it asap!
Hey! Thanks! I tried a bit by modifying the return type of the 2 methods, from some DIPart to DIRegister there and it works perfectly.
And also with this, we are able to write something like this.
DIRegister({ MyService() }).as(MyServiceType.self).lifeCycle(.single)
With the opaque type return, this is impossible. Correct me if I am wrong :).
But I am not sure this is the best solution. Hope this helps :)