You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is an Regression in the alanyzer in Version 6.2.0.2536 compared to the previous Version (6.1.0.2359).
Repro steps
Create a C# Console App (.NET 4.6.1)
Assign the SonarAnalyzer.CSharp" version=6.2.0.2536
Insert the following code:
using System;
using System.Threading;
namespace SonarAnalyzer.CSharp.Tests
{
sealed class ObjectsShouldNotBeDisposedMoreThanOnceException : IDisposable
{
static void Main()
{
return;
}
SemaphoreSlim _Semaphore;
public ObjectsShouldNotBeDisposedMoreThanOnceException()
{
_Semaphore = new SemaphoreSlim(1, 1);
}
public void Dispose()
{
_Semaphore?.Dispose();
_Semaphore = null;
}
}
}
Expected behavior
Th analyzer should not throw an exception; instead it should issue a warning..
Actual behavior
Duringthe analysing process the analyzer throws an exception: 1>CSC : warning AD0001: Analyzer 'SonarAnalyzer.Rules.CSharp.ObjectsShouldNotBeDisposedMoreThanOnce' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.MemberBindingExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.MemberAccessExpressionSyntax'.'.
Known workarounds
Revoke to Version 6.1.0.2359
Related information
Visual Studio Version: 2017
The text was updated successfully, but these errors were encountered:
Description
There is an Regression in the alanyzer in Version 6.2.0.2536 compared to the previous Version (6.1.0.2359).
Repro steps
Expected behavior
Th analyzer should not throw an exception; instead it should issue a warning..
Actual behavior
Duringthe analysing process the analyzer throws an exception:
1>CSC : warning AD0001: Analyzer 'SonarAnalyzer.Rules.CSharp.ObjectsShouldNotBeDisposedMoreThanOnce' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.MemberBindingExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.MemberAccessExpressionSyntax'.'.
Known workarounds
Revoke to Version 6.1.0.2359
Related information
The text was updated successfully, but these errors were encountered: