Skip to content
Xamarin C# HotReloading
C# Smalltalk Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Build
ConsoleApp1
Core
Forms
IDE
POC
Samples
gif
nuget
.gitignore
HotReloading.Build.sln
HotReloading.Mac.sln
HotReloading.Windows.sln
HotReloading.sln
LICENSE
README.md

README.md

C# HOT-RELOADING

Allow Developer to Update C# code at runtime

preview

Current Features

  1. Update exiting methods and preview the changes.
  2. Add new methods.
  3. Create View from C# and see the changes immediately.
  4. Update business logic at while app is running.
  5. Write Custom Renderers while app is running.

SETUP

VS for MAC

Download HotReloading extension from extension manager or directly from here: http://addins.monodevelop.com/Project/Index/377

VS for Window

Extension will be available soon.

Code Setup

  1. Install pre-release HotReloading NuGet package on all your project where you want to support Hot-Reloading
  2. Install pre-release HotReloading.Forms NuGet package on all platform project and Xamarin.Forms project which has App.xaml.cs
  3. Call Initializer.Init() on each project
//Xamarin.Forms
public partial class App : Application
    {
        .......................

        protected override void OnStart()
        {
#if DEBUG
            HotReloading.Forms.Initialiser.Init();
#endif
        }
        .......................
    }
    
//Xamarin.Android
protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

#if DEBUG
            HotReloading.Android.Initialiser.Init(this, savedInstanceState);
#endif

            LoadApplication(new App());
        }
        
//Xamarin.iOS
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            global::Xamarin.Forms.Forms.Init();

#if DEBUG
            HotReloading.iOS.Initialiser.Init();
#endif

            LoadApplication(new App());

            return base.FinishedLaunching(app, options);
        }

Android Emulator Setup

To run it in the android emulator you will have to reverse the TCP port 8555 so the emulator can reach the IDE when connection to localhost:8555

$ adb reverse tcp:8555 tcp:8555

Demo

https://youtu.be/nG2JSg-vZyk

Contribution

Feel free to create issue and feature request. It is just first version of the tool and with the support of community we can extend it to full fledged hot-reloading. You can also connect with me on gitter to discuss anything regarding this tool.

Attribution

Special thanks to @bartdesmet because of his work on ExpressionFutures I was able to add support for async/await. Also thanks to @ylatuya I used his work on XAMLator to established communication between IDE and devices.

You can’t perform that action at this time.