Add ValueTask support (#89)
* Add ValueTask support * remove netstandard2.1
This commit is contained in:
parent
c061f764bd
commit
eaf0393860
@ -1,4 +1,4 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Product>Ben Core</Product>
|
<Product>Ben Core</Product>
|
||||||
@ -15,16 +15,18 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
|
||||||
|
<!--<TargetFrameworks>netstandard2.0;netstandard2.1;net45</TargetFrameworks>-->
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>key.snk</AssemblyOriginatorKeyFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Nerdbank.GitVersioning" Version="2.1.17" PrivateAssets="all" />
|
<PackageReference Include="Nerdbank.GitVersioning" Version="3.0.25" PrivateAssets="all" />
|
||||||
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.7.6" PrivateAssets="all" />
|
<PackageReference Include="SourceLink.Create.CommandLine" Version="2.8.3" PrivateAssets="all" />
|
||||||
<PackageReference Include="System.Reflection.Metadata">
|
<PackageReference Include="System.Reflection.Metadata">
|
||||||
<Version>1.5.0</Version>
|
<Version>1.6.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.3" Condition="'$(TargetFramework)' != 'netstandard2.1'" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup Label="TestInternalsVisibleTo">
|
<ItemGroup Label="TestInternalsVisibleTo">
|
||||||
|
|||||||
@ -51,7 +51,7 @@ namespace System.Diagnostics
|
|||||||
{
|
{
|
||||||
var frame = stackFrames[i];
|
var frame = stackFrames[i];
|
||||||
var method = frame.GetMethod();
|
var method = frame.GetMethod();
|
||||||
|
|
||||||
// Always show last stackFrame
|
// Always show last stackFrame
|
||||||
if (!ShowInStackTrace(method) && i < stackFrames.Length - 1)
|
if (!ShowInStackTrace(method) && i < stackFrames.Length - 1)
|
||||||
{
|
{
|
||||||
@ -647,6 +647,10 @@ namespace System.Diagnostics
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (type == typeof(ValueTask<>) && method.Name == "get_Result")
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (type == typeof(Task))
|
if (type == typeof(Task))
|
||||||
{
|
{
|
||||||
switch (method.Name)
|
switch (method.Name)
|
||||||
@ -687,6 +691,10 @@ namespace System.Diagnostics
|
|||||||
}
|
}
|
||||||
else if (type == typeof(TaskAwaiter) ||
|
else if (type == typeof(TaskAwaiter) ||
|
||||||
type == typeof(TaskAwaiter<>) ||
|
type == typeof(TaskAwaiter<>) ||
|
||||||
|
type == typeof(ValueTaskAwaiter) ||
|
||||||
|
type == typeof(ValueTaskAwaiter<>) ||
|
||||||
|
type == typeof(ConfiguredValueTaskAwaitable.ConfiguredValueTaskAwaiter) ||
|
||||||
|
type == typeof(ConfiguredValueTaskAwaitable<>.ConfiguredValueTaskAwaiter) ||
|
||||||
type == typeof(ConfiguredTaskAwaitable.ConfiguredTaskAwaiter) ||
|
type == typeof(ConfiguredTaskAwaitable.ConfiguredTaskAwaiter) ||
|
||||||
type == typeof(ConfiguredTaskAwaitable<>.ConfiguredTaskAwaiter))
|
type == typeof(ConfiguredTaskAwaitable<>.ConfiguredTaskAwaiter))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -39,13 +39,12 @@ namespace Ben.Demystifier.Test
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Exception GetMixedStackException()
|
Exception GetMixedStackException()
|
||||||
{
|
{
|
||||||
Exception exception = null;
|
Exception exception = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Start((val:"", true));
|
Start((val: "", true));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -61,7 +60,7 @@ namespace Ben.Demystifier.Test
|
|||||||
"string string.Join(string separator, IEnumerable<string> values)",
|
"string string.Join(string separator, IEnumerable<string> values)",
|
||||||
"string Ben.Demystifier.Test.MixedStack+GenericClass<T>.GenericMethod<V>(ref V value)",
|
"string Ben.Demystifier.Test.MixedStack+GenericClass<T>.GenericMethod<V>(ref V value)",
|
||||||
"async Task<string> Ben.Demystifier.Test.MixedStack.MethodAsync(int value)",
|
"async Task<string> Ben.Demystifier.Test.MixedStack.MethodAsync(int value)",
|
||||||
"async Task<string> Ben.Demystifier.Test.MixedStack.MethodAsync<TValue>(TValue value)",
|
"async ValueTask<string> Ben.Demystifier.Test.MixedStack.MethodAsync<TValue>(TValue value)",
|
||||||
"(string val, bool) Ben.Demystifier.Test.MixedStack.Method(string value)",
|
"(string val, bool) Ben.Demystifier.Test.MixedStack.Method(string value)",
|
||||||
"ref string Ben.Demystifier.Test.MixedStack.RefMethod(string value)",
|
"ref string Ben.Demystifier.Test.MixedStack.RefMethod(string value)",
|
||||||
"(string val, bool) Ben.Demystifier.Test.MixedStack.s_func(string s, bool b)",
|
"(string val, bool) Ben.Demystifier.Test.MixedStack.s_func(string s, bool b)",
|
||||||
@ -91,7 +90,7 @@ namespace Ben.Demystifier.Test
|
|||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
|
||||||
static async Task<string> MethodAsync<TValue>(TValue value) => await MethodAsync(1);
|
static async ValueTask<string> MethodAsync<TValue>(TValue value) => await MethodAsync(1);
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)]
|
||||||
static (string val, bool) Method(string value) => (MethodAsync(value).GetAwaiter().GetResult(), true);
|
static (string val, bool) Method(string value) => (MethodAsync(value).GetAwaiter().GetResult(), true);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user