# CSHARP PARSER, TYPELESS NEW OPERATOR CRASHES

**URL:** <https://forum.alternetsoft.com/t/csharp-parser-typeless-new-operator-crashes/184>\
**Category:** AlterNET Studio Support\
**Tags:** editor\
**Created:** [January 19, 2018, 12:00am UTC](https://forum.alternetsoft.com/t/csharp-parser-typeless-new-operator-crashes/184 "2018-01-19T00:00:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ralf.stanke](https://forum.alternetsoft.com/letter_avatar_proxy/v4/letter/r/606060/32.png) [@ralf.stanke](https://forum.alternetsoft.com/u/ralf.stanke)\
**Post date:** [January 19, 2018, 12:00am UTC](https://forum.alternetsoft.com/t/csharp-parser-typeless-new-operator-crashes/184/1 "2018-01-19T00:00:00Z")

</div>

The current version of Editor.NET (2.5) crashes if the following text is typed into a C# syntax:  
var str = new [] {  
The NUllReferenceException actually pops up in CsParser.GenerateImplicitClass and to be fixed there, but I think additionally you should encapsulate the execution of an action inside BackgroundThread with a try-catch in order to avoid async unhandled exceptions in general.  
Best,  
Ralf

---

<div class="post-metadata">

**Author:** ![andrew.medvedev](https://forum.alternetsoft.com/user_avatar/forum.alternetsoft.com/andrew.medvedev/32/28_2.png) [@andrew.medvedev](https://forum.alternetsoft.com/u/andrew.medvedev)\
**Post date:** [January 22, 2018, 12:00am UTC](https://forum.alternetsoft.com/t/csharp-parser-typeless-new-operator-crashes/184/2 "2018-01-22T00:00:00Z")

</div>

Hi Ventuz,  
Thank you for the bug report, this problem has been fixed already in AlterNET CodeEditor, as Editor.NET is no longer developed.  
Here's the fix to this bug:  
   
 protected virtual string GenerateImplicitClass(ISyntaxNode memberList, out ISyntaxNode typeNode)  
 {  
 string result = string.Empty;  
 typeNode = null;  
 ISyntaxNode parent = GetImplicitNode(SyntaxTree.Current);  
 if (parent != null)  
 {  
 Point pos = parent.Position;  
 ISyntaxNode node = new SyntaxNode(pos, string.Empty, (int)NetNodeType.Class, SyntaxNodeOptions.CodeCompletion);  
 if (memberList.HasChildren) // added line  
 foreach (ISyntaxNode child in memberList.ChildList)  
 {  
...  
and I'm uploading fixed assembly as well:  
[http://www.alternetsoft.com/projects/QWhale\_dlls.zip](http://www.alternetsoft.com/projects/QWhale_dlls.zip)  
We will also look at your suggestion as to handle parsing exceptions when using background thread.  
regards,  
Andrew
