Reporter |
|
---|---|
Created | Apr 5, 2018 4:06:41 PM |
Updated | Apr 10, 2018 9:14:44 AM |
Subsystem | Psi - C# |
Assignee | Olga Lukianova (olka) |
Priority | Critical |
State | Submitted |
Type | Bug |
Fix version | No Fix versions |
Affected versions | 2018.1 |
Fixed In Version ReSharper | Undefined |
VsVersion | All Versions |
Using NUnit (3.7.10) in combination with Span<T> / ReadOnlySpan<T>, Resharper is showing an error on "Assert.That(() => SomethingThatReturnsSpan, ....)", while the project builds and the test runs fine.
In the following sample, the first 2 methods have "That" that is underlined in red, and only the third one is ok.
Also, regarding the 2nd one: "TestDelegate" in NUnit is defined as "public delegate void TestDelegate()", and so I don't understand why R# still thinks that that "() => _ = ..." returns a Span while it should return void here?
(VS2017 15.6.4, R# 2018.1 EAP4)
—
[Test, SuppressMessage("ReSharper", "ExpressionIsAlwaysNull")]
public void Test_Span()
{
string s = null;
//ERROR: "Cannot use 'System.ReadOnlySpan<char>' as a type argument"
Assert.That(() => s.AsReadOnlySpan(), Throws.Exception);
//ERROR: "Cannot use 'System.ReadOnlySpan<char>' as a type argument"
Assert.That(() => _ = s.AsReadOnlySpan(), Throws.Exception);
// OK
Assert.That(() => { _ = s.AsReadOnlySpan(); }, Throws.Exception);
}
–
Output:
1 passed, 0 failed, 0 skipped, took 1,52 seconds (NUnit 3.7.1).
–
In the following sample, the first 2 methods have "That" that is underlined in red, and only the third one is ok.
Also, regarding the 2nd one: "TestDelegate" in NUnit is defined as "public delegate void TestDelegate()", and so I don't understand why R# still thinks that that "() => _ = ..." returns a Span while it should return void here?
(VS2017 15.6.4, R# 2018.1 EAP4)
—
[Test, SuppressMessage("ReSharper", "ExpressionIsAlwaysNull")]
public void Test_Span()
{
string s = null;
//ERROR: "Cannot use 'System.ReadOnlySpan<char>' as a type argument"
Assert.That(() => s.AsReadOnlySpan(), Throws.Exception);
//ERROR: "Cannot use 'System.ReadOnlySpan<char>' as a type argument"
Assert.That(() => _ = s.AsReadOnlySpan(), Throws.Exception);
// OK
Assert.That(() => { _ = s.AsReadOnlySpan(); }, Throws.Exception);
}
–
Output:
1 passed, 0 failed, 0 skipped, took 1,52 seconds (NUnit 3.7.1).
–
There are no such errors in the latest release version - 2017.3.5.