Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault: 11 While Archiving. #11

Open
erdem-inan opened this issue Apr 27, 2020 · 3 comments
Open

Segmentation fault: 11 While Archiving. #11

erdem-inan opened this issue Apr 27, 2020 · 3 comments
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@erdem-inan
Copy link

erdem-inan commented Apr 27, 2020

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 :)

@erdem-inan
Copy link
Author

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

@SpectralDragon
Copy link
Member

Hi! Thanks for found a problem, I'll fix it asap!

@SpectralDragon SpectralDragon added the bug Something isn't working label Apr 27, 2020
@SpectralDragon SpectralDragon self-assigned this Apr 27, 2020
@erdem-inan
Copy link
Author

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 :)

@SpectralDragon SpectralDragon added the help wanted Extra attention is needed label May 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants