Why does this code crash Visual Studio 2015?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
46
down vote

favorite
3












For some reason, even so much as typing this into a C# file in Visual Studio is enough to cause it to instantly crash. Why?



unsafe struct node 
node* child;



It seems to occur when the IDE would start coloring keywords and the like.



Trying it in TIO spits out csc.exe exited with code 1 which isn't very helpful.



While array declarations in C# are different than in C/C++, the above seems like it should be perfectly valid. Why isn't it, and why does it crash Visual Studio?



My Visual Studio version is 14.0.23107.







share|improve this question





















  • Confirmed, I pasted that code into VS2015 and it immediately froze, then crashed 20 seconds later. If you remove the , it can be safely copied into a VS code window. However, the moment you type the , VS crashes.
    – Amy
    Aug 7 at 17:51











  • VS 2012 produces a compile error: Cannot take the address of, get the size of, or declare a pointer to a managed type
    – LarsTech
    Aug 7 at 17:54






  • 2




    VS2017 instantly, immediately closes
    – Camilo Terevinto
    Aug 7 at 17:55






  • 2




    Ditto LINQPad. StackoverflowException.
    – Crowcoder
    Aug 7 at 18:00






  • 8




    I found an existing bug: github.com/dotnet/roslyn/issues/24978
    – Amy
    Aug 7 at 18:22














up vote
46
down vote

favorite
3












For some reason, even so much as typing this into a C# file in Visual Studio is enough to cause it to instantly crash. Why?



unsafe struct node 
node* child;



It seems to occur when the IDE would start coloring keywords and the like.



Trying it in TIO spits out csc.exe exited with code 1 which isn't very helpful.



While array declarations in C# are different than in C/C++, the above seems like it should be perfectly valid. Why isn't it, and why does it crash Visual Studio?



My Visual Studio version is 14.0.23107.







share|improve this question





















  • Confirmed, I pasted that code into VS2015 and it immediately froze, then crashed 20 seconds later. If you remove the , it can be safely copied into a VS code window. However, the moment you type the , VS crashes.
    – Amy
    Aug 7 at 17:51











  • VS 2012 produces a compile error: Cannot take the address of, get the size of, or declare a pointer to a managed type
    – LarsTech
    Aug 7 at 17:54






  • 2




    VS2017 instantly, immediately closes
    – Camilo Terevinto
    Aug 7 at 17:55






  • 2




    Ditto LINQPad. StackoverflowException.
    – Crowcoder
    Aug 7 at 18:00






  • 8




    I found an existing bug: github.com/dotnet/roslyn/issues/24978
    – Amy
    Aug 7 at 18:22












up vote
46
down vote

favorite
3









up vote
46
down vote

favorite
3






3





For some reason, even so much as typing this into a C# file in Visual Studio is enough to cause it to instantly crash. Why?



unsafe struct node 
node* child;



It seems to occur when the IDE would start coloring keywords and the like.



Trying it in TIO spits out csc.exe exited with code 1 which isn't very helpful.



While array declarations in C# are different than in C/C++, the above seems like it should be perfectly valid. Why isn't it, and why does it crash Visual Studio?



My Visual Studio version is 14.0.23107.







share|improve this question













For some reason, even so much as typing this into a C# file in Visual Studio is enough to cause it to instantly crash. Why?



unsafe struct node 
node* child;



It seems to occur when the IDE would start coloring keywords and the like.



Trying it in TIO spits out csc.exe exited with code 1 which isn't very helpful.



While array declarations in C# are different than in C/C++, the above seems like it should be perfectly valid. Why isn't it, and why does it crash Visual Studio?



My Visual Studio version is 14.0.23107.









share|improve this question












share|improve this question




share|improve this question








edited Aug 7 at 17:57









Amy

20.3k1771131




20.3k1771131









asked Aug 7 at 17:48









Orion

43537




