I have an async method inside a portable class library with this signature:
Private async Tasks & LT; T & gt; _Fetch & lt; T & gt; (Uri Uri) This is a resource which is inserted as a solid type T.
I am working with a 3rd party cache library () for which Func & lt; as one of the parameters. T & gt; and have tried to do this like this: is waiting for this. CacheProvider.GetOrCreateObject & lt; T & gt; (Key, Async () => Wait & gt; T & gt; (Yuri), Cache XPri); Result in this error:
Type ' System.Func & lt; T & gt; Async lambda expression can not be changed to represent '. An async lambda expression zero , work or work & lt; T & gt; , of which none of the ' System.Func & lt; T & gt; '. I have Func & lt; T & gt; Has tried different versions of assignments, only one way I can get the code to work Func & lt; T & gt; Interception: Waiting for this. CacheProvider.GetOrCreateObject & lt; T & gt; (Key, () => _Fetch & lt; T & gt; (Yuri). Result, cache expiry); That's deadlock my app.
Any sign where I am wandering?
can not be used when someone calls funk & lt; T & gt; F You can assume that it will be applied with something like result = F () - it does not know about ASCIC behavior if you use it by using Cheat. As the result you have - this will be a deadlock on the UI thread because it wants to schedule the code on the UI thread wait (_Fetch), but you already have the . With it has blocked it. Result . Async Lambda can be passed on to Action because it has no return value - or function & lt; Work & gt; or function & lt; Work & lt; T & gt; & Gt; . Seeing your case, Calling GetOrCreateObject appears to be GetOrFetchObject . One of the GetOrFetchObject overload Func & lt; Work & lt; T & gt; & Gt; accepts. You can try calling that method with your Async Lambda and see what it helps.
No comments:
Post a Comment