Code Monkey home page Code Monkey logo

binoculars's Introduction

readme

This is a quick project to test how dotnet watch works in order to determine whether it would be a good candidate for code hot swapping. Sample usage: https://docs.microsoft.com/en-us/aspnet/core/tutorials/dotnet-watch?view=aspnetcore-6.0

Tu run:

dotnet watch run --project BinocularsHost/BinocularsHost.fsproj

conclusion

The tool is not for hot-swapping dependencies written in F#. It does however works correctly for C# code. Further explanation:

  1. C# host + F# library: cold swap
  2. C# host + C# library: hot swap
  3. F# host + F# library: cold swap

illustrations

C# host + F# library or F# host + F# library:

watch : Started
0.      PID: 3798 - Hello, Piotr!
1.      PID: 3798 - Hello, Piotr!
watch : File changed: /Users/justpi01/Documents/code/binoculars/BinocularsLib/Library.fs.
watch : Do you want to restart your app - Yes (y) / No (n) / Always (a) / Never (v)?
2.      PID: 3798 - Hello, Piotr!
3.      PID: 3798 - Hello, Piotr!
4.      PID: 3798 - Hello, Piotr!
watch : Hot reload suspended. To continue hot reload, press "Ctrl + R".
5.      PID: 3798 - Hello, Piotr!
watch : Building...
  BinocularsLib -> /Users/justpi01/Documents/code/binoculars/BinocularsLib/bin/Debug/net6.0/BinocularsLib.dll
  BinocularsHostCS1 -> /Users/justpi01/Documents/code/binoculars/BinocularsHostCS1/bin/Debug/net6.0/BinocularsHostCS1.dll
watch : Started
0.      PID: 3817 - Hello, Piotr!!
1.      PID: 3817 - Hello, Piotr!!
2.      PID: 3817 - Hello, Piotr!!

C# host + C# library:

watch : Started
0.      PID: 3503 - Hello, Piotr!!
1.      PID: 3503 - Hello, Piotr!!
watch : File changed: /Users/justpi01/Documents/code/binoculars/BinocularsLibCS/Library.cs.
2.      PID: 3503 - Hello, Piotr!!
3.      PID: 3503 - Hello, Piotr!!
4.      PID: 3503 - Hello, Piotr!!
watch : Hot reload of changes succeeded.
5.      PID: 3503 - Hello, Piotr!
6.      PID: 3503 - Hello, Piotr!
7.      PID: 3503 - Hello, Piotr!
8.      PID: 3503 - Hello, Piotr!

post mortem

There is one idea I still want to try. What I've been trying so far was hot reloads triggered by changes to the source code of the dependencies. I want to explore running a published version of the host (C#) with a watch and dropping in a compiled F# dll. Let's see if that works and that is what I'm currently exploring.

binoculars's People

Contributors

piotrjustyna avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

bogdanbabiy

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.