Starting a 64bit process from a 32bit app? - c#-4.0

I have a WPF 4.0 application that I have compiled for x86. When running on 64bit Win7, I need to start up an on-screen keyboard, located in %windows%/System32/osk.exe. Problem is I can't do it- I get an error 'Could not start On-Screen Keyboard'.
I found this thread:
Unable to launch onscreen keyboard (osk.exe) from a 32-bit process on Win7 x64 which sounds exactly like my problem.
I used all the relevant bits from that post, but the error persists. And even worse, I managed to get a 32 bit version of osk.exe and when I try to start THAT I just get a blank error box- no message at all, just a red 'X'.
So I can't compile my app for AnyCPU (3rd party interop libs), and have read that that might not solve the issue anyways. I have also read that one workaround is to disable virtualization using Wow64DisableWow64FsRedirection, but that this is unsafe. Seems like a lot of effort just to run a little app :(
What can I do to launch this little thing from my app?

Wrapping the offending app in a exe compiled with AnyCPU works fine and seems to be the least painful approach.

Related

VS won't compile x86

I'm trying to run an exe which calls Microsoft.ACE.oledb.12.0 but get the error "Provider not registered on local machine". There has been quite a lot about this error on Stackoverflow. Recommendations to correct this are to install AccessDatabaeEngine and compiling in x86. I've done both and although the path in project is set to x86 I suspect it is still compiling to 64 bit as VS continues to place the exe in that 64 bit folder. But I 'm at a lost as to how to correct this. Any one know how to fix this or confirm if the exe is 32 or 64 bit regardless of which folder it is placed in. Running vs2012 on windows 2012 server 64bit (Hyper-v)
regards
Erick
ok...so this is what happened. I changed the cpu type to x86 on the project properties. Which did compile to 32bit but placed it in the incorrect folder. I confirmed this by opening the exe in notepad as there is a way to tell what type it is.
However, the debug version remained at 64 bit. The fix is to use the drop down list on the toolbar which says "Release" or "Debug" and set it to Configuration manager. In there set both the release and debug values to x86. This compiles it to x86 and puts it in the correct folder. I don't know how this is different but it now happily uses the 32 bit dll.

Visual Studio 2017 crashes after 10-20 minutes

For over a month now I've been experiencing problems with VS2017 on my home PC. I even tried submitting the feedback to Microsoft. There's more info about the problems I'm experiencing there.
The problem:
The gist of it is that VS is eating RAM like crazy. As soon as I start opening files, adding new files, using IntelliSense, building or (especially) debugging, the RAM usage skyrockets.
After that it's only a matter of time before the VS crashes and restarts without any error message. Though there are numerous error messages throughout these breif ~20min I have with each session.
Additional details I observed:
Doesn't happen with Python projects, as these don't have to be built constantly. It might be eventually happening if you debug a lot, but I didn't have the chance to check that because most of my Python coding is debugged on an external device
Size of the loaded solution doesn't matter;
UWP and WPF seem to crash the most. Console Projects take longer to crash.
Also affects .NET Core;
It doesn't matter which version of .NET Framework I use;
VS2015 worked perfectly, but I don't have it anymore after the format
What I already tried:
I reinstalled VS;
I refreshed Windows;
I reinstalled Windows;
I checked my drives and RAM for issues - none found;
I switched from Community to Enterprise;
I tried disabling extensions;
I applied some shady hotfix I found somewhere;
Finally, I installed Rider which seems to be the best solution as of now. It still lacks many important features, though.
Is there anything else I can do/try/check? Did anyone experience (and fix) a similar issue?
Cheers!
You get a System.OutOfMemoryException, this means your Visual Studio runs out of free virtual address space (4GB on 64 Bit Windows for the 32Bit Visual Studio because Visual Studio is configured to be large address aware and MS refuses to release VS as 64Bit program which would fix this issue).
To analyze the memory usage, you need to run WPRUI.exe (part of Windows Performance Toolkit (which gets installed by VS2017) for some scenarios, if not, install it on your own), select Reference Set (Note: expand the Resource Analysis entry first to see all options).
and click on Start. Capture the memory usage grow for some 100s of MB and click on Save.
Open the generated ETL with the analyzer (WPA.exe) and analyze what the process devenv.exe is doing.
Also zip the ETL + NGENPDB folder (important) as zip and attach it to your bug report so that Microsoft can analyze it.

Conversion to x64 platform in visual studio failing

So I built a huge website for my company using the AnyCpu option. I didn't think it would matter - I have a 64bit machine with x64 windows, it's getting deployed to a x64 server, and there's no attached dll's, so it should just all be in 64, right?
Well, in the process of trying to implement some security, the company's support told us the application MUST be strictly x64. I figured it was, but to humor them, I went into the configuration manager, and changed all the target cpu, platform etc settings to x64.
Unfortunately now, it breaks when I hit f5 to run it. I've run into this before, I think, and I vaguely remember needing to delete some temp internet files somewhere, but I tried closing VS, deleting the bin folder, deleting the root folder from /framework/tempASPfiles... but I still get the BadImageFormatException - "an attempt was made to load the program with an incorrect format."
What's the best and fastest way to convert an app to x64? and am I right in thinking I need to delete some files somewhere?

