Console.Writeline working on x86 but not x64
Asked Answered
S

2

7

I'm testing a project in visual studio 2012.

When I run my code in x86, Console.Writeline shows up in the output window. However, when I run it in x64, it does not.

I understand I can use System.Diagnostics.Debug instead, but I would really like to understand why Console.Writeline is not working, or if there is a setting somewhere.

Thanks.

Edit: An observation: The Visual Studio hosting process is disabled for both builds. When I enable it, all Console.Writeline messages show up for both x64 and x86. When I disable it again, only the x86 displays Console.Writeline.

Stratify answered 25/10, 2012 at 14:30 Comment(4)
Some info about what happening? Errors or smth?Mainland
No errors, normal functionality of the software, just Console.Writeline not showing up in output window. If I clean everything and re-build in x86... it works. When I got back to x64 it doesn't work. Very strange.Stratify
+1 Thanks for the hint. For me, enabling the hosting process did the trick, even though i'm still on vs2010. Still, the question remains why that should make the difference.Pteropod
Using VS 2013 and experiencing the same stuff. Makes sense that the hosting process serves as a tunnel from your app to the VS Output window, but no idea where the difference between x86 and x64 comes fromGodoy
T
3

There should be no difference between the two. Most likely you have a configuration difference between your x86 and x64 compilation profiles. Check to make sure that you are building a console application in both cases.

Trahan answered 25/10, 2012 at 14:32 Comment(3)
You don't need to be making a console application to use Console.WriteLine, if you call it from any project type it should show up in the Output Window.Seacoast
This is true, but Console.WriteLine won't show up in an application console window if you run the application outside of Visual Studio. Which is what the question was about, as I understood it.Trahan
Well, both my x64 and x86 builds disable the visual studio hosting process. However, the x86 still displays console messages. If I enable hosting process, the x64 does as well. I am just trying to understand why there difference between unhosted x86 and x64 builds.Stratify
P
1

Make sure you copy settings from AnyCpu while creating x64. I had a similar problem but once I copied it, it worked fine.

Peterpeterborough answered 5/4, 2017 at 6:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.