omermor / asyncbridge Goto Github PK
View Code? Open in Web Editor NEWAdds the new C# 5 async for older .NET 3.5 and .NET 4.0 projects.
Home Page: http://omermor.github.com/AsyncBridge/
License: Other
Adds the new C# 5 async for older .NET 3.5 and .NET 4.0 projects.
Home Page: http://omermor.github.com/AsyncBridge/
License: Other
Make net46 the no-op target, and ship a net45 binary with only AsyncLocal.
Hey guys,
Just wondering what your plans are for async bridge now the targeting pack has been released? Are there any uses for the project now? Or is it simply an open source version of the targeting pack?
Cheers,
Jake
If we have any wishes for field and variable naming conventions, we should put them in an .editorconfig and possibly a DotSettings. This will save time and trouble for contributors.
Other things to add: trimming whitespace, adding an ending line, UTF-8 without byte order mark.
I see that there's a milestone for 0.4.0, but there has not been any activity since 2018. Is there any chance of quickly finishing and releasing 0.4.0? I personally am interested in net20 support, which seems to be slated for 0.4.0 and at least partially implemented in the no_dependencies
branch. I'm happy to assist in any way possible.
Of your 26 total tests, only 3 are being run for your .NET Framework 3.5 build.
MSTest is not finding or running any async Task
test methods. This makes sense since it's probably not using duck typing to run Task tests.
It's straightforward to fix by converting all the tests to (non-async) void.
When I use Semaphore
in async function. It will block thread.
Is any way to implement semaphore.waitAsync();
like SemaphoreSlim
in .net framework 4
I'm hitting a bug where awaiting any ConfigureAwait(false) continues on the UI thread rather than a threadpool thread.
Where .NET Framework has:
[SecurityCritical]
public void UnsafeOnCompleted(Action continuation)
{
TaskAwaiter.OnCompletedInternal(m_task, continuation, m_continueOnCapturedContext, flowExecutionContext:false);
}
Your ConfiguredTaskAwaitable<>.ConfiguredTaskAwaiter
has:
But your OnCompleted
is correct:
Your ConfiguredTaskAwaitable.ConfiguredTaskAwaiter
has the same problem.
Looks like an obvious fix. Would you accept a PR?
Unfortunately for this library, the closest thing to an active maintainer right now is me. When @OmerMor agreed to make me a maintainer, I fixed a significant ConfigureAwait bug (#7), modernized the repo and packaging, and got the fix on NuGet. Then I started fixing the last outstanding bug I discovered (#12) which required replacing an upstream dependency. This turned out to be so much work that I didn't have time to complete it. I don't foresee having a significant amount of time to devote to this project.
If you have energy and interest, I'll do what I can to enable you to help maintain this project. I can publish AsyncBridge NuGet packages. We'll reach out to @OmerMor to ask that they make you a full maintainer. (I don't have access to repo settings yet, so I can't do this part.)
I'll try to respond to issues amid the deluge of my GitHub notifications either way.
Hi,
Please sign Nuget package to easier use...
Thanks
Getting error on unity app in Linux build
I would have uploaded a zip file with the modified source (don't use git anymore) but found no way uploading a file so
here comes a list of the steps to perform in order to make it work in no time.
1; Create a Portable library and add all files from the .NET 4 project as links
1.1; Select .NET framework 4 and Silverlight 5 as target frameworks (Metro apps can also be selected)
2; Add a define "PORTABLE" to the AsyncBridge.Portable project
3; Solve issues with "TargetedPatchingOptOut"
Replace:
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
With:
[TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]
4; Solve issues with ThreadPool.UnsafeQueueUserWorkITem In YieldAwaitable.queueContinuation
Replace:
if (flowContext)
ThreadPool.QueueUserWorkItem(s_waitCallbackRunAction, continuation);
else
ThreadPool.UnsafeQueueUserWorkItem(s_waitCallbackRunAction, continuation);
With:
#if !PORTABLE
if (flowContext)
ThreadPool.QueueUserWorkItem(s_waitCallbackRunAction, continuation);
else
ThreadPool.UnsafeQueueUserWorkItem(s_waitCallbackRunAction, continuation);
#else
ThreadPool.QueueUserWorkItem(s_waitCallbackRunAction, continuation);
#endif
For reference, this demonstrates the bug: https://github.com/jnm2/AsyncBridge/compare/sync_context_flow_bug
This differs from the .NET Framework 4.5 behavior. Example of what can go wrong:
// UI thread
await Task.Run(async () =>
{
// Thread pool thread
DoCPUIntensiveWork();
await DoIOBoundWorkAsync();
// PROBLEM: the await resumes on the UI thread, not a thread pool thread!
DoCPUIntensiveWork(); // Ends up blocking the UI thread
});
The workaround is to await DoIOBoundWorkAsync().ConfigureAwait(false)
. (Once v0.3.0 is out with the fix for #7!) To be clear, ConfigureAwait(false)
is better code, but it should still not be necessary.
Looks like another easy fix. The problem is, the source code for TaskParallelLibrary 1.0.2856 is not on the internet as far as I can tell. The nupkg and binaries are first committed to this repo in f97269a and had been downloaded from https://www.nuget.org/packages/rx-core/1.0.2856. I've scoured https://rx.codeplex.com/ and https://github.com/Reactive-Extensions/Rx.NET and am pretty sure they do not contain the source of System.Threading.dll from TaskParallelLibrary.
At this point it seems likely that creating a fresh net47-net35 or perhaps corefx/net35 shim from scratch in a single DLL would be cleanest.
Can you please put the license of this work somewhere ?
Would have been nice if under release you put the DLL too, so we could just download and reference that DLL, instead of whole project.
Possible?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.