Skip to content

[Question] Async over sync during app start #17

@lonix1

Description

@lonix1

Hello again Henk,

Another quick question. In this line you use GetAwaiter().GetResult() to run async-over-sync.

I'm always hesitant to do that because the number of edge cases makes my brain hurt. In this case though it should happen only once during app start, so there should not be typical problems like thread pool starvation, deadlocks, etc. - I hope! Also there is not another way I can think of.

Do you feel the current implementation is "safe"?

(Also, it may be better to do Task.Run(() => /*...*/).GetAwaiter().GetResult() instead of ().GetAwaiter().GetResult() ...maybe. I'm not an async expert!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions