When I run my app in android studio it runs a different app - android-studio

I have two different projects (for simplicity I will call them project 1 and project 2).
When I run project 1 it runs just fine. However when I run project 2 for some reason it runs project 1. How may I be able to fix this.

Possible solutions are :
1. Reinstall the application or clear the cache from settings.
2. Restart the emulator without saving its state.

Related

Android Studio how to Revert Using Services instead of Run?

I would like to use the Run window in Android Studio for launching my run configurations (which is the default for projects).
I know that at some point I enabled the 8. Services window to be the default for one of my projects, however, I have no idea how to disable this again:
Any time I run anything in said project (launch an app, run tests, a command line app, etc.), it is launched in this Services windows, which has a bunch of annoying downsides in my opinion.
I do not want to delete the entire .idea directory of the project because I have many settings that I do not want to lose - it is just this one that bugs me.
Which run configurations are run in the Services window is determined by the Configurations availabe in Services list in Run/Debug Configurations -> Templates:
In there, you can simply remove or add any configurations that you want to have run in 8. Services or not.
Navigation
Run -> Edit Configurations... -> Templates -> Configurations available in Services
Thanks to #y.bedrov for pointing it out.

Visual Studio 2019 Processes not shutting down, NodeJS issues

I am working on a fresh install of Windows 10 Pro (10.0.18362) and trying to get Visual Studio 2019 setup and configured for .NET Core 3.1 Web Development but am running into several issues.
I created a default React.js ASP.NET Core Web Application and ran the project. Things seemed to be working alright, except that after updating JavaScript code the browser updates after a fairly long pause; things seem to be lagging.
After closing Visual Studio 2019 from the default Web App (no updates) there are several processes that seem to hang, and have to be shut down manually:
I have tried installing Visual Studio 2019 with the Node.js provided by the Visual Studio Installer, in addition to installing Node.js V12.4 and V13.6 manually with the same results.
Another problem: If I update the project from JavaScript to TypeScript using npx create-react-app client-app --typescript, Hot Updates stop working entirely. But after updating the JavaScript code and refreshing the browser things seem to update, so it does seem to be recompiling. I have tried debugging in Firefox and Chrome, both with the same results.
I am very hesitant to continue working with this install as I have had several issues when these processes. If these hang unexpectedly and are not shut down they will continue to use the old versions of the code and nothing that is done will update until the processes are shut down, causing complete insanity.
Could there a specific install procedure I need to perform as a workaround? Or am I possibly missing NuGet packages or Add-Ons? Since this is a fresh install of the operating system, are there Windows Features that I need to install? Or other configuration/permission changes that could be causing this?
Prior to this install, only projects created in Visual Studio 2017 seemed to work as expected. But I need to develop this site in .NET Core 3.0 and it looks like only Visual Studio 2019 is supported for that.
Update
After some messing around, it looks like Node is causing the problems. If I manually shut down the Node processes, then Visual Studio will finally shut down—but it leaves other processes like the VSCompiler and Consoles running. This happens even if I run Visual Studio as an administrator.
Should I install node before Visual Studio, or visa versa? Is there possibly some setup that I need to perform with Visual Studio or Node to get things working correctly?
Update 2
After not finding any fix I tried a complete reinstall of Windows, including a disk format, and then only installed Visual Studio and Node.js.
One interesting thing I found when doing this: I originally only installed Visual Studio and selected both the "Web Development" and "NodeJS Development". But when I tried to run a new .NET Core Web Application without any changes, I received an error saying that Node.js was not installed—even though I was able to find a node.exe in the MsBuilds folder under Visual Studio.
I completely uninstalled Visual Studio and all other components, installed Node.js, and then Visual Studio, but the problem still persists. Any time I try to run any kind of JavaScript using the SPA Templates, the Node.js processes don't shut down. If I kill the Node.js process then Visual Studio will finally shutdown, but it leaves the Console Window Host and VBCSCompiler running which have to be shut down manually.
I also tried creating a new .NET Core Web Application, except this time selecting the Angular Template and it works better: The Hot Reload works and it seems to run much faster. But the processes still don't shut down. The only difference is killing the Node.js processes doesn't let Visual Studio shutdown.
Update 3
Also not sure if this helps, but I tried setting the node.exe properties to "Run this program as an Administrator" to see if it happen to be a permission issue. This yielded the same results. I noticed that two windows will pop up, however: First a blank one, then the actual Angular server window.
I'm not sure if it's related, but when I tried to run the Angular Application again it looks like Angular is pointing at another (random) port than is set in the debug settings in the project.
One thing I did notice is that the usual Server Messages are not showing in the Output Window. It used to display the node.js messages such as "the server is running" and other compiler messages, but now it only displays the .NET output.
Update 4
Getting closer, I uninstalled Visual Studio and Node.js, then made sure to clean out any left over Visual Studio and node_modules folders from my AppData and User/Local directories, and then did a disk cleanup. Finally, I reinstalled Visual Studio—making sure to run the installer as Admin—and reinstalled Node.js.
I ran Visual Studio as an admin and created a new Angular App. Now, the Angular app works as expected, HMR works and things seem to run smoothly except that the processes still hang. The major difference is that killing the Microsoft Visual Studio 2019 process kills everything, whereas before it was leaving the VBSCCompiler, Node.js and consoles running.
When creating a React App things load fine. But, again, the HMR doesn't work and also leaves processes running. shutting down the main Visual Studio process seems to clean these up now too.
I'm afraid I don't have a fix but if anyone wants a quick way to kill all the errant node processes and speed things back up they can run:
taskkill /IM "node.exe" /F
I haven't had any issues executing this while VS is running.
In Visual Studio 2019, go to Tools, Options, Debugging, General and towards the bottom there is a checkbox for Automatically close the console when debugging stops. It is unchecked by default on new versions of VS and if you look at your ASP.NET Core project properties you will see that it is a console project. So without the checkbox checked, the console does not automatically close.
The problem is that it is a hidden console so you can't see it to shut it down manually. If you check the box for closing the console automatically, then the consoles and node.js will stop running whenever you stop the debugger. Also in Options, there is a Node.Js Tools area that you may want to look at as well. It has a checkbox for Wait for input when process exits abnormally. If the console is hidden, there is no way for you to do input so that could hold the process open as well.
Another option, if you don't want to change any of the debugging options, is to go to your project properties > Debug and change the Launch settings for the IIS Express profile to Project instead of IIS Express. This will actually make the console / command prompt visible and when you are done debugging you can Ctrl-C to stop the debugger or when you hit stop the console will give you the message to Press any key to close this window . . .
I had the same issue with React SPA, this worked for me:
Tools -> Options -> Debugging -> General -> Enable JavaScript debugging for ASP.NET (Chrome, Edge and IE) (Visual Studio 2017 and 2019) <- unchecked
also the dropdown next to the play button:
Script Debugging -> disabled
There are possibilities to run pre and post build tasks in Visual Studio. I would look for them in project settings.
I use VSCode. So, if you follow the explanation below you'll be able to tackle the problem.
Create a .bat file in your project root folder (for instance kill-node.bat) with the followwing content:
tasklist | find /i "node.exe" && taskkill /im node.exe /F || echo process "node.exe" not running.
Add a pre-build-task executing the .bat file
Add a post-build-task executing the .bat file
Done! Now every single time you start debugging/redebugging your app, the .bat file kills all node-zombie instances. And ditto for your stopping dubug moment.
The VSCode guide:
Perform step 1 of the algorithm above.
Open the file tasks.json in .vscode folder and prepend at top of its tasks the new one:
{
"label": "kill-node",
"command": "kill-node.bat"
},
Now alter the build task code (to activate our kill-node task at the pre-build time):
{
"label": "build",
"dependsOn": "kill-node", // <<< extra string to run kill-node task prior to build task
"command": "dotnet",
//... the rest of build task code
}
Open launch.json file and insert new string:
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"postDebugTask": "kill-node", // <<< extra string to run kill-node on debug end
//... the rest of launch.json file
}
}
That's it. Now you can no longer care of the node-zombie instances consuming your memory.
This should be fixed in ASP.NET Core 5.0, try upgrading if possible.

