diff --git a/CefSharp.Core/Cef.h b/CefSharp.Core/Cef.h index cf77781b6..1e60cb8fe 100644 --- a/CefSharp.Core/Cef.h +++ b/CefSharp.Core/Cef.h @@ -388,11 +388,6 @@ namespace CefSharp /// /// Async returns a list containing Plugin Information /// (Wrapper around CefVisitWebPluginInfo) - /// The Task will be cancelled and a TaskCanceledException throw - /// if the Task does not complete within 2000ms - /// Documentation for CefWebPluginInfoVisitor.Visit states - /// `This method may never be called if no plugins are found.` - /// hence the Task cancelled timeout /// /// Returns List of structs. static Task^>^ GetPlugins() diff --git a/CefSharp.Core/Internals/PluginVisitor.h b/CefSharp.Core/Internals/PluginVisitor.h index f9875a505..a768cca82 100644 --- a/CefSharp.Core/Internals/PluginVisitor.h +++ b/CefSharp.Core/Internals/PluginVisitor.h @@ -22,13 +22,16 @@ namespace CefSharp { _list = gcnew List(); _taskCompletionSource = gcnew TaskCompletionSource^>(); - - //NOTE: Use fully qualified name as TaskExtensions is ambiguious - CefSharp::Internals::TaskExtensions::WithTimeout^>(_taskCompletionSource, TimeSpan::FromMilliseconds(2000)); } ~PluginVisitor() { + //In this case Visit was likely never called, so we set result to complete the task + if (_list->Count == 0) + { + _taskCompletionSource->SetResult(_list); + } + _list = nullptr; _taskCompletionSource = nullptr; } diff --git a/CefSharp.Example/CefExample.cs b/CefSharp.Example/CefExample.cs index 9c1c013d4..fe4fc739e 100644 --- a/CefSharp.Example/CefExample.cs +++ b/CefSharp.Example/CefExample.cs @@ -196,10 +196,19 @@ namespace CefSharp.Example pluginBody.Append("Path"); pluginBody.Append(""); - try - { - var plugins = await Cef.GetPlugins(); + var plugins = await Cef.GetPlugins(); + if(plugins.Count == 0) + { + pluginBody.Append(""); + pluginBody.Append("Cef.GetPlugins returned an empty list - likely no plugins were loaded on your system"); + pluginBody.Append(""); + pluginBody.Append(""); + pluginBody.Append("You may find that NPAPI/PPAPI need to be enabled"); + pluginBody.Append(""); + } + else + { foreach (var plugin in plugins) { pluginBody.Append(""); @@ -210,15 +219,6 @@ namespace CefSharp.Example pluginBody.Append(""); } } - catch (TaskCanceledException ex) - { - pluginBody.Append(""); - pluginBody.Append("Cef.GetPlugins Timed out - likely no plugins were loaded on your system"); - pluginBody.Append(""); - pluginBody.Append(""); - pluginBody.Append("You may find that NPAPI/PPAPI need to be enabled"); - pluginBody.Append(""); - } pluginBody.Append("");