Entering invalid code into .csx file can crash Visual Studio - by drobson

Status : 


Sign in
to vote
ID 777917 Comments
Status Active Workarounds
Type Other Repros 0
Opened 1/30/2013 12:20:58 PM
Access Restriction Public


I noticed that if I enter certain invalid code into a .csx file in the Visual Studio editor, I can crash Visual Studio. I will copy the offending code below. On the Sept Roslyn CTP, uncommenting the commented line crashes Visual Studio.

Obviously, the offending line makes no sense (can't refer to 'w' until after the method call completes) but still, Visual Studio should handle it gracefully without crashing.

#r "PresentationCore"
#r "PresentationFramework"
#r "System.Xaml"
#r "WindowsBase"

using System.Windows;
using System;

Window CreateWindow(Action action)
	var w = new Window();
	if (action != null)
	return w;

var w = CreateWindow(() =>
	// w.Content = new TextBlock("This code makes no sense");
Sign in to post a comment.