Can't deploy UWP app to xbox one

So I have setup my Xbox One as a dev device and actually was able to run my app on my Xbox, but in order to use some new APIs to turn off scaling and what not I had to change my app target version to Build 14332. Unfortunately, after doing this, I am now not able to publish or debug my app to my Xbox and I am not getting very helpful clues as to why not.
I even reverted the target version back to Build 10240 but I am still getting this error:
Severity Code Description Project File Line Suppression State
Error DEP0700 : Registration of the app failed. Deployment Register
operation with target volume C: on Package
MyCompany.MyApp_1.1.19.0_x64__5wbv4ypmprn7c from:
(AppxManifest.xml) failed with error 0x80070002. See
http://go.microsoft.com/fwlink/?LinkId=235160 for help diagnosing app
deployment issues. (0x80073cf9) MyCompany.MyApp
EDIT: I found a work around. Restart my Xbox One. Literally, every time I run my app, I have to restart my Xbox One! :(
I came across the same issue, and while restarting the console didn't help me, I did find another workaround: go to Dev Home and clicked Remove all Visual Studio pairings. I was able to deploy right after doing that.
I've ran into the really similar problem, however with running on the remote machine. The solution was the same as Pedro Pombeiro did on his Xbox One. I opened Windows Settings > Update & Security > For developers and Unpair All. Problem was solved and I could deploy and run the app on remote PC.

Debugging an ASP.NET app running on IIS express VS2012

I am using Windows 8 and Visual Studio 2012 to run an ASP.NET web application locally. Problem is I can't figure out how to attach the debugger. I tried debug>start debugging but it gives me the following error...
I added a breakpoint in my code and tried starting/hitting site, but no dice. I also checked my project and ensured ASP.NET debugging was checked and confirmed the proper config in my web.xml.
Any ideas?
Update:
Ok I can attach to the process using the following....
But it still says my symbols have not been generated...
And when I try to connect to iisexpress instead I see...
You need to attach the debugger to iisexpress.exe. Although this worked for me it did throw up an error at first so my assumption is that it can just be ignored. I am marking this as the solution for now, however, if someone comes up with a better answer I will switch.
It looks like you are trying to start a library project and not an asp.net project.
Do you have more than one project in your solution? Try right clicking your project file and clicking 'set as start up project' and debugging it again.
If you only have the one project in your solution, or you are sure the right project is set as the start up project, then you probably created the wrong project type for it. Create an asp.net project and move your files over into that.
Make sure your project is a asp.net project. If it is, right click on the project and select "set as startup project", then try running it.

Eqatec profiler-reset counter and take snapshot buttons disabled

I'm trying to use EQATEC Profiler to profile my ASP.Net app. I am following the below steps to do it. I have selected the application's bin folder in App path and clicked on the build button. Then I have run the application from visual studio 2005. However, i don't see the reset counter or take snapshot buttons enabled. Please help.
You'll find a nice step-by-step instruction and explanation in this thread.
I may also have an explanation of what's going wrong for you:
You compile your asp.net app in VS2005 - fine
You then instrument and overwrite your app using Build in the profiler - also fine
But then you run your app from VS2005 and that may re-compile your app again so you're running an un-instrumented version. Instead of running it from VS2005 you should simply have IIS "launch" the code by navigating to the corresponding webpage.
If this is not the problem then take a look at the log-file generated by the running, profiled app. By default the log-file is located in C:\Windows\Temp\EQATECProfilerLogs\profiler.log.

Resources