IsolatedStorageSettings life cycle in Windows Phone 8 - windows-phone-8

I'm developing a windows phone 8 application. I want to store app related things like configuration settings, usernames, passwords etc. inside the application. For that I'm using IsolatedStorageSettings class.
Problems:
When I clean the project and run in on the emulator, all stored values are gone.
When I close the emulator and run it again, all stored values are gone.
Can someone please explain me why is this happening and how can I store them permanently?

This is default behavior of emulator. It is like simulation in memory to test debug app. it does not persist data/app on the emulator when you close it. And when you run the project again(emulator is not running) VS will lunch the emulator and reinstall the app again. that is why you do not find previously stored data in you isolated storage.
And same is in the case of cleaning your project. Your app will be re installed on the emulator so all the previously persisted data on Isolated storage will be lost.
In your case I will recommend to use device for debugging.
Hope this helps.

Related

Runtime Exception in windows build

I am able to generate & install windows phone build in my Microsoft Lumia 640. Its running on Windows OS 8.1.
But as soon as I run application generated by CN1 build server, it gives error
An internal application error occurred: java.lang.RuntimeException Unsupported operation as per below screen shot.
For a testing purpose I created new CN1 Project and without changing any code / theme.res I just sent windows phone build and it ended up with the same error.
Unfortunately I didnt get any log output from windows phone, as it doesnt support Logcat like Android. Also I tried to grab Isolated Storage by WP Power Tools but there was nothing in it.
Anyone faced / facing this in Codename One windows phone build ?
The Windows Phone port is the least mature of the Codename One ports having gone thru 3 rewrites due to changes from Microsoft.
We are now debating the 4th rewrite, in the meantime some community members did their own port which should be more complete:
https://github.com/Pmovil/CN1WindowsPort
So as the short answer I suggest using that. For an explanation on how we got here read on.
The reason we didn't already start with the 4th port was Microsofts project astoria that they suddenly (might have) canceled. We were relying on this project for future Windows Phone support but now that its status is unclear we are in a bind.
We also have the JavaScript port & the Windows desktop port as options for targeting windows phone alleviating some of the problem.
If MS cancels the project for good we'll dedicate the resources for a complete rewrite of the port, but that will take time. However, we don't want to start off on such a huge effort and suddenly be faced with a huge shortcut of Android compatibility.

Using ProcMon on Windows Phone Emulator

I have a Windows Phone 8.1 project that refers to a Windows Runtime Component, which exposes some other native projects of mine. The problem is I get a System.IO.FileNotFoundException when running it on emulator. However, if I catch the exception and check exception.FileName, it's null.
The guy here has mentioned he used ProcMon to figure out which file was missing. How do I use ProcMon to monitor file accesses made by an emulator? I tried monitoring the emulator process itself, but that didn't produce any info.
There is no way provided to run desktop apps such as ProcMon on the emulator. The linked post was able to run ProcMon on Windows, not on Windows Phone.
Your best bet is to debug the app running on the emulator. Use the unmanaged debugger so it can break in the native code, break on the first chance exception, then see where in the stack this is called from. Once you know where the problem is, you can set a break point at the beginning of the function then either step through or set a trace point to see what files are being used and what the app thinks it is doing then.

Windows (phone) emulator 8.1/10 stuck at loading the OS

