You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-17 16:00:09 +00:00
com.unity.ide.visualstudio@2.0.17
## [2.0.17] - 2022-12-06 Integration: - Fix rare deadlocks while discovering or launching Visual Studio on Windows. - Improve launching Visual Studio on macOs. Project generation: - Include analyzers from response files. - Update supported C# versions. - Performance improvements.
This commit is contained in:
@@ -11,20 +11,24 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
internal class AsyncOperation<T>
|
||||
{
|
||||
private readonly Func<T> _producer;
|
||||
private readonly Func<Exception, T> _exceptionHandler;
|
||||
private readonly Action _finalHandler;
|
||||
private readonly ManualResetEventSlim _resetEvent;
|
||||
|
||||
private T _result;
|
||||
private Exception _exception;
|
||||
|
||||
private AsyncOperation(Func<T> producer)
|
||||
private AsyncOperation(Func<T> producer, Func<Exception, T> exceptionHandler, Action finalHandler)
|
||||
{
|
||||
_producer = producer;
|
||||
_exceptionHandler = exceptionHandler;
|
||||
_finalHandler = finalHandler;
|
||||
_resetEvent = new ManualResetEventSlim(initialState: false);
|
||||
}
|
||||
|
||||
public static AsyncOperation<T> Run(Func<T> producer)
|
||||
public static AsyncOperation<T> Run(Func<T> producer, Func<Exception, T> exceptionHandler = null, Action finalHandler = null)
|
||||
{
|
||||
var task = new AsyncOperation<T>(producer);
|
||||
var task = new AsyncOperation<T>(producer, exceptionHandler, finalHandler);
|
||||
task.Run();
|
||||
return task;
|
||||
}
|
||||
@@ -40,9 +44,15 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
catch (Exception e)
|
||||
{
|
||||
_exception = e;
|
||||
|
||||
if (_exceptionHandler != null)
|
||||
{
|
||||
_result = _exceptionHandler(e);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_finalHandler?.Invoke();
|
||||
_resetEvent.Set();
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user