-
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1701 from DGP-Studio/develop
- Loading branch information
Showing
207 changed files
with
6,505 additions
and
1,070 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/Snap.Hutao/Snap.Hutao.Test/RuntimeBehavior/HttpClientBehaviorTest.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
using System.Drawing; | ||
using System.Net.Http; | ||
using System.Net.Http.Json; | ||
using System.Runtime.CompilerServices; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace Snap.Hutao.Test.RuntimeBehavior; | ||
|
||
[TestClass] | ||
public sealed class HttpClientBehaviorTest | ||
{ | ||
private const int MessageNotYetSent = 0; | ||
|
||
[TestMethod] | ||
public async Task RetrySendHttpRequestMessage() | ||
{ | ||
using (HttpClient httpClient = new()) | ||
{ | ||
HttpRequestMessage requestMessage = new(HttpMethod.Post, "https://jsonplaceholder.typicode.com/posts"); | ||
JsonContent content = JsonContent.Create(new Point(12, 34)); | ||
requestMessage.Content = content; | ||
using (requestMessage) | ||
{ | ||
await httpClient.SendAsync(requestMessage).ConfigureAwait(false); | ||
} | ||
|
||
Interlocked.Exchange(ref GetPrivateSendStatus(requestMessage), MessageNotYetSent); | ||
Volatile.Write(ref GetPrivateDisposed(content), false); | ||
await httpClient.SendAsync(requestMessage).ConfigureAwait(false); | ||
} | ||
} | ||
|
||
// private int _sendStatus | ||
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_sendStatus")] | ||
private static extern ref int GetPrivateSendStatus(HttpRequestMessage message); | ||
|
||
// private bool _disposed | ||
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_disposed")] | ||
private static extern ref bool GetPrivateDisposed(HttpRequestMessage message); | ||
|
||
// private bool _disposed | ||
[UnsafeAccessor(UnsafeAccessorKind.Field, Name = "_disposed")] | ||
private static extern ref bool GetPrivateDisposed(HttpContent content); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 0 additions & 39 deletions
39
src/Snap.Hutao/Snap.Hutao/Control/Collection/Alternating/AlternatingItemsControl.cs
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
src/Snap.Hutao/Snap.Hutao/Control/Collection/Alternating/IAlternatingItem.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.