43537











  • Confirmed, I pasted that code into VS2015 and it immediately froze, then crashed 20 seconds later. If you remove the , it can be safely copied into a VS code window. However, the moment you type the , VS crashes.
    – Amy
    Aug 7 at 17:51











  • VS 2012 produces a compile error: Cannot take the address of, get the size of, or declare a pointer to a managed type
    – LarsTech
    Aug 7 at 17:54






  • 2




    VS2017 instantly, immediately closes
    – Camilo Terevinto
    Aug 7 at 17:55






  • 2




    Ditto LINQPad. StackoverflowException.
    – Crowcoder
    Aug 7 at 18:00






  • 8




    I found an existing bug: github.com/dotnet/roslyn/issues/24978
    – Amy
    Aug 7 at 18:22
















  • Confirmed, I pasted that code into VS2015 and it immediately froze, then crashed 20 seconds later. If you remove the , it can be safely copied into a VS code window. However, the moment you type the , VS crashes.
    – Amy
    Aug 7 at 17:51











  • VS 2012 produces a compile error: Cannot take the address of, get the size of, or declare a pointer to a managed type
    – LarsTech
    Aug 7 at 17:54






  • 2




    VS2017 instantly, immediately closes
    – Camilo Terevinto
    Aug 7 at 17:55






  • 2




    Ditto LINQPad. StackoverflowException.
    – Crowcoder
    Aug 7 at 18:00






  • 8




    I found an existing bug: github.com/dotnet/roslyn/issues/24978
    – Amy
    Aug 7 at 18:22















Confirmed, I pasted that code into VS2015 and it immediately froze, then crashed 20 seconds later. If you remove the , it can be safely copied into a VS code window. However, the moment you type the , VS crashes.
– Amy
Aug 7 at 17:51





Confirmed, I pasted that code into VS2015 and it immediately froze, then crashed 20 seconds later. If you remove the , it can be safely copied into a VS code window. However, the moment you type the , VS crashes.
– Amy
Aug 7 at 17:51













VS 2012 produces a compile error: Cannot take the address of, get the size of, or declare a pointer to a managed type
– LarsTech
Aug 7 at 17:54




VS 2012 produces a compile error: Cannot take the address of, get the size of, or declare a pointer to a managed type
– LarsTech
Aug 7 at 17:54




2




2




VS2017 instantly, immediately closes
– Camilo Terevinto
Aug 7 at 17:55




VS2017 instantly, immediately closes
– Camilo Terevinto
Aug 7 at 17:55




2




2




Ditto LINQPad. StackoverflowException.
– Crowcoder
Aug 7 at 18:00




Ditto LINQPad. StackoverflowException.
– Crowcoder
Aug 7 at 18:00




8




8




I found an existing bug: github.com/dotnet/roslyn/issues/24978
– Amy
Aug 7 at 18:22




I found an existing bug: github.com/dotnet/roslyn/issues/24978
– Amy
Aug 7 at 18:22












1 Answer
1






active

oldest

votes

















up vote
39
down vote



accepted










This is a known bug in Roslyn. This bug will affect any version of Visual Studio that uses Roslyn.



If I am interpreting VersionOf.net correctly, the first version of Visual Studio with Roslyn built-in is 2015. Before then, I think it was available only as an extension. So, Visual Studio 2013 and prior should be unaffected.



It's due to be fixed in the milestone 16 release. At this time, that release is not scheduled.



Because this is a bug in Roslyn, you can "get around" it by editing and compiling the code containing the unsafe struct in an older version of Visual Studio, one that predates Roslyn. Visual Studio 2012 should work. You can then use the resultant .DLL in your current software.



An unverified fix is available if you build Roslyn yourself from this branch. The fix was made in this commit.






