Refresh Xamarin View while debugging without rebuild of app - xamarin

In Visual Studio (2015) using an Android Emulator, is there a way I can make a minor update to a xaml view, and have that refreshed in the debugging application without having to rebuild and re-deploy the project?
Currently a build/deploy for debugging takes about 2 minutes, and having to make some minor UI style tweak and do the whole thing again is driving me nuts.
I suppose I'm asking if there's some ASP.NET MVC-like functionality where I can update a frontend file (cshtml, js, etc) and just refresh the page without reloading the project.

Xamarin Live Player lets you make live edits to your app and have those changes reflected live on your device. Your code runs inside the Xamarin Live Player app – there is no need to set up emulators or to use cables to deploy the code!
https://www.xamarin.com/live
It does have limitations, be sure to read the Limitation section:
https://developer.xamarin.com/guides/cross-platform/live

Related

Blazor app requires server restart every change I make

I'm developing on my localhost a new Blazor server-hosted app. I launch the template that it starts you out on... looks very nice. I change the text in the tag, refresh my browser... and no change. I refresh and refresh only to notice no change. Is something wrong?
Then I rebuild and rerun the app again and the change happened. Why do I have to restart the entire server for a small front-end change? I have to do this on every change I make? Even though the changes are for the front-end? If so, then the development experience for MVC apps is way better. I don't have to restart my server for changing the code for the front end.
I know dotnet watch exists, but it doesn't help. It still restarts the server for every change I make for the front-end. I have to wait like 10 seconds for just changing some CSS? Please tell me if I'm doing something wrong, or if this is by design.
Also, I tried the web-assembly version of Blazor. Same results.
I guess you are running the app with the debugger connected? this prevents the recompilation. You need to:
Press Ctrl-F5 to run the app without the debugger.
This should work on Windows using IIS, but on Mac "it's a bit more complex". According to a MSFT representative, they are planning on enabling this functionality for Mac users, but this info is already over a year old (from April 2020).
This issue still happens, and for me is a major downside. It doesn't make any sense to have to recompile entire project just because I changed some text on a page. If this is a design choice, it's doomed! Can't have a designer dependent on developers to recompile whenever a small change is required on simple html! Even if you change an element style you have to recompile!

Deployment of app to device failed

I have Xamarin Live Player up and running.
When I use it with a newly created Xamarin Forms (Master Details) app, it works fine. I see the app on the device.
However, when I try to run my full-blown app, Visual Studio tells me "Deployment to device failed. Make sure that Xamarin Live Player is open and that the device is in the same network."
Since the new app runs fine, I guess something else is the problem.
I've already set the Android project properties to be same as the newly created app.
Just to make sure, I've made it so that my full-blown app requests all rights.
How could I debug more in detail what's going wrong?
Xamarin Live Player can't run all apps. As soon as you use reflection, embedded resources, a MVVM framework or a custom renderer in Xamarin.Forms it might simply just not run the App.
You can read about the limitations of Xamarin Live Player in the official documentation for it.
You will probably have a much better experience just running directly on the device without Live Player.

Recommended way to debug Xamarin.ios webview js from Visual Studio?

With 3 levels of abstraction (VS->Mac, Mac->phone/simulator app, app->webview), I'm not sure where to start.
I have cross-plat Xamarin app with nothing more than a webview (in Xamarin.Forms) hosting an external website (I also created). The website & all hosted apps (Windows/Android) perform very well, except on ios-webview. (Safari on ios and phone work fine). However, on ios/hosted-app, a 3 second load takes 60+ seconds.
Hopefully without having to add specific console/debug messages, how do I go about seeing where (in javascript), the time is lost - or what the issue might be?
Thanks,

Is it possible to view output of visual studio cordova project as a web app in browser?

I am using Visual Studio 2015 tools for Apache Cordova for mobile application development on Windows 7.
To build and run my app, I have to choose one solution platform and one target.
Is there any way to view the output on my browser just like a web app with no emulator?
When I press f5, the result will open in a browser in an emulator mode which I choose as system platform and target device. But I want to run my app like a web application, when you right click on index.html and select view in browser.
I look for a project setting or a ‘system platform’ and ‘target device’ value that work like that.
PS:Selecting any windows solution platform and local machine target needs Windows 8 or higher and the build process is failed.
Thank you.
The solution I found for my problem:
I used the url of my output result with emulator: "http://localhost:4400/index.html?enableripple=cordova-3.0.0-NexusS"
and then removed the emulator settings in url: "http://localhost:4400/index.html".
Using this url will cause some popups asking some things. These are for 'cordova.js' script which is referenced in index.html file of cordova project. As we do not need this in browser, commenting the line <script src="cordova.js"></script> from index.html, no dialog will open any more and the project will compile so faster for initial design that do not need cordova.
Now I will use chrome mobile mode (f12-> phone icon) to see mobile view of my app.
#A.M.
The answer depend on your expectations.
If you just want to view the page layout and test some of the associated Javascript, the answer is YES.
If you want to test the plugin libraries and associated JS, the answers is NO.
However, here are some items to be cautious with - either way.
When running your code on a device, you MUST wait for the
'deviceready'. There are not ifs, ands, ors, or buts on this - you
must wait.
You can emulate some of the plugins. This Summer some of HTML5 APIs have become available. If you want to write a shim, you can emulate some plugins with the HTML5 APIs, and use the Phonegap plugins on the mobile device. NOTE: some emulators now support HTML5 APIs.
Not all browsers are equal and not all webview libraries are equal. Cordova and Phonegap both use a webview library with their respective platforms. On Android, it is called Webview. On iOS, it is WKWebview. These libraries are finally starting to get some attention. So Google, Apple, Intel and others are all making competing libraries. *better for us* ;) One new library for Android is called crosswalk. Many developers like it, but it is bloated.
Best of Luck

Enabling editing code while the app is running in Visual Studio (WP8)

I am developing Windows Phone 8 apps with Visual Studio and not being able to change the code while the app is running makes me crazy. I fall for it everytime. Trying to change the code before stopping debugging.
Tools > Options > Edit and Continue => I unchecked Enable Edit and Continue.
With above steps, I was able to change the code while the app is running but now I can't change design. How can I enable design editing while the app is running, too?
There is a very simple way of editing the design without ever running the app. If you open your solution in Blend, you can app sample data to your bound views based off the classes that they bind to. Then when you make changes in the XAML, they will update in the design view with the sample data.
http://blogs.msdn.com/b/pakistan/archive/2013/08/29/using-sampledata-in-windows-phone-8-using-blend.aspx

Resources