macadmins / SupportCompanion

macOS helper application designed to empower end-users
Apache License 2.0
66 stars 3 forks source link

app crashing on identity panel if some realm informations can't be collected #28

Closed hachirotahoshino closed 4 months ago

hachirotahoshino commented 4 months ago

here is crash log:

Unhandled exception. System.Collections.Generic.KeyNotFoundException: Arg_KeyNotFoundWithKey, user_name at System.Collections.Generic.Dictionary2.get_Item(TKey key) at SupportCompanion.ViewModels.MacPasswordViewModel.GetMacPasswordInfo() at SupportCompanion.ViewModels.MacPasswordViewModel.InitializeAsync() at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_0(Object state) at Avalonia.Threading.SendOrPostCallbackDispatcherOperation.InvokeCore() at Avalonia.Threading.DispatcherOperation.Execute() at Avalonia.Threading.Dispatcher.ExecuteJob(DispatcherOperation job) at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean fromExplicitBackgroundProcessingCallback) at Avalonia.Threading.Dispatcher.Signaled() at Avalonia.Native.Interop.Impl.__MicroComIAvnPlatformThreadingInterfaceEventsVTable.Signaled(Void* this) --- End of stack trace from previous location --- at Avalonia.Native.DispatcherImpl.RunLoop(CancellationToken token) at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl) at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame) at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action1 lifetimeBuilder) at SupportCompanion.Program.Main(String[] args)

on my case some info as RealName couldn't be read from realm.

/usr/bin/app-sso -i {RealName}
Error occured, err = 1

almenscorner commented 4 months ago

I'm able to replicate this when keys cannot be retrieved from the dictionary as they do not exist. I will change the behaviour of this try a TryGetValue instead and set a default empty value if the key cannot be found. This way the app won't crash and instead just not display anything.