share|improve this answer



















  • 3




    according to this, you're qualifying for step number 3 or 4: meta.stackexchange.com/a/132704/382678 between awesome and legendary.
    – Jean-François Fabre
    Aug 7 at 19:49











  • nice move answering this properly: the question is probably in the 10k tools best questions of today. So here comes the 20k ;)
    – Jean-François Fabre
    Aug 7 at 19:50










  • @Jean-FrançoisFabre What is "10k tools best questions of today"?
    – Amy
    Aug 7 at 21:05










  • stackoverflow.com/tools. This question is indeed #1. seems that I was right :)
    – Jean-François Fabre
    Aug 7 at 21:06











Your Answer





StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51732647%2fwhy-does-this-code-crash-visual-studio-2015%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
39
down vote



accepted










This is a known bug in Roslyn. This bug will affect any version of Visual Studio that uses Roslyn.



If I am interpreting VersionOf.net correctly, the first version of Visual Studio with Roslyn built-in is 2015. Before then, I think it was available only as an extension. So, Visual Studio 2013 and prior should be unaffected.



It's due to be fixed in the milestone 16 release. At this time, that release is not scheduled.



Because this is a bug in Roslyn, you can "get around" it by editing and compiling the code containing the unsafe struct in an older version of Visual Studio, one that predates Roslyn. Visual Studio 2012 should work. You can then use the resultant .DLL in your current software.



An unverified fix is available if you build Roslyn yourself from this branch. The fix was made in this commit.






share|improve this answer



















  • 3




    according to this, you're qualifying for step number 3 or 4: meta.stackexchange.com/a/132704/382678 between awesome and legendary.
    – Jean-François Fabre
    Aug 7 at 19:49











  • nice move answering this properly: the question is probably in the 10k tools best questions of today. So here comes the 20k ;)
    – Jean-François Fabre
    Aug 7 at 19:50










  • @Jean-FrançoisFabre What is "10k tools best questions of today"?
    – Amy
    Aug 7 at 21:05










  • stackoverflow.com/tools. This question is indeed #1. seems that I was right :)
    – Jean-François Fabre
    Aug 7 at 21:06















up vote
39
down vote



accepted










This is a known bug in Roslyn. This bug will affect any version of Visual Studio that uses Roslyn.



If I am interpreting VersionOf.net correctly, the first version of Visual Studio with Roslyn built-in is 2015. Before then, I think it was available only as an extension. So, Visual Studio 2013 and prior should be unaffected.



It's due to be fixed in the milestone 16 release. At this time, that release is not scheduled.



Because this is a bug in Roslyn, you can "get around" it by editing and compiling the code containing the unsafe struct in an older version of Visual Studio, one that predates Roslyn. Visual Studio 2012 should work. You can then use the resultant .DLL in your current software.



An unverified fix is available if you build Roslyn yourself from this branch. The fix was made in this commit.






share|improve this answer



















  • 3




    according to this, you're qualifying for step number 3 or 4: meta.stackexchange.com/a/132704/382678 between awesome and legendary.
    – Jean-François Fabre
    Aug 7 at 19:49











  • nice move answering this properly: the question is probably in the 10k tools best questions of today. So here comes the 20k ;)
    – Jean-François Fabre
    Aug 7 at 19:50










  • @Jean-FrançoisFabre What is "10k tools best questions of today"?
    – Amy
    Aug 7 at 21:05










  • stackoverflow.com/tools. This question is indeed #1. seems that I was right :)
    – Jean-François Fabre
    Aug 7 at 21:06













up vote
39
down vote



accepted







up vote
39
down vote



accepted






This is a known bug in Roslyn. This bug will affect any version of Visual Studio that uses Roslyn.



If I am interpreting VersionOf.net correctly, the first version of Visual Studio with Roslyn built-in is 2015. Before then, I think it was available only as an extension. So, Visual Studio 2013 and prior should be unaffected.



It's due to be fixed in the milestone 16 release. At this time, that release is not scheduled.



