Avalonia: AutoSuspendHelper - crash previewer

Created on 30 Jul 2019  路  2Comments  路  Source: AvaloniaUI/Avalonia

When i create an instance of AutoSuspendHelper:
var suspension = new AutoSuspendHelper(ApplicationLifetime);
i got previewer crash (coz ApplicationLifetimeis null in design time )


11:54:15.676 [Error] 13528 <= "Unhandled Exception: System.ArgumentNullException: Value cannot be null."
11:54:15.713 [Error] 13528 <= "Parameter name: ApplicationLifetime is null. Ensure you are initializing AutoSuspendHelper when Avalonia application initialization is completed."
question

All 2 comments

Application lifetime is not guaranteed to be configured since it's platform/application dependent. No lifetime is configured for previewer platform since there there is no application running.

Started working on a fix for this. Adding a Design.IsDesignMode check should be enough hopefully.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MiKaMaru picture MiKaMaru  路  4Comments

akunchev picture akunchev  路  3Comments

khoshroomahdi picture khoshroomahdi  路  4Comments

maxkatz6 picture maxkatz6  路  3Comments

danwalmsley picture danwalmsley  路  4Comments