"A remote operation is taking longer than expected" x64

First off, I think I've been to every website and forum there is that's discussing this issue and I've tried many different things. I'm at my wits end. This is the dumbest thing and I just want to start coding again!
I'm using Visual Studio Express 2012 for Windows Desktop. I have a x64 project I'm trying to run in Debug mode using the local windows debugger. The only external library I'm using is that of which is required to run DX11.
I attempt to run my program and it freezes. A window pops up saying "A remote operation is taking longer than expected."
I click Terminate and another window pops up asking if I'd like to terminate the remote session. Why yes, I would.
Then it says, "Unable to start program (my path leading to my .exe). The network connection to the Visual Studio Remote Debugger has been closed."
To my understanding, because Visual Studio itself is a 32 bit application, it needs to use the Remote Debugger to compile to x64. Is that correct?
Regardless, I'm still failing to see where that would break down. I've ran several repairs on VS and upgraded to Service Pack 2 (or 1, whichever is the latest).
I've ran a windows repair and uninstalled any VMWare type stuff on my computer. I'm not using a VPN.
I've even copied msvsmon.exe from my laptop (working instance of the project) over to this computer and still no luck.
I'm about ready to Nuke my OS and do a clean install on everything. sigh
Found the problem. It wasn't Windows Firewall like other threads describe. It was my internet filter. I guess it decided to try and block msvsmon.exe because it was using the network. Adding it, along with WDExpress.exe to the application exceptions list did the trick.

Cross-debug Windows application on Linux box in Eclipse CDT

I'm moved from Windows to Ubuntu Linux, and now I want to set up development environment here. The problem is that I need
C/C++ IDE comparable to Visual Studio
Way to generate Windows PE binaries
Way do debug Windows PE binaries
At first time I tried Code::Blocks. Here I find guide to setting it up for cross-development so I managed to get "Hello World" compiled and running under Wine. Moreover, debugging worked too.
But then I found that Eclipse + CDT plugin is far more advanced IDE. I spent some time and finally get project compiled and linked.
Now I'm trying to get MinGW Insight version of GDB working within Eclipse CDT. Simple way to use debugger described in Code::Blocks guide won't work anymore. I continue to receive "Error creating session" messages.
So my question is, how I can use MinGW GDB under Wine as debugger back-end in Eclipse?
Or, what is best IDE for Linux->Windows cross-development?
I'm wondering that nobody answered this yet.
QtCreator. Don't be confused by its name, QtCreator works is pretty well with any kind of C++ code, you don't need to code in Qt to use it. It is just like FOSS Visual Studio: it does even have a syntax checking "on fly".
MinGW. Here's not much to say, it is just creates Win PE executables, and it works. It is available in repositories. Note, that a Win GUI applications have special bit in it's PE header set; so, in order to create GUI application with MinGW you have to pass an option -mwindows to set this bit.
This is a problem. Really: I'm just trying to debug a windows application, and didn't find yet a way to do it. I will shortly recall here what I tried so far, just in order for you to not step on my rakes:
winedbg. Probably it should work, but for me it didn't. When I set a breakpoint, i.e. like this br 43, it says Unable to add breakpoint (unknown address 7b860807).
winedbg. Yeah, again, but this time we will use it like this winedbg --gbd to make it proxying a commands to gdb. Probably this is the only way to debug an application, but it have a drawbacks: first, in order to restart an application you have to exit debugger; if you enter run it says that the remote target doesn't support this. Second, I have no even idea how to debug a multithreaded application; when I first started this, I stumbled upon an error Non-stop mode requested, but remote does not support non-stop, and after setting a breakpoint and starting it says:
Cannot insert breakpoint 1. and Cannot access memory at address 0x401654. So, in order to make this work I was needed to rename my .gdbinit file (i.e. non-stop mode is set there).
gdb.exe. I was sure that I found a way: simple usage of a windows version of gdb should solve problems; more over, for me, as I am a Emacs guy, it would be absolutely the same as debugging with native gdb. But alas, the windows gdb just didn't work. If I run it, and enter any command, it simply does nothing. It only reacts on Ctrl-c and Ctrl-z commands. Probably I will try on my spare time to ask a question about it on mailing list. Well, now we can't use it...
So what we have do with debug? Most probably seek another Windows debugger that works under WINE. If I correctly recall, OllyDbg worked, but I don't know at the moment how to make it show a source code.
you can try NetBeans.It's a good free, open source
and Cross Platform Support IDE.
Run Windows in a VM?
Seriously, your question is good, but it's probably not worth spending the time to figure out the answer (especially: since nobody seems to have a ready answer). If you have real work to do, native Windows or Windows in a VM is the answer.

Resources