Skip to content

Commit

Permalink
Merge pull request #51 from Vannevelj/37-newguid
Browse files Browse the repository at this point in the history
Fixes #37
  • Loading branch information
Vannevelj authored Apr 13, 2020
2 parents b73a38a + f5bafae commit 1a48859
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sharpsource/sharpsource.Test/NewGuidTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,5 +230,24 @@ void Method()

VerifyDiagnostic(original);
}

[TestMethod]
public void NewGuid_OverloadedConstructor()
{
var original = @"
using System;
namespace ConsoleApplication1
{
class MyClass
{
void Method()
{
Guid g = new Guid(string.Empty);
}
}
}";

VerifyDiagnostic(original);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ private static void AnalyzeSymbol(SyntaxNodeAnalysisContext context)

if (symbol != null &&
symbol.Name == "Guid" &&
expression.ArgumentList?.Arguments.Any() != true &&
( symbol.ContainingAssembly.Name == "mscorlib" || symbol.ContainingAssembly.Name == "System.Runtime" ))
{
context.ReportDiagnostic(Diagnostic.Create(Rule, context.Node.GetLocation()));
Expand Down

0 comments on commit 1a48859

Please # to comment.