(done) Exception from while(){}

PHP Tools [?] extends Visual Studio with set of advanced features to work more efficiently with PHP code.

(done) Exception from while(){}

Postby AndyM84 » October 9th, 2018, 5:28 pm

Was doing a typical
Code: Select all
while()
to iterate through the lines of a file and received the following message:

An exception has been encountered. This may be caused by an extension.


Here's the relevant entry in the ActivityLog:

Code: Select all
System.NullReferenceException: Object reference not set to an instance of an object.
   at    
 	.
 
 .VisitWhileStmt(WhileStmt x)
   at Devsense.PHP.Syntax.Ast.WhileStmt.VisitMe(TreeVisitor visitor)
   at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
   at Devsense.PHP.Syntax.TreeVisitor.VisitList[T](IList`1 items)
   at    
 	.
 
 .VisitIfStmt(IfStmt x)
   at Devsense.PHP.Syntax.Ast.IfStmt.VisitMe(TreeVisitor visitor)
   at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
   at Devsense.PHP.Syntax.TreeVisitor.VisitList[T](IList`1 items)
   at    
 	.
 
 .VisitForeachStmt(ForeachStmt x)
   at Devsense.PHP.Syntax.Ast.ForeachStmt.VisitMe(TreeVisitor visitor)
   at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
   at Devsense.PHP.Syntax.TreeVisitor.VisitList[T](IList`1 items)
   at    
 	.
 
 .VisitMethodDecl(MethodDecl x)
   at    
 	.
 
 .VisitTypeDecl(TypeDecl type)
   at Devsense.PHP.Syntax.TreeVisitor.VisitNamedTypeDecl(NamedTypeDecl x)
   at Devsense.PHP.Syntax.Ast.NamedTypeDecl.VisitMe(TreeVisitor visitor)
   at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
   at Devsense.PHP.Syntax.TreeVisitor.VisitList[T](IList`1 items)
   at    
 	.
 
 .VisitBlockStmt(BlockStmt x)
   at Devsense.PHP.Syntax.Ast.BlockStmt.VisitMe(TreeVisitor visitor)
   at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
   at    
 	.
 
 .VisitNamespaceDecl(NamespaceDecl ns)
   at Devsense.PHP.Syntax.Ast.NamespaceDecl.VisitMe(TreeVisitor visitor)
   at Devsense.PHP.Syntax.TreeVisitor.VisitElement(LangElement element)
   at Devsense.PHP.Syntax.TreeVisitor.VisitList[T](IList`1 items)
   at Devsense.PHP.Syntax.TreeVisitor.VisitGlobalCode(GlobalCode x)
   at    
 	.
 
 . 
(List`1 	
, GlobalCode 	
 )
   at    
 	.(GlobalCode 	
 , IAdvancedOptions 


 )
   at PHP.VisualStudio.Language.Editor.Outlining.BlocksFromAstTagger.
.
  (   		, GlobalCode 	
 , ITextVersion 	 		)
   at PHP.VisualStudio.Language.Editor.Outlining.BlocksFromAstTagger.
.InvokeTask()
   at PHP.VisualStudio.Language.TaskQueue.
.
 ()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)


And finally, the code that caused it all...

Code: Select all
$fh = @fopen($file, 'r');

if ($fh) {
   while (($buf = ))
}
User avatar
AndyM84
 
Posts: 69
Joined: August 6th, 2012, 3:24 pm
Location: Boston, MA, USA

Re: Exception from while(){}

Postby maros.beno » October 11th, 2018, 11:42 am

Hi,
thank you for reporting this.
It should be fixed now.
Have a nice day.
Maroš Beňo
User avatar
maros.beno
 
Posts: 47
Joined: October 12th, 2016, 12:11 pm


Return to PHP Tools

Who is online

Users browsing this forum: No registered users and 7 guests

User Control Panel

Login

Who is online

In total there are 7 users online :: 0 registered, 0 hidden and 7 guests (based on users active over the past 5 minutes)
Most users ever online was 89 on October 15th, 2018, 4:06 pm

Users browsing this forum: No registered users and 7 guests
Phalanger