diff --git a/NuGet/AsyncBridge/AsyncBridge.Option.nuspec b/NuGet/AsyncBridge/AsyncBridge.Option.nuspec deleted file mode 100755 index 364b5ff..0000000 --- a/NuGet/AsyncBridge/AsyncBridge.Option.nuspec +++ /dev/null @@ -1,52 +0,0 @@ - - - - AsynchronousBridge.Option - 1.0.0 - AsyncBridge.Option - Tom Jacques - Tom Jacques - https://github.com/tejacques/AsyncBridge/blob/master/LICENSE.txt - https://github.com/tejacques/AsyncBridge/ - https://raw.github.com/tejacques/AsyncBridge/master/icon/AsyncBridge.png - false - - Binaries for the AsyncBridge.Option extension library. - Visit https://github.com/tejacques/AsyncBridge for an overview and usage examples. - - - An open source helper library for that adds helpful syntactic sugar to the AsynchronousBridge project. - - - Version Release Notes: - - Version 1.0.0 - - Adds the following extension method to AsyncBridge - - Run<T>(Task<> task, out Option<T>) - - This allows you to simply provide an out Option parameter, rather than specifying a lambda callback to set a variable, like so: - - Option<int> option; - - using(var A = AsyncHelper.Wait) - { - A.Run(someTaskThatReturns(1), out option); - } - - o == 1; // true - - - Copyright 2013 - Asynchronous Async Await Deadlock Callback Option AsyncBridge AsynchronousBridge - - - - - - - - - - - diff --git a/NuGet/AsyncBridge/AsyncBridge.nuspec b/NuGet/AsyncBridge/AsyncBridge.nuspec deleted file mode 100755 index b8a4651..0000000 --- a/NuGet/AsyncBridge/AsyncBridge.nuspec +++ /dev/null @@ -1,68 +0,0 @@ - - - - AsynchronousBridge - 1.2.2 - AsyncBridge - Tom Jacques - Tom Jacques - https://github.com/tejacques/AsyncBridge/blob/master/LICENSE.txt - https://github.com/tejacques/AsyncBridge/ - https://raw.github.com/tejacques/AsyncBridge/master/icon/AsyncBridge.png - false - - Binaries for the AsyncBridge library. - Visit https://github.com/tejacques/AsyncBridge for an overview and usage examples. - - - An open source helper library for interacting with asynchronous methods from synchronous ones from Windows Forms and ASP.NET applications. - - - Version Release Notes: - - Version 1.2.2 - - Uses ConcurrentQueue instead of a Queue with locks. - - Version 1.2.1 - - Small improvements to error handling - - Version 1.2.0 - - Allow for recursive asynchronicity by passing the current task queue. - - Version 1.1.1: - - Better dependency management - - Version 1.1.0: - - Add support for .NET 4.0 - - Added new method to unwrap task result in callback. - - Bug fixes in error handling. - - Version 1.0.3: - - Include updated documentation and debugging information in package - - Version 1.0.2: - - Fix a race condition by replacing task.ContinueWith with the direct continuation invocation - - Version 1.0.1: - - Include XML Documentation - - Version 1.0.0: - Fully operational basic functionary for - - AsyncBridge.Run(Task) - - AsyncHelper.FireAndForget(Func<Task>, Action<Exception>) - - Copyright 2013 - Asynchronous Async Await Deadlock Callback - - - - - - - - - - - - - diff --git a/NuGet/NuGet.exe b/NuGet/NuGet.exe deleted file mode 100755 index cb3ed03..0000000 Binary files a/NuGet/NuGet.exe and /dev/null differ diff --git a/NuGet/NuGetPack.cmd b/NuGet/NuGetPack.cmd deleted file mode 100644 index a4192ac..0000000 --- a/NuGet/NuGetPack.cmd +++ /dev/null @@ -1,2 +0,0 @@ -nuget pack "AsyncBridge\AsyncBridge.nuspec" -symbols -nuget pack "AsyncBridge\AsyncBridge.Option.nuspec" -symbols diff --git a/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.dll b/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.dll deleted file mode 100755 index 701fe31..0000000 Binary files a/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.dll and /dev/null differ diff --git a/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.dll.config b/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.dll.config deleted file mode 100755 index 9a9c59a..0000000 --- a/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.dll.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.pdb b/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.pdb deleted file mode 100755 index 950a8e1..0000000 Binary files a/lib/AsyncBridge.Option/NET40/AsyncBridge.NET40.Option.pdb and /dev/null differ diff --git a/lib/AsyncBridge.Option/NET45/AsyncBridge.Option.dll b/lib/AsyncBridge.Option/NET45/AsyncBridge.Option.dll deleted file mode 100755 index 3be9a61..0000000 Binary files a/lib/AsyncBridge.Option/NET45/AsyncBridge.Option.dll and /dev/null differ diff --git a/lib/AsyncBridge.Option/NET45/AsyncBridge.Option.pdb b/lib/AsyncBridge.Option/NET45/AsyncBridge.Option.pdb deleted file mode 100755 index 26c385d..0000000 Binary files a/lib/AsyncBridge.Option/NET45/AsyncBridge.Option.pdb and /dev/null differ diff --git a/lib/AsyncBridge/NET40/AsyncBridge.NET40.XML b/lib/AsyncBridge/NET40/AsyncBridge.NET40.XML deleted file mode 100755 index 3d6c3fe..0000000 --- a/lib/AsyncBridge/NET40/AsyncBridge.NET40.XML +++ /dev/null @@ -1,70 +0,0 @@ - - - - AsyncBridge.NET40 - - - - - A Helper class to run Asynchronous functions from synchronous ones - - - - - Runs a task with the "Fire and Forget" pattern using Task.Run, - and unwraps and handles exceptions - - A function that returns the task to run - Error handling action, null by default - - - - Creates a new AsyncBridge. This should always be used in - conjunction with the using statement, to ensure it is disposed - - - - - A class to bridge synchronous asynchronous methods - - - - - Constructs the AsyncBridge by capturing the current - SynchronizationContext and replacing it with a new - ExclusiveSynchronizationContext. - - - - - Execute's an async task with a void return type - from a synchronous context - - Task to execute - Optional callback - - - - Execute's an async task with a T return type - from a synchronous context - - The type of the task - Task to execute - Optional callback - - - - Execute's an async task with a T return type - from a synchronous context - - The type of the task - Task to execute - The callback function that uses the result of the task - - - - Disposes the object - - - - diff --git a/lib/AsyncBridge/NET40/AsyncBridge.NET40.dll b/lib/AsyncBridge/NET40/AsyncBridge.NET40.dll deleted file mode 100755 index 6029534..0000000 Binary files a/lib/AsyncBridge/NET40/AsyncBridge.NET40.dll and /dev/null differ diff --git a/lib/AsyncBridge/NET40/AsyncBridge.NET40.dll.config b/lib/AsyncBridge/NET40/AsyncBridge.NET40.dll.config deleted file mode 100755 index 9a9c59a..0000000 --- a/lib/AsyncBridge/NET40/AsyncBridge.NET40.dll.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/lib/AsyncBridge/NET40/AsyncBridge.NET40.pdb b/lib/AsyncBridge/NET40/AsyncBridge.NET40.pdb deleted file mode 100755 index dc0b8d7..0000000 Binary files a/lib/AsyncBridge/NET40/AsyncBridge.NET40.pdb and /dev/null differ diff --git a/lib/AsyncBridge/NET45/AsyncBridge.XML b/lib/AsyncBridge/NET45/AsyncBridge.XML deleted file mode 100755 index f813129..0000000 --- a/lib/AsyncBridge/NET45/AsyncBridge.XML +++ /dev/null @@ -1,70 +0,0 @@ - - - - AsyncBridge - - - - - A Helper class to run Asynchronous functions from synchronous ones - - - - - Runs a task with the "Fire and Forget" pattern using Task.Run, - and unwraps and handles exceptions - - A function that returns the task to run - Error handling action, null by default - - - - Creates a new AsyncBridge. This should always be used in - conjunction with the using statement, to ensure it is disposed - - - - - A class to bridge synchronous asynchronous methods - - - - - Constructs the AsyncBridge by capturing the current - SynchronizationContext and replacing it with a new - ExclusiveSynchronizationContext. - - - - - Execute's an async task with a void return type - from a synchronous context - - Task to execute - Optional callback - - - - Execute's an async task with a T return type - from a synchronous context - - The type of the task - Task to execute - Optional callback - - - - Execute's an async task with a T return type - from a synchronous context - - The type of the task - Task to execute - The callback function that uses the result of the task - - - - Disposes the object - - - - diff --git a/lib/AsyncBridge/NET45/AsyncBridge.dll b/lib/AsyncBridge/NET45/AsyncBridge.dll deleted file mode 100755 index 6ef9563..0000000 Binary files a/lib/AsyncBridge/NET45/AsyncBridge.dll and /dev/null differ diff --git a/lib/AsyncBridge/NET45/AsyncBridge.pdb b/lib/AsyncBridge/NET45/AsyncBridge.pdb deleted file mode 100755 index 433a51e..0000000 Binary files a/lib/AsyncBridge/NET45/AsyncBridge.pdb and /dev/null differ diff --git a/src/AsyncBridge.NET40.Option/AsyncBridge.NET40.Option.csproj b/src/AsyncBridge.NET40.Option/AsyncBridge.NET40.Option.csproj deleted file mode 100755 index 3f8346b..0000000 --- a/src/AsyncBridge.NET40.Option/AsyncBridge.NET40.Option.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - - Debug - AnyCPU - {85903BFE-F528-4CB9-B911-67C26FF94C9E} - Library - Properties - AsyncBridge.NET40.Option - AsyncBridge.NET40.Option - v4.0 - 512 - - ..\AsyncBridge\ - true - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET_40 - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;NET_40 - prompt - 4 - - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll - - - ..\AsyncBridge\packages\Option.2.0.1\lib\Net35\Option.dll - - - - - - ..\AsyncBridge\packages\Microsoft.Bcl.1.0.19\lib\net40\System.Runtime.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.1.0.19\lib\net40\System.Threading.Tasks.dll - - - - - - - - - - AsyncBridgeOptionExtensions.cs - - - - - - - - - {cc87d850-5d18-409d-b419-eaafe9870bf5} - AsyncBridge.NET40 - - - - - - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge.NET40.Option/Properties/AssemblyInfo.cs b/src/AsyncBridge.NET40.Option/Properties/AssemblyInfo.cs deleted file mode 100755 index cbe6eda..0000000 --- a/src/AsyncBridge.NET40.Option/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AsyncBridge.NET40.Option")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AsyncBridge.NET40.Option")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c9c0ad76-fa69-45fa-9a31-0c0f2dddb79c")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/AsyncBridge.NET40.Option/packages.config b/src/AsyncBridge.NET40.Option/packages.config deleted file mode 100755 index 740a145..0000000 --- a/src/AsyncBridge.NET40.Option/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge.NET40.Tests/AsyncBridge.NET40.Tests.csproj b/src/AsyncBridge.NET40.Tests/AsyncBridge.NET40.Tests.csproj deleted file mode 100755 index ff09b07..0000000 --- a/src/AsyncBridge.NET40.Tests/AsyncBridge.NET40.Tests.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Debug - AnyCPU - {39CF24EC-9399-4CD4-A1CF-61C10926A12C} - Library - Properties - AsyncBridge.NET40.Tests - AsyncBridge.NET40.Tests - v4.0 - 512 - Client - ..\AsyncBridge\ - true - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET_40 - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;NET_40 - prompt - 4 - - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll - - - ..\AsyncBridge\packages\NUnit.2.6.2\lib\nunit.framework.dll - - - False - ..\AsyncBridge\packages\Option.2.0.1\lib\Net35\Option.dll - - - - - - ..\AsyncBridge\packages\Microsoft.Bcl.1.0.19\lib\net40\System.Runtime.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.1.0.19\lib\net40\System.Threading.Tasks.dll - - - - - - - - - - AsyncBridgeTests.cs - - - - - - - - - {85903bfe-f528-4cb9-b911-67c26ff94c9e} - AsyncBridge.NET40.Option - - - {cc87d850-5d18-409d-b419-eaafe9870bf5} - AsyncBridge.NET40 - - - - - - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge.NET40.Tests/Properties/AssemblyInfo.cs b/src/AsyncBridge.NET40.Tests/Properties/AssemblyInfo.cs deleted file mode 100755 index 2ca3cdf..0000000 --- a/src/AsyncBridge.NET40.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AsyncBridge.NET40.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AsyncBridge.NET40.Tests")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("d62112ff-46c4-464b-86ff-5ab356b0d9fb")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/AsyncBridge.NET40.Tests/packages.config b/src/AsyncBridge.NET40.Tests/packages.config deleted file mode 100755 index 07dd87d..0000000 --- a/src/AsyncBridge.NET40.Tests/packages.config +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge.NET40/AsyncBridge.NET40.csproj b/src/AsyncBridge.NET40/AsyncBridge.NET40.csproj deleted file mode 100755 index 19cf455..0000000 --- a/src/AsyncBridge.NET40/AsyncBridge.NET40.csproj +++ /dev/null @@ -1,84 +0,0 @@ - - - - - Debug - AnyCPU - {CC87D850-5D18-409D-B419-EAAFE9870BF5} - Library - Properties - AsyncBridge.NET40 - AsyncBridge.NET40 - v4.0 - 512 - - ..\AsyncBridge\ - true - - - true - full - false - bin\Debug\ - TRACE;DEBUG;NET_40 - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE;NET_40 - prompt - 4 - bin\Release\AsyncBridge.NET40.XML - - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.Async.1.0.16\lib\net40\Microsoft.Threading.Tasks.Extensions.Desktop.dll - - - - - - ..\AsyncBridge\packages\Microsoft.Bcl.1.0.19\lib\net40\System.Runtime.dll - - - ..\AsyncBridge\packages\Microsoft.Bcl.1.0.19\lib\net40\System.Threading.Tasks.dll - - - - - - - - - - AsyncHelper.cs - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge.NET40/Properties/AssemblyInfo.cs b/src/AsyncBridge.NET40/Properties/AssemblyInfo.cs deleted file mode 100755 index c01a5f8..0000000 --- a/src/AsyncBridge.NET40/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AsyncBridge.NET40")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AsyncBridge.NET40")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c4d29d86-401c-42ee-a906-227c8012d3bc")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/AsyncBridge.NET40/packages.config b/src/AsyncBridge.NET40/packages.config deleted file mode 100755 index 9aeab26..0000000 --- a/src/AsyncBridge.NET40/packages.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge.Option/AsyncBridge.Option.csproj b/src/AsyncBridge.Option/AsyncBridge.Option.csproj index 0a36c16..d7f675b 100755 --- a/src/AsyncBridge.Option/AsyncBridge.Option.csproj +++ b/src/AsyncBridge.Option/AsyncBridge.Option.csproj @@ -1,71 +1,60 @@ - - - + + - Debug - AnyCPU - {B1BE567A-6AFC-4965-90B8-444E1E3F46E7} - Library - Properties - AsyncBridge.Option - AsyncBridge.Option - v4.5 - 512 - - ..\AsyncBridge\ - true + net45;netstandard1.1;netstandard2.0; + netstandard1.1;netstandard2.0; + true + Version Release Notes: + + Version 2.0.0 + - Now target .NET Standard 1.1. + + Version 1.0.0 + - Adds the following extension method to AsyncBridge + + Run&lt;T&gt;(Task&lt;&gt; task, out Option&lt;T&gt;) + + This allows you to simply provide an out Option parameter, rather than specifying a lambda callback to set a variable, like so: + + Option&lt;int&gt; option; + + using(var A = AsyncHelper.Wait) + { + A.Run(someTaskThatReturns(1), out option); + } + + o == 1; // true + 2.0.0 + Tom Jacques + AsynchronousBridge.Option + AsynchronousBridge.Option + An open source helper library for that adds helpful syntactic sugar to the AsynchronousBridge project. + +Binaries for the AsyncBridge.Option extension library. + Visit https://github.com/tejacques/AsyncBridge for an overview and usage examples. + Copyright 2018 + https://github.com/tejacques/AsyncBridge/blob/master/LICENSE.txt + https://github.com/tejacques/AsyncBridge/ + https://raw.github.com/tejacques/AsyncBridge/master/icon/AsyncBridge.png + Asynchronous Async Await Deadlock Callback Option AsyncBridge AsynchronousBridge - - true - full - false + + + bin\Debug\AsyncBridge.Option.xml bin\Debug\ - TRACE;DEBUG;NET_45 - prompt - 4 - false - - pdbonly - true + + bin\Release\ - TRACE;NET_45 - prompt - 4 - false + bin\Release\AsyncBridge.Option.xml + - - ..\AsyncBridge\packages\Option.2.0.1\lib\Net35\Option.dll - - - - - - - - + + - - + - - - {19595376-6fd8-4839-9580-9fd7835502b0} - AsyncBridge - - - - - - - - - \ No newline at end of file + + diff --git a/src/AsyncBridge.Option/AsyncBridgeOptionExtensions.cs b/src/AsyncBridge.Option/AsyncBridgeOptionExtensions.cs index 6316417..f5ac786 100755 --- a/src/AsyncBridge.Option/AsyncBridgeOptionExtensions.cs +++ b/src/AsyncBridge.Option/AsyncBridgeOptionExtensions.cs @@ -1,20 +1,39 @@ -using System; -using System.Collections.Generic; +using Functional.Option; using System.Linq; -using System.Option; -using System.Text; +using System.Reflection; using System.Threading.Tasks; namespace AsyncBridge { + /// + /// Async Bridge Option Extensions + /// public static class AsyncBridgeOptionExtensions { + /// + /// Run + /// + /// + /// + /// + /// public static void Run( this AsyncHelper.AsyncBridge A, Task task, out Option option) { var _option = Option.Some(default(T)); option = _option; - A.Run(task, (result) => _option.Value = result); + A.Run(task, (result) => SetOptionValue(_option, result)); + } + + /// + /// Set Option Value + /// + /// + /// + /// + private static void SetOptionValue(Option option, T value) + { + typeof(Option).GetTypeInfo().DeclaredFields.First(x => x.Name == "_value").SetValue(option, value); } } } diff --git a/src/AsyncBridge.Option/Properties/AssemblyInfo.cs b/src/AsyncBridge.Option/Properties/AssemblyInfo.cs deleted file mode 100755 index 1303dbc..0000000 --- a/src/AsyncBridge.Option/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AsyncBridge.Option")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("AsyncBridge.Option")] -[assembly: AssemblyCopyright("Copyright © 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("dfe5582f-ea7d-495d-9b92-a33ca0b85476")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/src/AsyncBridge.Option/packages.config b/src/AsyncBridge.Option/packages.config deleted file mode 100755 index e87e502..0000000 --- a/src/AsyncBridge.Option/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/AsyncBridge.Tests/AsyncBridge.Tests.csproj b/src/AsyncBridge.Tests/AsyncBridge.Tests.csproj index d524ed5..abdae9e 100755 --- a/src/AsyncBridge.Tests/AsyncBridge.Tests.csproj +++ b/src/AsyncBridge.Tests/AsyncBridge.Tests.csproj @@ -38,12 +38,18 @@ ..\AsyncBridge\packages\NUnit.2.6.2\lib\nunit.framework.dll - - False - ..\AsyncBridge\packages\Option.2.0.1\lib\Net35\Option.dll + + ..\AsyncBridge\packages\Option.3.0.2\lib\netstandard1.0\Option.dll + + + + + + ..\AsyncBridge\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + @@ -59,11 +65,11 @@ - {b1be567a-6afc-4965-90b8-444e1e3f46e7} + {273b576a-7168-4735-a3a4-bd248e2f02de} AsyncBridge.Option - {19595376-6fd8-4839-9580-9fd7835502b0} + {ae854a99-9d89-447c-8bff-84623041d030} AsyncBridge diff --git a/src/AsyncBridge.Tests/AsyncBridgeTests.cs b/src/AsyncBridge.Tests/AsyncBridgeTests.cs index 784fd98..5515b34 100755 --- a/src/AsyncBridge.Tests/AsyncBridgeTests.cs +++ b/src/AsyncBridge.Tests/AsyncBridgeTests.cs @@ -1,26 +1,18 @@ using AsyncBridge; +using Functional.Option; using NUnit.Framework; using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using System.Option; using System.Text; using System.Threading; using System.Threading.Tasks; -#if NET_45 namespace AsyncBridge.Tests -#elif NET_40 -namespace AsyncBridge.NET40.Tests -#endif { [TestFixture] -#if NET_45 public class AsyncBridgeTests -#elif NET_40 - public class AsyncBridgeNET40Tests -#endif { [TestFixtureSetUp] public void SetUp() @@ -29,11 +21,7 @@ public void SetUp() public async Task AsyncString(string s) { -#if NET_45 await Task.Yield(); -#elif NET_40 - await TaskEx.Yield(); -#endif return s; } @@ -54,11 +42,7 @@ public void TestResult() public async Task AsyncStringOption(string s) { -#if NET_45 await Task.Yield(); -#elif NET_40 - await TaskEx.Yield(); -#endif return s; } @@ -79,11 +63,7 @@ public void TestResultOption() public async Task AsyncStringDelay(string s, int ms) { -#if NET_45 await Task.Delay(ms); -#elif NET_40 - await TaskEx.Delay(ms); -#endif return s; } @@ -120,22 +100,14 @@ public void TestTime() public async Task AsyncStringException() { -#if NET_45 await Task.Yield(); -#elif NET_40 - await TaskEx.Yield(); -#endif throw new Exception("Test Exception."); } public async Task AsyncStringException(int msdelay) { -#if NET_45 await Task.Delay(msdelay); -#elif NET_40 - await TaskEx.Delay(msdelay); -#endif throw new Exception("Test Exception."); } @@ -171,11 +143,7 @@ public void TestException() private async Task FAFExample(int ms) { -#if NET_45 await Task.Delay(ms); -#elif NET_40 - await TaskEx.Delay(ms); -#endif throw new Exception("Test exception"); } @@ -191,7 +159,7 @@ public void TestFAF() s.Start(); AsyncHelper.FireAndForget( () => FAFExample(delay), - e => + e => { exceptionThrown = true; waitHandle.Set(); @@ -239,11 +207,8 @@ public void TestMulti() private async Task MultiHelperAsync(string expected, int delay) { -#if NET_45 await Task.Yield(); -#elif NET_40 - await TaskEx.Yield(); -#endif + MultiHelper(expected, delay); } @@ -291,11 +256,8 @@ public void TestMultiException() private async Task MultiHelperExceptionAsync() { -#if NET_45 await Task.Yield(); -#elif NET_40 - await TaskEx.Yield(); -#endif + MultiHelperException(); } diff --git a/src/AsyncBridge.Tests/packages.config b/src/AsyncBridge.Tests/packages.config index 09d60fd..a7b9365 100755 --- a/src/AsyncBridge.Tests/packages.config +++ b/src/AsyncBridge.Tests/packages.config @@ -1,5 +1,36 @@  + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/AsyncBridge/.nuget/NuGet.Config b/src/AsyncBridge/.nuget/NuGet.Config deleted file mode 100755 index 6a318ad..0000000 --- a/src/AsyncBridge/.nuget/NuGet.Config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge/.nuget/NuGet.exe b/src/AsyncBridge/.nuget/NuGet.exe deleted file mode 100755 index 2c93698..0000000 Binary files a/src/AsyncBridge/.nuget/NuGet.exe and /dev/null differ diff --git a/src/AsyncBridge/.nuget/NuGet.targets b/src/AsyncBridge/.nuget/NuGet.targets deleted file mode 100755 index d0ebc75..0000000 --- a/src/AsyncBridge/.nuget/NuGet.targets +++ /dev/null @@ -1,136 +0,0 @@ - - - - $(MSBuildProjectDirectory)\..\ - - - false - - - false - - - true - - - false - - - - - - - - - - - $([System.IO.Path]::Combine($(SolutionDir), ".nuget")) - $([System.IO.Path]::Combine($(ProjectDir), "packages.config")) - - - - - $(SolutionDir).nuget - packages.config - - - - - $(NuGetToolsPath)\NuGet.exe - @(PackageSource) - - "$(NuGetExePath)" - mono --runtime=v4.0.30319 $(NuGetExePath) - - $(TargetDir.Trim('\\')) - - -RequireConsent - -NonInteractive - - "$(SolutionDir) " - "$(SolutionDir)" - - - $(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(NonInteractiveSwitch) $(RequireConsentSwitch) -solutionDir $(PaddedSolutionDir) - $(NuGetCommand) pack "$(ProjectPath)" -Properties "Configuration=$(Configuration);Platform=$(Platform)" $(NonInteractiveSwitch) -OutputDirectory "$(PackageOutputDir)" -symbols - - - - RestorePackages; - $(BuildDependsOn); - - - - - $(BuildDependsOn); - BuildPackage; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/AsyncBridge/AsyncBridge.csproj b/src/AsyncBridge/AsyncBridge.csproj index db80fce..aeb06ae 100755 --- a/src/AsyncBridge/AsyncBridge.csproj +++ b/src/AsyncBridge/AsyncBridge.csproj @@ -1,62 +1,75 @@ - - - + + - Debug - AnyCPU - {19595376-6FD8-4839-9580-9FD7835502B0} - Library - Properties - AsyncBridge - AsyncBridge - v4.5 - 512 - - .\ - true + net45;netstandard1.1;netstandard2.0; + netstandard1.1;netstandard2.0; + AsynchronousBridge + 2.0.0 + Tom Jacques + Tom Jacques + AsynchronousBridge + An open source helper library for interacting with asynchronous methods from synchronous ones from Windows Forms and ASP.NET applications. + +Binaries for the AsyncBridge library. + Visit https://github.com/tejacques/AsyncBridge for an overview and usage examples. + Copyright 2018 + Version Release Notes: + + Version 2.0.0 + - Now target .NET Standard 1.1. + - Removed support of .NET 4.0. + + Version 1.2.2 + - Uses ConcurrentQueue instead of a Queue with locks. + + Version 1.2.1 + - Small improvements to error handling + + Version 1.2.0 + - Allow for recursive asynchronicity by passing the current task queue. + + Version 1.1.1: + - Better dependency management + + Version 1.1.0: + - Add support for .NET 4.0 + - Added new method to unwrap task result in callback. + - Bug fixes in error handling. + + Version 1.0.3: + - Include updated documentation and debugging information in package + + Version 1.0.2: + - Fix a race condition by replacing task.ContinueWith with the direct continuation invocation + + Version 1.0.1: + - Include XML Documentation + + Version 1.0.0: + Fully operational basic functionary for + - AsyncBridge.Run(Task) + - AsyncHelper.FireAndForget(Func&lt;Task&gt;, Action&lt;Exception&gt;) + https://github.com/tejacques/AsyncBridge/blob/master/LICENSE.txt + https://github.com/tejacques/AsyncBridge/ + https://raw.github.com/tejacques/AsyncBridge/master/icon/AsyncBridge.png + true + Asynchronous Async Await Deadlock Callback - - true - full - false + + + bin\Debug\AsyncBridge.xml bin\Debug\ - TRACE;DEBUG;NET_45 - prompt - 4 - false - false - - pdbonly - true + + bin\Release\ - TRACE;NET_45 - prompt - 4 - false - bin\Release\AsyncBridge.XML - false + bin\Release\AsyncBridge.xml + - - - - - - - + + + - - - - - - - - \ No newline at end of file + + diff --git a/src/AsyncBridge/AsyncBridge.sln b/src/AsyncBridge/AsyncBridge.sln index 1697f62..2427321 100755 --- a/src/AsyncBridge/AsyncBridge.sln +++ b/src/AsyncBridge/AsyncBridge.sln @@ -1,24 +1,13 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2012 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncBridge", "AsyncBridge.csproj", "{19595376-6FD8-4839-9580-9FD7835502B0}" -EndProject +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.136 +MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncBridge.Tests", "..\AsyncBridge.Tests\AsyncBridge.Tests.csproj", "{301C2ADE-0C41-4448-AF17-62422CAA905C}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncBridge.NET40", "..\AsyncBridge.NET40\AsyncBridge.NET40.csproj", "{CC87D850-5D18-409D-B419-EAAFE9870BF5}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncBridge.NET40.Tests", "..\AsyncBridge.NET40.Tests\AsyncBridge.NET40.Tests.csproj", "{39CF24EC-9399-4CD4-A1CF-61C10926A12C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{74F132B9-1BF6-4B27-BE40-A1DB40F83ACD}" - ProjectSection(SolutionItems) = preProject - .nuget\NuGet.Config = .nuget\NuGet.Config - .nuget\NuGet.exe = .nuget\NuGet.exe - .nuget\NuGet.targets = .nuget\NuGet.targets - EndProjectSection +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncBridge.Option", "..\AsyncBridge.Option\AsyncBridge.Option.csproj", "{273B576A-7168-4735-A3A4-BD248E2F02DE}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncBridge.Option", "..\AsyncBridge.Option\AsyncBridge.Option.csproj", "{B1BE567A-6AFC-4965-90B8-444E1E3F46E7}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AsyncBridge.NET40.Option", "..\AsyncBridge.NET40.Option\AsyncBridge.NET40.Option.csproj", "{85903BFE-F528-4CB9-B911-67C26FF94C9E}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsyncBridge", "AsyncBridge.csproj", "{AE854A99-9D89-447C-8BFF-84623041D030}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -26,32 +15,23 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {19595376-6FD8-4839-9580-9FD7835502B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {19595376-6FD8-4839-9580-9FD7835502B0}.Debug|Any CPU.Build.0 = Debug|Any CPU - {19595376-6FD8-4839-9580-9FD7835502B0}.Release|Any CPU.ActiveCfg = Release|Any CPU - {19595376-6FD8-4839-9580-9FD7835502B0}.Release|Any CPU.Build.0 = Release|Any CPU {301C2ADE-0C41-4448-AF17-62422CAA905C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {301C2ADE-0C41-4448-AF17-62422CAA905C}.Debug|Any CPU.Build.0 = Debug|Any CPU {301C2ADE-0C41-4448-AF17-62422CAA905C}.Release|Any CPU.ActiveCfg = Release|Any CPU {301C2ADE-0C41-4448-AF17-62422CAA905C}.Release|Any CPU.Build.0 = Release|Any CPU - {CC87D850-5D18-409D-B419-EAAFE9870BF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CC87D850-5D18-409D-B419-EAAFE9870BF5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CC87D850-5D18-409D-B419-EAAFE9870BF5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CC87D850-5D18-409D-B419-EAAFE9870BF5}.Release|Any CPU.Build.0 = Release|Any CPU - {39CF24EC-9399-4CD4-A1CF-61C10926A12C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {39CF24EC-9399-4CD4-A1CF-61C10926A12C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {39CF24EC-9399-4CD4-A1CF-61C10926A12C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {39CF24EC-9399-4CD4-A1CF-61C10926A12C}.Release|Any CPU.Build.0 = Release|Any CPU - {B1BE567A-6AFC-4965-90B8-444E1E3F46E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B1BE567A-6AFC-4965-90B8-444E1E3F46E7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B1BE567A-6AFC-4965-90B8-444E1E3F46E7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B1BE567A-6AFC-4965-90B8-444E1E3F46E7}.Release|Any CPU.Build.0 = Release|Any CPU - {85903BFE-F528-4CB9-B911-67C26FF94C9E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {85903BFE-F528-4CB9-B911-67C26FF94C9E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {85903BFE-F528-4CB9-B911-67C26FF94C9E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {85903BFE-F528-4CB9-B911-67C26FF94C9E}.Release|Any CPU.Build.0 = Release|Any CPU + {273B576A-7168-4735-A3A4-BD248E2F02DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {273B576A-7168-4735-A3A4-BD248E2F02DE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {273B576A-7168-4735-A3A4-BD248E2F02DE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {273B576A-7168-4735-A3A4-BD248E2F02DE}.Release|Any CPU.Build.0 = Release|Any CPU + {AE854A99-9D89-447C-8BFF-84623041D030}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AE854A99-9D89-447C-8BFF-84623041D030}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AE854A99-9D89-447C-8BFF-84623041D030}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AE854A99-9D89-447C-8BFF-84623041D030}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7B6E3B67-804E-413D-98CD-6472F5D322CC} + EndGlobalSection EndGlobal diff --git a/src/AsyncBridge/AsyncHelper.cs b/src/AsyncBridge/AsyncHelper.cs index d87ee75..9a10b91 100755 --- a/src/AsyncBridge/AsyncHelper.cs +++ b/src/AsyncBridge/AsyncHelper.cs @@ -1,14 +1,12 @@ using System; using System.Collections.Concurrent; -using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; namespace AsyncBridge { - using EventTask = Tuple; using EventQueue = ConcurrentQueue>; + using EventTask = Tuple; /// /// A Helper class to run Asynchronous functions from synchronous ones @@ -32,7 +30,7 @@ public class AsyncBridge : IDisposable internal AsyncBridge() { OldContext = SynchronizationContext.Current; - CurrentContext = + CurrentContext = new ExclusiveSynchronizationContext(OldContext); SynchronizationContext .SetSynchronizationContext(CurrentContext); @@ -157,11 +155,7 @@ public static void FireAndForget( Func task, Action handle = null) { -#if NET_45 Task.Run( -#elif NET_40 - TaskEx.Run( -#endif () => { ((Func)(async () => diff --git a/src/AsyncBridge/Properties/AssemblyInfo.cs b/src/AsyncBridge/Properties/AssemblyInfo.cs deleted file mode 100755 index b6a5b37..0000000 --- a/src/AsyncBridge/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("AsyncBridge")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("AsyncBridge")] -[assembly: AssemblyCopyright("Copyright © Microsoft 2013")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("8c50ed5d-a138-4f5c-8e1d-713daff81e5e")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")]