Compare commits

...

6 Commits

Author SHA1 Message Date
neuecc
0bb44066c0 2.0.25 2020-07-09 22:39:48 +09:00
neuecc
305c4aaa07 fix UnityWebRequestException String access is not supported #110 2020-07-09 22:17:49 +09:00
neuecc
42d627f3ba fix again #108 2020-07-09 17:29:04 +09:00
neuecc
6dd2b464a3 NRE on head request with invalid url #108 2020-07-09 01:31:27 +09:00
neuecc
32f24cf8f8 cleanup unused code 2020-07-04 22:08:48 +09:00
neuecc
4a89e3ea86 r 2020-07-04 06:44:57 +09:00
5 changed files with 20 additions and 41 deletions

View File

@@ -536,7 +536,7 @@ How to create async iterator, C# 8.0 supports async iterator(`async yield return
```csharp
// IAsyncEnumerable, C# 8.0 version of async iterator. ( do not use this style, IAsyncEnumerable is not controled in UniTask).
public async IAsyncEnumerable<int> MyEveryUpdate([EnumeratorCancellation]CancellationToken cancelationToken)
public async IAsyncEnumerable<int> MyEveryUpdate([EnumeratorCancellation]CancellationToken cancelationToken = default)
{
var frameCount = 0;
await UniTask.Yield();

View File

@@ -120,24 +120,6 @@ namespace Cysharp.Threading.Tasks.Linq
completionSource.TrySetResult(false);
}
public bool TrySetCanceled(CancellationToken cancellationToken)
{
state = -2;
return completionSource.TrySetCanceled(cancellationToken);
}
public bool TrySetComplete()
{
state = -2;
return completionSource.TrySetResult(false);
}
public bool TrySetException(Exception error)
{
state = -2;
return completionSource.TrySetException(error);
}
public void SetResult(T value)
{
Current = value;

View File

@@ -31,7 +31,13 @@ namespace Cysharp.Threading.Tasks
#endif
this.Error = unityWebRequest.error;
this.ResponseCode = unityWebRequest.responseCode;
this.Text = unityWebRequest.downloadHandler.text;
if (UnityWebRequest.downloadHandler != null)
{
if (unityWebRequest.downloadHandler is DownloadHandlerBuffer dhb)
{
this.Text = dhb.text;
}
}
}
public override string Message
@@ -40,7 +46,14 @@ namespace Cysharp.Threading.Tasks
{
if (msg == null)
{
msg = Error + Environment.NewLine + Text;
if (Text != null)
{
msg = Error + Environment.NewLine + Text;
}
else
{
msg = Error;
}
}
return msg;
}

View File

@@ -1,7 +1,7 @@
{
"name": "com.cysharp.unitask",
"displayName": "UniTask",
"version": "2.0.24",
"version": "2.0.25",
"unity": "2018.4",
"description": "Provides an efficient async/await integration to Unity.",
"keywords": [ "async/await", "async", "Task", "UniTask" ],

View File

@@ -476,25 +476,9 @@ public class SandboxMain : MonoBehaviour
async UniTaskVoid Start()
{
var cts = new CancellationTokenSource();
okButton.onClick.AddListener(() =>
{
cts.Cancel();
});
//// Nanika();
//await UniTask.Yield();
await MyEveryUpdate().Select(x => x).Where(x => x % 2 == 0).ForEachAsync(x =>
{
UnityEngine.Debug.Log(x + ":" + Time.frameCount);
}, cts.Token);
// this.GetCancellationTokenOnDestroy()
var url = "http://google.com/404";
var webRequestAsyncOperation = UnityWebRequest.Get(url).SendWebRequest();
await webRequestAsyncOperation.ToUniTask();
//PlayerLoopInfo.Inject();