diff --git a/DNTProfiler.MetaData/SharedAssemblyInfo.cs b/DNTProfiler.MetaData/SharedAssemblyInfo.cs index 14e05b7..ce22f53 100644 --- a/DNTProfiler.MetaData/SharedAssemblyInfo.cs +++ b/DNTProfiler.MetaData/SharedAssemblyInfo.cs @@ -23,7 +23,7 @@ #endif // Assembly Versions are incremented manually when branching the code for a release. -[assembly: AssemblyVersion("1.4.821.0")] +[assembly: AssemblyVersion("1.4.828.0")] // Assembly File Version should be incremented automatically as part of the build process. -[assembly: AssemblyFileVersion("1.4.821.0")] +[assembly: AssemblyFileVersion("1.4.828.0")] diff --git a/DNTProfiler/ViewModels/MainWindowViewModel.cs b/DNTProfiler/ViewModels/MainWindowViewModel.cs index 095c388..95e2b40 100644 --- a/DNTProfiler/ViewModels/MainWindowViewModel.cs +++ b/DNTProfiler/ViewModels/MainWindowViewModel.cs @@ -114,8 +114,11 @@ private void doSearch() void doStart(string data) { - _selfHostConfig.OpenWait(GuiModelData.ServerUri, GuiModelData.AllowRemoteConnections); - _isStated = true; + Task.Factory.StartNew(() => + { + _selfHostConfig.OpenWait(GuiModelData.ServerUri, GuiModelData.AllowRemoteConnections); + _isStated = true; + }); } void doStop(string data) diff --git a/Plugins/DNTProfiler.ApplicationExceptions/ViewModels/MainViewModel.cs b/Plugins/DNTProfiler.ApplicationExceptions/ViewModels/MainViewModel.cs index a4a70c7..2cec7b5 100644 --- a/Plugins/DNTProfiler.ApplicationExceptions/ViewModels/MainViewModel.cs +++ b/Plugins/DNTProfiler.ApplicationExceptions/ViewModels/MainViewModel.cs @@ -1,4 +1,5 @@ using System; +using System.Threading.Tasks; using System.Windows; using System.Windows.Threading; using DNTProfiler.ApplicationExceptions.Core; @@ -29,14 +30,13 @@ public MainViewModel(ProfilerPluginBase pluginContext) private void addException(Exception ex) { - AppExceptionsGuiData.AppExceptionsList.Add(new AppException - { - Message = ex.Message, - Details = ExceptionLogger.GetExceptionCallStack(ex) - }); - DispatcherHelper.DispatchAction(() => { + AppExceptionsGuiData.AppExceptionsList.Add(new AppException + { + Message = ex.Message, + Details = ExceptionLogger.GetExceptionCallStack(ex) + }); PluginContext.NotifyPluginsHost(NotificationType.Update, 1); }); } @@ -80,6 +80,7 @@ private void setEvenets() { AppDomain.CurrentDomain.UnhandledException += currentDomainUnhandledException; Application.Current.DispatcherUnhandledException += appDispatcherUnhandledException; + TaskScheduler.UnobservedTaskException += taskSchedulerUnobservedTaskException; AppMessenger.Messenger.Register("ShowException", exception => addException(exception)); } @@ -98,5 +99,16 @@ private void setGuiModel() new ExceptionLogger().LogExceptionToFile(new NotImplementedException(error), AppMessenger.LogFile); }); } + + void taskSchedulerUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e) + { + e.SetObserved(); + e.Exception.Flatten().Handle(ex => + { + new ExceptionLogger().LogExceptionToFile(ex, AppMessenger.LogFile); + addException(ex); + return true; + }); + } } } \ No newline at end of file diff --git a/Plugins/DNTProfiler.ByMethods/Core/CallbacksManager.cs b/Plugins/DNTProfiler.ByMethods/Core/CallbacksManager.cs index 7b1c7d5..b5d3eb2 100644 --- a/Plugins/DNTProfiler.ByMethods/Core/CallbacksManager.cs +++ b/Plugins/DNTProfiler.ByMethods/Core/CallbacksManager.cs @@ -16,16 +16,21 @@ public CallbacksManager(ProfilerPluginBase pluginContext, GuiModelBase guiModelD { } - public void ManageStackTraces(CallingMethodStackTrace item) + public void ManageStackTraces(Command command) { - if (item.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity)) + var stackTrace = GetStackTrace(command); + if (stackTrace == null) + return; + + stackTrace.ApplicationIdentity = command.ApplicationIdentity; + if (stackTrace.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity)) { - GuiModelData.RelatedStackTraces.Add(item); + GuiModelData.RelatedStackTraces.Add(stackTrace); } - _localCallingMethodStackTraces.Add(item); + _localCallingMethodStackTraces.Add(stackTrace); PluginContext.NotifyPluginsHost(NotificationType.Update, 1); - UpdateAppIdentityNotificationsCount(item.ApplicationIdentity); + UpdateAppIdentityNotificationsCount(stackTrace.ApplicationIdentity); } public void Reset() diff --git a/Plugins/DNTProfiler.ByMethods/ViewModels/MainViewModel.cs b/Plugins/DNTProfiler.ByMethods/ViewModels/MainViewModel.cs index 3310a9e..6b2d7f8 100644 --- a/Plugins/DNTProfiler.ByMethods/ViewModels/MainViewModel.cs +++ b/Plugins/DNTProfiler.ByMethods/ViewModels/MainViewModel.cs @@ -54,15 +54,15 @@ private void setActions() private void setEvenets() { - PluginContext.ProfilerData.StackTraces.CollectionChanged += StackTraces_CollectionChanged; + PluginContext.ProfilerData.Commands.CollectionChanged += Commands_CollectionChanged; } - private void StackTraces_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + private void Commands_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: - foreach (CallingMethodStackTrace item in e.NewItems) + foreach (Command item in e.NewItems) { _callbacksManager.ManageStackTraces(item); } diff --git a/Plugins/DNTProfiler.QueryFromView/Core/CallbacksManager.cs b/Plugins/DNTProfiler.QueryFromView/Core/CallbacksManager.cs index e2dfa24..5928533 100644 --- a/Plugins/DNTProfiler.QueryFromView/Core/CallbacksManager.cs +++ b/Plugins/DNTProfiler.QueryFromView/Core/CallbacksManager.cs @@ -25,21 +25,27 @@ public CallbacksManager(ProfilerPluginBase pluginContext, GuiModelBase guiModelD { } - public void ManageStackTraces(CallingMethodStackTrace item) + public void ManageStackTraces(Command command) { - if (!hasQueryFromView(item)) + var stackTrace = GetStackTrace(command); + if (stackTrace == null) + return; + + stackTrace.ApplicationIdentity = command.ApplicationIdentity; + + if (!hasQueryFromView(stackTrace)) { return; } - if (item.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity)) + if (stackTrace.ApplicationIdentity.Equals(GuiModelData.SelectedApplicationIdentity)) { - GuiModelData.RelatedStackTraces.Add(item); + GuiModelData.RelatedStackTraces.Add(stackTrace); } - _localCallingMethodStackTraces.Add(item); + _localCallingMethodStackTraces.Add(stackTrace); PluginContext.NotifyPluginsHost(NotificationType.Update, 1); - UpdateAppIdentityNotificationsCount(item.ApplicationIdentity); + UpdateAppIdentityNotificationsCount(stackTrace.ApplicationIdentity); } public void Reset() diff --git a/Plugins/DNTProfiler.QueryFromView/ViewModels/MainViewModel.cs b/Plugins/DNTProfiler.QueryFromView/ViewModels/MainViewModel.cs index f970c6b..0c368b5 100644 --- a/Plugins/DNTProfiler.QueryFromView/ViewModels/MainViewModel.cs +++ b/Plugins/DNTProfiler.QueryFromView/ViewModels/MainViewModel.cs @@ -54,15 +54,15 @@ private void setActions() private void setEvenets() { - PluginContext.ProfilerData.StackTraces.CollectionChanged += StackTraces_CollectionChanged; + PluginContext.ProfilerData.Commands.CollectionChanged += Commands_CollectionChanged; } - private void StackTraces_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + private void Commands_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: - foreach (CallingMethodStackTrace item in e.NewItems) + foreach (Command item in e.NewItems) { _callbacksManager.ManageStackTraces(item); }