1
GhostDoc doesn't recognize methods with c#7 "default" shorthand
Problem reported by Matthew Hull - 4/3/2018 at 12:48 PM
Resolved
If a method using c#7 uses the "default" shorthand, GhostDoc cannot recognize the method. 
For example
// assignment
MyClass x = default;
// method signature
public void MyMethod<T>(T myvar = default)
instead of the "old style":
// assignment
MyClass x = default(MyClass);
// method signature
public void MyMethod<T>(T myvar = default(T))
 
The error log contains this message:
Exception Source: Parser exception
Exception Message: error: identifier '(' expected, FileName: C:\Development\PathRedacted\Validator.cs
Line: 362, Col: 120,
Line text: " public IValidator<string> IfExistsAs<T>(string key, out T value, bool notNullOrZero = true, T valueOnIgnore = default)"
Stack Trace :
   at A.c2a633a86bc6520b19077f08c4d83eef0.Step(IToken t)
   at A.c804faa950c7761f2e28972a9625a2f9b.c1affc771884eab0f51afc48f82d63a20()
   at A.c804faa950c7761f2e28972a9625a2f9b.c2e25023829bea8531d7dc3733fa1cd36()
   at A.c804faa950c7761f2e28972a9625a2f9b.c10813f9f47b5115bf91d0dbc6375c483()
   at A.c804faa950c7761f2e28972a9625a2f9b.cc44c18faf165c670d05b3113d40359f0()
   at A.c7b68a6e08219948356c3e8b388a1a2c5.cc4badd6a3e5c5623821b7577b02193ef()
   at A.c2a633a86bc6520b19077f08c4d83eef0.ParameterList(IMember parent)
   at A.c144179a81958e48c0867485a5df7fff3.c581074e4f15614505aaf43ef7c03ca58()
   at A.c85d63cdad2a75941f7e65d2c2d359aad.c66772c4aca7dd32de5f62e3af4d8c3a8(ICompilationUnit , IClassInterface , INamespaceDeclaration )
   at A.c85d63cdad2a75941f7e65d2c2d359aad.cbceecda92945e0fdceb8fc69cbec7b63()
   at A.cb68d1b45010ff9a861d749e0871601be.cfb8d75f7155fc3a47e8a8718d15bb676(IRegion , INamespaceDeclaration , IType , ICompilationUnit , AttributeSectionCollection , MemberModifiers , IRegion )
   at A.c2a633a86bc6520b19077f08c4d83eef0.NamespaceMember(INamespaceDeclaration currentNamespaceDeclaration)
   at A.c2a633a86bc6520b19077f08c4d83eef0.NamespaceMember(INamespaceDeclaration currentNamespaceDeclaration)
 
Sometimes it appears to ignore methods which follow the offending method.
This happens in both the beta and the regular pro. It happens in VS2017 (as well as vs2015 although the syntax is invalid there)

2 Replies

Reply to Thread
0
Serge B. Replied
Employee Post
Matthew, thank you for reporting this! I have assigned the issue to the Dev Team to investigate and get back to you shortly.
Serge Baranovsky
SubMain Software
(800) 936-2134
0
Serge B. Replied
Employee Post
Matthew,
 
Thank you for reporting the issue. We have updated our parser with the C# 7.1 syntax change we missed. 
 
The fix is rolled into the upcoming major v2018 release.
 
Thanks!
Serge Baranovsky
SubMain Software
(800) 936-2134

Reply to Thread