I've been trying to get the emulator to work for days. Previously I tried the Windows Phone 8.1 Emulator as well as the Windows 8.1 Simulator and both were stuck at loading the OS.
Earlier today I installed the new Windows 10 Tools and thought I should give it another try with the new Windows 10 Emulator... And no, still the same result.
What's strange is that, the Hyper-V Manager seems to be doing OK. I can see the app displays correctly on the little Preview window (see the box on the left side of the picture below).
Also, breakpoints are hit, the project seems to be running OK.
As many answers have already suggested, I tried letting it running for an hour, but still nothing came up.
Things that I've also tried include uninstalling all the Virtual Machines as well as repairing the WP 8.1 Emulator, nothing has worked so far.
Please help, this has driven me completely insane. :(
Update
Not sure if this would help, but if I change the Windows Phone Emulator Internal Switch to use Private network instead of Internal, I will get a couple of warnings saying Unable to determine the Host IP address and then the Emulator will show up with the Emergency Call screen. Not much I can do from there as the three buttons on the bottom are not functioning at all.
I understand that changing the connection type is not the right way to do it, but this at least tells me that the Emulator can work, it's just a matter of how.
I believe you have two Windows Phone Internal Switch connections and one seems to be unplugged while the other is running. Disable the one that is unplugged and leave the latter. This worked for me after 2days of tinkering. God speed.
Try the following.
Open the Hyper-V Manager
In the Actions pane, click Hyper-V Settings
In the Server pane, select Physical GPUs
Uncheck, Use this GPU with RemoteFX
Click OK to save/close.
Attempt to start the Windows Phone emulator VM from within Hyper-V Manager or Visual Studio.
I solved this problem by simply adding XDE.EXE as an exception to my Windows Firewall.
Just today
Many times it is not stuck. It just does take too long to start. I have an 8 core processor and it took like 5 minutes to launch, I tought it was stuck but it did launch.
Not sure if this would help, but if I change the Windows Phone
Emulator Internal Switch to use Private network instead of Internal, I
will get a couple of warnings saying Unable to determine the Host IP
address and then the Emulator will show up with the Emergency Call
screen. Not much I can do from there as the three buttons on the
bottom are not functioning at all.
when you set it to private network, Windows can't interact with your WP Emulator. Open Network Adapter, and try disable and try start emulator again, then enable again this adapter if it is not work *
I contacted the Visual Studio Team a couple of weeks ago and looks like they have fixed this issue in the latest update. And here is how I finally got it all working.
Update your Windows 10 TP to the latest version (currently 10074).
Install the latest Visual Studio 2015 (currently RC).
Install Windows 10 developer tools preview from here (I got
some weird errors with Error code: -2147023294. Ignore them, go
straight to the next step).
Install the standalone Windows SDK for Windows 10 Insider
Preview from here.
Install the Pre-release Microsoft Emulator for Windows 10 Mobile
from here.
That's all! After all these are done, both my Simulator and Emulator are loading up fine.
In my case, deleting the internal switch from Hyper-V virtual switch manager helps, whenever you run your app using emulator as the target, it'll add a new internal switch by itself and the emulator will run normally (no longer stuck on loading screen)
The problem is, I have to do it every single time I restart my PC
The workaround steps to install the Windows SDK and Emulator are no longer needed.
We have released a fix as of 7PM PDT 30 April 2015 for the setup error
Windows 10 SDK 10.0.10069 : The installer failed.
User cancelled installation. Error code: -2147023294"
New setups should no longer encounter this issue.
For existing installations, and for more information, see this forum post:
https://social.msdn.microsoft.com/Forums/en-US/17bc9d5e-2ea7-4149-bb75-23997db8bd25/
This worked for me:
Go to Windows Defender.
Add exclusion following path: "C:\Users\UserName\AppData\Local\Microsoft\XDE\YourEmulatorVersion"
YourEmulatorVersion - for example 10.0.14393.9
2 days, tried all that is posted here but nothing worked! Finally, since it is a lot easier nowadays to (re)install windows without loosing your files (3 hours including updates), I just resorted to that. Same thing happened, but then I saw the alert that I had not yet activated my VS to run in developer mode :) Did that, and voila, the emulator now works.
If this might be helpful: my problem started when I installed Android Studio and disabled Hyper-V from Android. Enabling it back for VS just couldn't get me to run it again. But I hear there is a way to run both Android & VS emulators using VS emulator for Android. I will try to see how that works later...
I know the question is old, but none of the above answers worked for me so I write down my two cents:
Go to Hyper-V console and remove all emulators
Go to Devices Management, under network adapters tree node, delete all virtual switches
Run an emulator from Visual Studio and see the magic happen

Information lost after close and start again emulator

On my windows phone 8 emulator, when I close the emulator, all the information like contacts or the apps installed in it get removed automatically, why? And is there get back all these things after close emulator start again.
Kindly suggest me, waiting for your reply.
Thanks.
The Windows Phone emulator 'simulates' you an absolutely fresh out of the box Windows Phone device. It is the best way to make sure that you app will run on any device. In fact this emulator is a Hyper-V machnine that quickly installs itsself everytime you launch it and deletes all the data everytime you close it.
Unfortunately there is no way to restore a previous state.
If you need specific data and settings across different debug sessions you will need to keep the emulator opened.

getting "App deployment failed. Please try again. " while running Windows phone 8 emulator

I am developing Windows phone 8 app. When I try to run the emulator of WXGA or 720p I am constantly getting this error. Searching regarding this error leads to the conculsion that I should not run more and more app parallely. So I ran only VS2012 then also getting the error. I am having enough 4GB of RAM then also having problem. My friend's PC has 2 GB of RAM then also it works flawlessly in it. Anyone know what's the issue & best practice to run the emulator smoothly?
PS : I don't have REAL Windows Phone device :(
Just try rebooting your Windows 8 Phone. I just had the same issue, and rebooting worked for me while deploying on device.
Please ensure you have following to get rid of the error,
Minimum Hardware/software requirements (https://dev.windowsphone.com/en-us/oem?contentName=docs%2FGetting_Started%2FPreparing_for_Windows_Phone_development)
Valid developer license/account to develop windows phone applications
Enough free RAM (>2GB RAM should be free)
Not more than one instance of VS is trying to use same emulator.
If everything is holds good then try following,
Restart emulator & check if it fixed the issue, if not go to next step.
Go to Hyper-V manager and delete all the virtual switches related to WP. If it doesn't fix issue go to next step.
Go to Hyper-V manager and delete all the windows phone virtual machines. repair WP SDK from control panel.
More info about troubleshooting errors like this can be found at https://social.msdn.microsoft.com/Forums/windowsapps/en-US/b06cc9f2-aa5e-4cb3-9df1-0c273e1dfd68/wp8-emulator-xde-troubleshooting-tips?forum=wptools :)
In worst case, you will have to uninstall & install WP SDK.
Hope it helps.
The emulator may not work when its dedicated requirements are not perfectly matched. Emulator Requirements
You can always try deploying an app by selecting 'Device' in the emulator which will actually deploy the app on your phone and you can test it out.
note: Make sure you're using the right version of app which is to be deployed in its righteous OS version.
Also try to restart your emulator/device
Well. This might be happens because of some inner problems of Emulator. Because even me too faced this same problem some days ago. So, let me tel you what I have did and how I got rid of that problem. So, try as per my instruction and if this works. Just Mark it as an answer. else, comment what you have got after.
Check all Emulator VGA and VXGA and 720p
After you got that error, just tap Ok or Cancel in the dialog box and go to
Open Emulator -> Strat Screen will be shown -> goto All Apps -> Check your app name (It will exist and open your app and take screenshots)
I am sure this will be works for you.
Only restart the device or the emulator and the deployment will success