Because this is a bug in Roslyn, you can "get around" it by editing and compiling the code containing the unsafe struct in an older version of Visual Studio, one that predates Roslyn. Visual Studio 2012 should work. You can then use the resultant .DLL in your current software.



An unverified fix is available if you build Roslyn yourself from this branch. The fix was made in this commit.






share|improve this answer















This is a known bug in Roslyn. This bug will affect any version of Visual Studio that uses Roslyn.



If I am interpreting VersionOf.net correctly, the first version of Visual Studio with Roslyn built-in is 2015. Before then, I think it was available only as an extension. So, Visual Studio 2013 and prior should be unaffected.



It's due to be fixed in the milestone 16 release. At this time, that release is not scheduled.



Because this is a bug in Roslyn, you can "get around" it by editing and compiling the code containing the unsafe struct in an older version of Visual Studio, one that predates Roslyn. Visual Studio 2012 should work. You can then use the resultant .DLL in your current software.



An unverified fix is available if you build Roslyn yourself from this branch. The fix was made in this commit.







share|improve this answer















share|improve this answer



share|improve this answer








edited Aug 7 at 20:08


























answered Aug 7 at 19:48









Amy

20.3k1771131




20.3k1771131







  • 3




    according to this, you're qualifying for step number 3 or 4: meta.stackexchange.com/a/132704/382678 between awesome and legendary.
    – Jean-François Fabre
    Aug 7 at 19:49











  • nice move answering this properly: the question is probably in the 10k tools best questions of today. So here comes the 20k ;)
    – Jean-François Fabre
    Aug 7 at 19:50










  • @Jean-FrançoisFabre What is "10k tools best questions of today"?
    – Amy
    Aug 7 at 21:05










  • stackoverflow.com/tools. This question is indeed #1. seems that I was right :)
    – Jean-François Fabre
    Aug 7 at 21:06













  • 3




    according to this, you're qualifying for step number 3 or 4: meta.stackexchange.com/a/132704/382678 between awesome and legendary.
    – Jean-François Fabre
    Aug 7 at 19:49











  • nice move answering this properly: the question is probably in the 10k tools best questions of today. So here comes the 20k ;)
    – Jean-François Fabre
    Aug 7 at 19:50










  • @Jean-FrançoisFabre What is "10k tools best questions of today"?
    – Amy
    Aug 7 at 21:05










  • stackoverflow.com/tools. This question is indeed #1. seems that I was right :)
    – Jean-François Fabre
    Aug 7 at 21:06








3




3




according to this, you're qualifying for step number 3 or 4: meta.stackexchange.com/a/132704/382678 between awesome and legendary.
– Jean-François Fabre
Aug 7 at 19:49





according to this, you're qualifying for step number 3 or 4: meta.stackexchange.com/a/132704/382678 between awesome and legendary.
– Jean-François Fabre
Aug 7 at 19:49













nice move answering this properly: the question is probably in the 10k tools best questions of today. So here comes the 20k ;)
– Jean-François Fabre
Aug 7 at 19:50




nice move answering this properly: the question is probably in the 10k tools best questions of today. So here comes the 20k ;)
– Jean-François Fabre
Aug 7 at 19:50












@Jean-FrançoisFabre What is "10k tools best questions of today"?
– Amy
Aug 7 at 21:05




@Jean-FrançoisFabre What is "10k tools best questions of today"?
– Amy
Aug 7 at 21:05












stackoverflow.com/tools. This question is indeed #1. seems that I was right :)
– Jean-François Fabre
Aug 7 at 21:06





stackoverflow.com/tools. This question is indeed #1. seems that I was right :)
– Jean-François Fabre
Aug 7 at 21:06













 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51732647%2fwhy-does-this-code-crash-visual-studio-2015%23new-answer', 'question_page');

);

Post as a guest













































































這個網誌中的熱門文章

How to combine Bézier curves to a surface?

Mutual Information Always Non-negative

Why am i infinitely getting the same tweet with the Twitter Search API?