Coding Shorts: Ahead-of-Time Compilation in C# (AOT)

Поділитися
Вставка
  • Опубліковано 6 лип 2024
  • I've been looking at Source Generators as a solution to reflection. This is important for AOT compilation. So, I thought it might be useful to see what AOT is all about:
    00:00 Introduciton
    00:37 Compiling C#
    01:30 Using ILSpy
    02:19 Viewing IL
    03:59 Self Contained Compilation
    05:22 Publishing in AOT
    06:51 AOT Results
    09:05 Wrapping It Up
    Project Repo:
    github.com/shawnwildermuth/co...
    If you like this video, you might like other videos in my Instructional Videos:
    - • Instructional Videos
  • Наука та технологія

КОМЕНТАРІ • 14

  • @javier-capello
    @javier-capello Місяць тому +9

    This is, by far, the best C# channel in UA-cam!

  • @lyudmilpetrov79
    @lyudmilpetrov79 Місяць тому +5

    Thank you so much Shawn for your knowledge spread, I have always enjoyed your teaching while back on Pluralsight as well. all the best

  • @heavypeki
    @heavypeki Місяць тому +1

    Best guy on internet ever. I listened to Shawn live, he is amazing lecturer.

    • @swildermuth
      @swildermuth  Місяць тому +1

      I never get sick of hearing that. In all honesty, I'm touched by your comment.

  • @PortalUser2
    @PortalUser2 Місяць тому +1

    Love these videos Shawn.

  • @davestorm6718
    @davestorm6718 Місяць тому

    How would you compile AOT for a particular container if it's not on your dev machine?

    • @swildermuth
      @swildermuth  Місяць тому +1

      Probably need to compile it in a VM, WSL or in a container.

  • @MohammadKomaei
    @MohammadKomaei Місяць тому

    Please make a video for AOT publishing a blazor webapp to windows server and iis.

    • @swildermuth
      @swildermuth  Місяць тому

      Two things I don't mess with: Blazor and IIS. Sorry I just don't know enough to do it justice.

    • @MohammadKomaei
      @MohammadKomaei Місяць тому

      @@swildermuth What about .net web (razor pages) project?

  • @ghaf222
    @ghaf222 Місяць тому

    I had a look at AOT a few months back. In my applications I often serialise and deserialise to/from JSON and I was shocked that this doesn’t just work in AOT, e.g. even serialising an integer to JSON will fail. You need to take some extra steps to make this work, which is fine, but it scared me away for the time being!

    • @swildermuth
      @swildermuth  Місяць тому +1

      That's fair. System.Text.Json uses a fair bit of reflection. I believe they're working on making it compatible.

    • @ghaf222
      @ghaf222 Місяць тому

      My main issue was that despite the JSON stuff not working without changes the code did compile, and I only found out when I ran the release version. This made me worry about what else might not be working. But certainly I hope to come back to it at some point.