I'm working on an app for Windows Phone 8 and I'm debugging it on my Nokia Lumia 925. But every time I press F5, the XAML code stays the same while my c# code refreshes - so I've got the new code, but the UI is the same. I have to reinstall the app every time to get the changes on my phone.
Any ideas how I could fix that? Thanks!
Each time you debug, make sure to first Rebuild the app. Also you may encounter issues such as "Symbols not loaded" from the ".pdb" extension in your debug folder. In that case you can do two things to resolve the issue:
Goto your project's Bin/Debugfolder and delete all the items.
Or just do Clean Solution each time before you debug the app.
In this way, you can deploy the most updated version of your code into your Emulator/Device and avoid any missing symbols errors. Hope that helps.
Related
I'm running my .NET 4.0 (C#) project in debug mode after I start VS2013. It runs just fine.
The second time I start it from VS, I get the Dialog box that says "Error while trying to run project: Unable to start program C:\path\to\file.exe"
The process is still alive in the Taskmanager when I dismiss the dialog box.
From Windows Explorer, I can run the program just fine. And after closing it, the process is gone too from the Task Manager.
A rebuild doesn't help.
Is this a common problem with a known solution?
I had an issue similar to this and I had to clear the component cache instruction can be found Here.
Hope this helps.
For my case, it cause by Platform target, you could force choose it to x86 or x64 which your project is:
Each Project's Properties > Build > Platform target
As I pointed out also here, the only solution that worked for me was to disable the ConEmu integration:
ConEmu → Settings → Integration → Default term → disable Force ConEmu as default terminal for console applications
Some users reported that it was enough for them to disable the Aggressive mode in that same settings tab; that wasn't the case for me though.
The topic is old, but this might help someone else.
So in my case I made a file in Visual Studio with .cp extension (accidentally deleted the last 'p') this made visual studio just "include" the the file and not mark it as a compilation unit, thus not compiling it, I looked the *.vcxproj file in a text editor and found out about this, so if you open the project file in a notepad or something just find your file at the bottom usually and change from <Item .../> to <ClCompile .../>
I was getting similar errors. I just had to restart visual studio. Sometime couple times a day.
I had a similar error and resolved it by cleaning the solution. Right-click the solution name in Solution Explorer and choose Clean Solution.
I found a solution here:
Please check "Use Managed Compatibility Mode" under Tools|->Options->Debugging->General.
I'm Brazilian, I don't speak English very well. I did this translation on google translator.
I know the topic is old, but it can still help someone.
I had this same problem in the following situation, I have a dual boot computer (linux debian 11 and windows 10). Inside debian, on my NTFS D disk, I created a folder to perform programming tests. After accessing that same folder with windows, I created a new project in visual studio inside that same folder that I had created in linux. The creation of the project went without problems, however when I tried to run the project (F5), I received the same error from this topic. I tried all the solutions I found on the internet, and nothing worked. I gave all permissions to my admin user and it still didn't work. Then I realized that even going straight to the folder where the application's executable was and clicking directly on it, I still received the access denied error message. So, I took the project out of the folder I had created in linux, and it worked. So, what I could conclude, is that because the folder where my project was was created in linux, for some reason, my windows didn't trust this folder, so it didn't allow running executables from inside that folder, even this one executable having been created by visual studio from within windows.
Just simply create a folder name as "projects" in c drive and copy paste the newly created project in it. Run the project by doing clean & Build or Rebuild method . It will work
open the folder which contains the solution in visual studio.
again, open your *.sln file by double clicking it inside the solution explore once opened try running the solution or rebuild the solution. once rebuild gets completed, it will open without error from next time.
My way of solving the error : error while trying to load project : Unable to start program and c:\Path\to\file.exe was simply by
First restart Visual Studio
Click the build icon
Select the rebuild option
Run the Program or Debug the Program
This was a weird one. Going to put what happened to me here because it might happen to someone else. Everything was fine with the app until suddenly after some fairly insignificant code changes I suddenly started getting this error. Visual Studio was compiling the executable just fine. But, the moment I tried to run it (either from Visual Studio or directly) the executable file would be automatically deleted right out of the Debug folder. Super odd--never seen anything like it. I began to get suspicious that perhaps an anti-virus or the OS was somehow identifying a checksum or some signature in the executable as "dangerous". Or perhaps some obscure compilation bug was corrupting the executable. So on a hunch I made another innocuous change (added a couple of lines of code to color code some text in a rich text box) and the problem went away.
The root of the problem is perfectly explained here (mind you, my question is different from what can be found in this post): Xamarin - Android - Visual Studio - The application could not be started
In my particular case:
Debug from PC1: everything OK
Debug from PC2 without uninstalling debug app from PC1: the error appears for the first time
Try everything to avoid this error. The app cannot be found in the phone, I deleted the files manually as one post suggested (this might have been a mistake). No "myAppName" files can be found in my phone.
So I have decided to trick Android into thinking it is a different app, and this is what my question is about.
I have changed everything I found in the project (namespace, blah blah) from "myAppName" to "slightlyDifferentAppName" but the problem persists... I have debugged different projects form PC2 and they work, which makes me think it is a "collision" between different signatures of the same app (because otherwise it makes no sense that it worked in PC1 and not in PC2).
My question is: what can I tweak in Visual Studio in order to trick Android into thinking it is a different app?
I'm trying to set up a new Android app development environment at home and I've run into a problem that is a showstopper.
First, here is my environment:
Windows 10
Visual Studio Community 2015 with Xamarin platform installed
Test device is: G Pad 7.0 LTE
Android Version 5.0.2
I'm following this tutorial: MSDN tutorial
When I go to debug my test app, here is what happens.
Select debug from Visual Studio with my tablet as the target
VS deploys to the tablet
App starts on the tablet
App and debug session runs for about 5-10 seconds.
Debug session ends and app closes
No errors are displayed in Visual Studio and when i turn on Android logging it's a such a massive overflow of information that I don't really know where to begin searching for a problem.
Please also note that when I first set up the app, according to the tutorial, debugging on the tablet worked fine. The initial build is simply a template with a few basic controls.
In between then and when it stopped working I also added and successfully tested a Windows Phone project on a Windows Phone device.
Once I got to the section where I was modifying the project is when the problem started. I thought that perhaps a change in the code I did caused this issue so I tried another blank app and that blank app now crashes as well.
When I deploy the tutorial app to an emulator it crashes immediately but when I deploy a blank app it doesn't crash.
I also tried restoring the tablet to factory defaults and testing again. Same scenario: Blank app and tutorial app run for a few seconds, debugging stops, app closes.
Any clue as to what type of problem I'm looking at?
Solution
Clean your project (Right-Click on Project and select clean)
Go to your build folder. Probably in your Android project's root folder, named "obj". Delete either build you had, when you ran into this behavior (Debug or Release).
Directory Path
./AndroidProject/obj/Debug
./AndroidProject/obj/Release
Restart Visual Studio
Build and run again and it should work just fine, as the md5-hashes are now matching again.
I had also uninstalled the app before from the device and restarted it, I don't know whether this is required anymore, because the app is now being "reinstalled" by newer Xamarin versions anyway.
adb uninstall com.your.domain
Story and Background information
Have had the same issue with a device running Android 5.0.
Basically, the app was just stopping without any note.
When I now restarted the phone, The log was extended (once) by the following line:
Device could not find component named: *com.your.domain*/{*md5hash*}.*{Activity}
It turns out that with Andrpod 5.0 a hashing mechanism was implemented:
With the 5.0 release, the default package names for Android Callable
Wrappers will be based on the MD5SUM of the assembly-qualified name of
the type being exported. This allows the same fully-qualified name to
be provided from two different assemblies and not get a packaging
error.
See this for further information Xamarin.Android 5.1
So, if the md5-hash now changes from time to time, a simple Clean of your project is not enough.
I ran into this same issue and applied the same solution described above many times, which seemed to remedy this particular problem.
A possibly related fix, but definitely worthwhile note
After releasing this Android app and later releasing updates to the app, we got feedback from users that their Android Home screen shortcut to the app was disappearing after each app update. This is not good, for obvious reasons, but the fix for it was very simple as noted here:
dream-team-mobile-blog - Android app removes shortcut on update Xamarin solution
On the main activity, set a Name attribute of
<your package>.<your main activity>
like:
com.mycompany.myapp.MainActivity
For my solution, I chose to do it in code like this:
[Activity(Name = Constants.PackageName + "." + nameof(MainActivity),
Label = Constants.AppIconTitle, Icon = "#drawable/icon",
Theme = "#style/splashscreen", MainLauncher = true,
LaunchMode = LaunchMode.SingleInstance,
ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
//Side Note: I change my PackageName between Prod and SQA builds, so using
//a constant as seen above makes that change less risky to miss maintaining.
//Also, using nameof() keeps things tight and a sure match.
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
I mention it here in this post because, having this fix in place may have:
definitely prevented app shortcut loss and
possibly prevented the issue discussed in this post
as the MD5 hash prefix from the Main activity seems to no longer be generated.
This tweak may fix two bugs with one fix. If not, implementing a fixed main Activity Name will surely help your users keep their shortcut to your app when you release updates!
What fixed it for me in Visual Studio 2017 is going to :
Tools → Options → Xamarin → Android Settings
and uncheck:
Preserve Application data cache on device between deploys
go to your AndroidManifest.xml and change your package name.
I am developing an app for Windows Phone 8 with C#
And I've been working alot with MessageBox.Show() , and All the time it used to show a PopUp message like i wanted , but then suddenly , it Won't show anything , I debugged the app , the code runs normally and compiles the Line MessageBox.Show("Something");
but it doesn't pop up !
I also tried to put it in another page , doesn't work too !
All i remember that yesterday I have messed with References of the Project
But is that the problem ?
Anyways here's a photo of the references of my Project
When you build a Windows Phone Project it automatically generates all the required dependencies for you. You should be able to in your class file and add the following using statement:
using System.Windows
Once you've done that you'll be able to implement the MessageBox class. If not, then you'll need to do the following:
Open Solution Explorer
Right Click Reference Folder
Add Reference
Go to Assemblies
Go to Browse
Navigate to: C:\Windows\Microsoft.Net\Assembly\GAC_MSIL\PresentationFramework
Reference PresentationFramework.dll
Once you've referenced that library, you'll be able to call: MessageBox.Show(#"Something"); without a single hiccup.
Solved!
1.) Restarted my computer
2.) Deleted the app from the phone
3.) Debug
I had a problem with MessageBox.Show() not working.
It happened on two different pieces of software: Kaxaml, and an example from the Troelsen C# book.
I troubleshot it by just using a simple string inside the Show() instead of the "Exception" delegate in different spots in the code, and that helped tell me that I had the right references. Obviously, if MessageBox worked in any place in the code at all, that told me I had the correct references.
Basically, what was happening was the Visual Studio debugger would fire before the catch-try blocks, preventing the MessageBox from ever appearing. When I used the Release version, there would be no MessageBox either though.
What solved it was by just turning off a little click-box that said on Visual Studio, something like, "Don't show this exception". Kind of odd that Visual Studio still fired off an exception error, even though it was in a catch-try block, but whatever, this worked for me.
Is there a way to debug a Windows Store app downloaded from the store? I have the source code from the build I uploaded, but no breakpoints are working.
The reason I ask is that in-app purchases aren't working in the live store, but they work fine in test mode. I need to see the exception being thrown--which is caught by the app and printed to Debug.WriteLine, but I don't see it in the console either.
Ok, it works if you follow these steps:
Debug->Debug Installed App Package
Make sure that "Debug this code type:" says "Mixed (Managed and Native)"
Once I checked that box, it worked fine, but of course debugging was pretty slow.
PS - You also have to include the symbol files in the original build uploaded to the store. This is a good reason to always do this.