Showing posts with label up. Show all posts
Showing posts with label up. Show all posts

Wednesday, 23 October 2024

Build Time Reflection with C++ in Year 2023 Pure Virtual C++ 2023

so next up Gabriel dostri is going to tell us about build time reflection with C plus plus in the year 2023 hey Gabby welcome thank you for coming once again have you have you been a talk every year so far I think you have yeah I'm I'm happy to uh to do it you know I'm passionate about it and uh and modules then you know anytime okay well I'll take it away okay so um you've you know as you know I've been talking about modules since uh 2015. and back then I've been busy telling everybody oh modules are great modules are truly an opportunity and uh and and that kind of stuff so today um I wanted to briefly uh tell you some of the awesome things that you can do with modules not just because your code looks better but what you can do with let's say left over of modules not real level but build artifact when you when you build your modules the compiler generates a bunch of satellite files information that it uses to process the rest of um of the program and and that build artifact is not just good for the compiler it can actually be good for you and one of the things you can do with it is to have your own reflection um I know that in the C plus plus Community we have been wanting to have a study reflection for for a while now and uh you know in my private take another couple of years or more before we get it but in between now and then what can you do so here I wanted to tell you you can do a lot of stuff um that don't actually need an upgraded compiler so so a reflection you know when a notion of reflection is just the ability of the program to uh examine query uh introspects and and not just that but also manipulates uh its own States and and structures and and behavior based on the questions that it asks itself and that's quite fairly General and some degree uh abstract but when you look at that definition you have the notion of you know introspection which is just really good query not modifying anything at all and and and indeed introspection is is just that part of uh reflection and some people say oh no you know introspection is not reflection but you know um it's usually is easier to implement uh you know we already have that in C plus plus and yeah of course you have it in other languages but in C plus for example you have um uh runtime tab information when you use tap ID on an expression or a type the compiler uh created data structure uh that it embeds in your program and then at the wrong time you can query the type and a bunch of other stuff um it's it it's something that's quite nice and you know allows um expression or something ideas that's quite easy to do as long as it is well supported when it's not well supported that's where you get a bunch of stuff so the general idea of of reflection introspection there are Notions that can be practiced at any stage of the uh development of of a program whether it is uh during pre-processing stage you know that you can use uh the string signification operator from the macro preprocessor to get the string of of a name right and and you can do concatenation so you can actually it builds more and more stuff and um you know in program you can use straight we've been using trades since uh C plus plus 11 you can query states of the of of a type or an expression an object decal type is one of those uh introspection uh operator same is no except wood and expression Ray is an exception for example so those are properties of a fixation and then of course you have runtime Behavior if you perform a dynamic cast for example that's during program execution and and the the compiler is required to generate data that embed your program in executable and and runtime it carries some operations try to find the right uh type that you cast into and and people will tell you well you know reflection is great but it doesn't it's not free it costs it costs stuff like compiler really has to embed something in your program and that can be a gigabytes so sometimes you will say Yeah in fraction is great but I'm not ready to pay the price for the additional uh you know object size increase that okay at runtime um I'm gonna Hannah cassette uh we have been waiting for uh some notion of static reflection for a very long time and some people are tired we have systems deployed that have their own meta protocol if you know the cute uh GUI system framework for example you know that it has the mooc compiler that nanometer objects compiler that look at your program and then generate supporting infrastructure to make sure that your slot and signals are connected and everything is is working uh properly that's just one one example um so if it has been taking that long to do how hard is it really I it's a type you know just associative value how how can that be the um the truth of the matter is that um if we just look at introspection for example runtime introspection um you know we have runtime RTI for example or any exceptions you can think of them as some kind of continuation uh the where you have program points State program point I want to jump back to uh later and then turn that to data that that you manipulate well what I'm doing here that is is it hinders optimizations right the compiler can't reason saying oh this thing exists there I know the structure and I can come back to it otherwise when I come back to it I can right away uh inline it or or move codes around and so forth so a cost and and furthermore uh you know one of the debates in the C plus plus Community is whether you should ever um enable exceptions or uh rcgi at all you know like type IG because well it you know it makes your program bigger yeah so we know we have uh evidence that a poor implementation of these facilities can actually be detrimental to actual adoption and it takes time and efforts to implement these things properly so it's it's non-trivial uh uh you know investment to make um now when we're talking about reflection so remember in introspection is just ability to query observing without changing the the state but reflection you not only doing query but you also want to modify the behavior of the program or generate new stuff based on what what's the well it's enough magnitude at least much more difficult uh you know in terms of deployment implementations and and so forth and once you have a you know reasonably good um reflection system in place it becomes much harder to evolve the um the language because well some of the construct that you knew when the program was compiled they were turn into Data embedded and if later you embedded in your executable if later somehow you you bring in component that was compile in the future or in the past and they do not agree on on on the protocol while you get into real trouble so once you have reflection in there and features or functionalities that are reflected become much harder to to evolve properly uh so that lead to people to say well we don't really want runtime reflection because you know we know it makes the executor much bigger and and it has much of her stuff well we just want static reflection which just means that during compilation um you know the we noticed that compiler already has those information as it's under this structure we just want to be able to um poke a little bit and then ask the compiler to generate a little bit more code but based on what is known at the time of compilation so the revolution problem is probably more reduced but you still have you know substantial work to do on a compiler so we know compiler writers C plus compiler writers we can fit them in a room and then we have millions of C plus programmers so if you can just get a couple of people suffer for they create a good of everybody else so be it so that that's good and having studying reflection you know mitigate you know many of the drawbacks that I mentioned earlier including performance and and space which is part of why uh the the standards committee and and the community as a whole have been pushing for for this for this notion um here to talk about real-time reflection and and and not static reflection and and some people are rightfully say why the hell is this thing that I'm talking about well it is not a new language feature it is not what it is is just um not making no just being you know very responsible with the resources that we have so the idea is that um as we're building the program you know during build time we we generate build artifacts and we would like to be able to augment the program the final program with uh information that we know during build time so we can generate new codes uh that gets compiled and linked with you know the the rest of the the object file that already exists to create the final program so um it's it's really involves real-time code generation and it moves the the burden from a compiler to the programmer so you know if you're interested in reflection one of questions that you should ask yourself is how much of the work that I'm asking compiler writers to do can I take on myself and how much of that can I get the community like you know help develop and and that is what you know this is about now what can you do based on what is known during build time and so the the way if you want to do build time reflection you you have to structure your your build program built uh in certain way you start with already known uh source code uh it could be you know human altered or you know machine generated and then you compile those things and then you let's say for example you have a module interface source file when you compile it you get what we call builds module interface or BMI uh or if you're using msgc we'll say you have an IFC file well that built uh build artifact contains a lot of the semantics information that compiler knows and it is possible for you as a programmer to go and crack open it and then generate new C plus plus source code that you can now get fit into the pipeline of build pipeline to augmented program and you do this iterate this process as long as you need till you don't need to generate more stuff and then when you when you link everything together uh you get a system that is fairly powerful it doesn't give you everything that static reflection will give you but my hypothesis and conjecture is that it gives you nearly about 90 percent of what we have been waiting for so it's a good thing to invest in um the for this to be successful you have to be mindful that because you're generating codes your build system how to support you know automatically generated code you know most of your systems about that and if somehow uh you're still running your own build definition by hand maybe this is the time to reconsider your your choices and see if something else can help you there okay and and another way of looking at build you know time reflection is let's say some form of grain Computing like you when you imagine you're using all these things and and then something was generated authenticity and you're not leaving it good to waste you you're reusing that information the same information at the compiler had before you two can can have that and with modules it it is there anyway like it's not additional work that we are asking the compiler they compile already did that works so we'll just being very responsible with the resources that that we have um so uh now I want to just illustrate the the idea of um uh build time um you know Reflection by using a very very simple simplified example the idea is not so much that I want to trivialize the problem it is to convey the basic of the idea once you get it I trust you that you'll take taking a run away with it and make it as complicated as you are that I trust you with so I'm just going to use a very very simple example so don't discount the example just think it is just a way of doing something it's a template and you can use it and magnify it to instantiating in other situations so the the example that I want to look at is um imagine that you you have a program uh rewriting program that has bunch of types and somehow you need to do a lot of formatting IO for formatting because you're sending data you're doing distributed computation you're sending data or network or you're saving uh you know data on file and and then bringing it back later imagine you're doing game developments and you want to save some save some characteristics of uh characters in a game or skinning and and so forth well how do you do that kind of IU thing automatically so that you don't spend your time you spend your time so you spend your time actually programming a game as opposed to doing work that is best left to machine so um the example I'm going to give you is using of course modules and what is what I use so um for this to to work properly and and and to scale we can't just go uh through the entire program and then generate IU formatting function for every single type that we find in the source file that just doesn't make any sense even I don't even compile and if it does it would just be waste so we need an ability to annotate in this this Source program hey I need something to be done automatically for this type okay so we need the hints whatever it is if you were designing a new programming language you probably need a keyword or something but remember I'm not here to talk about a new language feature I'm here to tell you what you can do with the existing language when I say existing language I'm mostly thinking about C plus plus 20 C plus plus 23 which should be out very soon and and you already have compilers out there supporting Gustav uh 23. so the ability to selectively tell the the tool the system to generate certain code for something will help reduce code blocks um and do we by doing so we also improve efficiency overall efficiency you know that space is time if your binary is Big it's probably going to hit up a lot of uh um space cache lines and and and so forth so uh take this very simple example imagine um I'm dealing with um uh points on the plane a planner geometry and I have a struct points then the usual thing have a coordinates you know X and Y of course I will go and write my own formatting function but it's boring it's boilerplate we want to increase your productivity we we want you to delegate that boring aspect to a tool just Define your abstractions and we'll take care of the rest that's what reflection is is really good at so in the example that I'm showing here like you said earlier we need the way to annotate so here I'm just using an attribute on on the type definition here the struct point to D have this attribute say uh gdr generates outputs so this is just some kind of you know DSL for me to to to to tell the tool to generate uh IU functions for for this type I don't want to write that function I want the tool to write it for me and what will happen when I do that is something like the following the the tool this you know so that helps me use uh real-time reflection will generate a new module source file it will take the uh the inputs module here the plane the geometry and he loses that name and then as basis and then we'll add reflected that output usually when you have [Music] um uh tools it's good if they they can predictively name things right and then the next thing it does all this is generated source code and say Imports to remember with C plus plus 23 now you just see import student then and then you move and do whatever uh you need to do um and you you can use this thing today like impositude works today uh if you download the uh um the msgc compiler and using your Ms build or using cmake it will take care of all of that and then the next thing it does uh they've told us is generate this function operator less than less than it takes an IR stream and point to D and then you know formats the the coordinates of the points in crystallized way and if you look at the code carefully those places are like green text you'll know that the entirely determined by the structure of the uh the class the destruct that that's here the name member and Absol so it is purely mechanical and this is something that a tool should do for you you do not need to do it the fact that the language the based language does not have this facility built in is yeah it's a shame but it's okay we can get the tools take care of those things that you can have here so like you say this is uh this is just a simple example but imagine you do not want a Authority like this you want let's say in uh Json format so you you know you'll have your tool generate the codes you know using Json library or if you want to have a banner representation on disk or you want to sign over to network now all those things the boilerplate that have structures like yeah templates that can be done automatically for you and the only thing that I so this is source code that's generally the tool and I have to make sure that my build system knows that this source file is going to be generated by the tool so that it schedules it's built properly the other thing that I as a programmer need to do is just to write my main you know program that's using this thing so plain geometry that module is something that I ordered that was input into the tool then the tool will generate automatically for me this or a module playing geometry reflected output that now I can just import an Imports to it again and I can just use um the uh the insertion uh if defaulting operator that was automatically generated based on the structure of of the class that that was defined so this is a a concrete example it is simple I agree but what I'm trying to convey here is not how sophisticated it is but how simple things can be okay and and most of you complicated um situations where you want to have static reflection you can structure the code in a way that you can actually use your system by carefully uh putting you know designing interface that so that you can have this cycle that I mentioned earlier how you orchestrate the build so the summary of course the io stream example is simple but it is a temp again it's a template you can use you can generate Json yaml if you're doing gaming game stuff is where you have a lot of Need for reflection stuff because you have types that you define in your source code but they represent stuff that you want to you know associate property is wave and and anyway that is mechanical so you can actually have a tool do these things for you these functions that are doing yeah the the the the output uh function they are automatically generated so they are always up to date with respect to the uh the type definition that is in your program right so you don't have to worry about it and and also if you happen to change the field or something you do not go you don't need to go and enhance 25 places to try to do you change those things the tool can just automatically generate everything for you and you can deploy this today we do not need to wait for another two three or five years you know decades to to get reflection and occur because this is simple enough that it can be taken care of and we can have your own like if if this doesn't work for you you can have your own generator based on the logic and the needs that you have that's the beauty of it you do not need to go and extend to the compiler you just need the compiler to tell you hey while I was building that module this is what I found is that useful to you and say oh yeah great give that to me I know how to use it okay so um all of that is kind of very high level uh description of how the code is is generated when you're using the msvc compiler and you build a module it generates an IFC file what we call builds module interface in you know standard terminology the msgc format that is the FC format is publicly documented as a matter of fact we want the community to really you know use it extend it and however it is specific a couple of years ago I gave a presentation about how you can actually decompose an IFC file and in another talk that's interesting that for you to see is one given by my colleague uh a camera on the camera and the way he he showed you know a a viewer of an FC fire written entirely in JavaScript so it's not even C plus plus right so when it when we say modules are truly an opportunity your tool doesn't need to be written in C plus right it can begin in language yeah you want as long as you can read a binary file okay um the one thing that I the last thing I wanted you to know before I go out is please start using modules today especially with C plus plus 23 where you don't need to remember which header file you need to include this and that no just say inputs to do boom and furthermore it is much faster the build time is improved because the the the the listed module which built once it's reused many many times so the combat doesn't need to re-pass it all the time it is simpler to use SPCA if you're on PCA today I really invite you to start considering using modules and and if named modules are a bit to still be step for you probably start with header unit but really what a game is is not named modules um there there is to be a a GitHub repo that contains all resource code that can use as inspiration that demonstrate what I just talked about and please call it extend it use it any way you you want and uh and give me feedback well what else would you like to see do you want an SDK how what are you going to do with it let me know um and and finally the IFC spec is is there on GitHub as well it you know it's for the community to develop contributes and and and and give feedback um with that said I'm I'm ready to to take questions thank you so much um so we've got a few questions in chat uh we have one from Antonio who says reflection is a fish hard to sell uh why not show some code you showed some code this was from from about halfway through um what arguments do you have on what there is to gain by using reflection what are the use cases for reflection C plus plus oh okay yeah so um not everybody needs reflection but the first thing I have to admit now clear hey not everybody needs reflection um I in the talk I gave the example of uh formatting that's just you know every time you're doing IU many of these types they have a photo certain pattern and they're very repetitive and you can get that automated um if you're doing gaming uh you have types the characters in your game they they tend to have properties values associated with them and you can have that saved on disk and read back automatically again the way you do that is very very structural and best done by tools if you're doing um this really competition these days we talk a lot about AI well AI is very computer intensive and they work when you're doing it work you're going to the best way to do it is you distribute it work so you have to send data over Network how do you get that done properly and and making sure that yours the data you're sending it starts everything is in sync best use you know a reflection to take care of that for you so it's not so much reflection in itself it's a tool to take care of boilerplate so that I can focus on the most creative aspects you know the joyful part of programming thanks and then we've got uh a few questions from milosh she says um do we believe static reflection would allow us to finally get rid of macros or are we cursed with uh hash if defined I'm just going to Source clang for the rest of time well okay so uh modules take care of you know a good chunk of the Democracy sorry if they have that kind of stuff taken care of by module now when we're talking about um compiler specific characteristics like you know certain features are available only on client or gccms you see uh those who will still be there um but when we're talking about code generation one of the things I I don't like macros but I also have to confess I use macros as a way to generate codes like generate sequence of tokens that are compiled by uh by the compiler well my sincere hope is that we will get a good reflection static reflection system that will take care of that huge sword of Need for um uh code generation then what is left is probably unstructured uh code sometimes you just want to include some text it has no structure to it well you still have to use you know macros for that but having something that plays by the language rules that your ID understand your group system understand is much better than having this you know character string manipulator yeah for sure and um of the the reflection repo uh you're going to pitch that live after the talk right yeah so yes yeah cool um another question is uh more theoretical but do we think it would be smart to have a pre-build step that is going to do this generation so that the IDE knows that these things exist yes I I agree yes yeah yeah it you know that's actually a good point um we talk a lot about what Reflections they great but they also add complications to the uh IB um experience where certain functions that you know now available at compile time or invoke that compile time need to be understood by the ID in order to provide um you know better experience yeah absolutely and then another more General one for everyone and a good introduction to compiler development on that one I'd recommend the book um crafting interpreters it's yes absolutely it's about interpreters but like it's mostly like all applicable to compilers as well you can like read that book and then pick up something a little bit more delving deeper into compilation techniques like uh engineering a compiler or modern compiler development in ml or C or Java whichever one you like for for some of the more compilery things but crafting interpreters is just such a a well-written and structured book that I recommend yeah 100 agree and and if anybody you know you know you should take size advice on it like this is great um and if you do it you'll find out that if you're writing an interpreter um and you want to do let's say IU for example because YouTube reads your you'll find out that you need a way to reflect the facilities in the sea headers on the C plus headers in your interpreter and this is another place where actually reflection help you write simply your interpreter that's fantastic second cat of the day here actually her name is lexical analysis cat so Mexico analysis and uh yeah uh anchor asks what compilers does is the question about GCC oh okay my my apologies they the only reason I didn't mention so I think on the last slide I said that uh use modules today you have cmic build system supports um and and they have built system support for msvc and client it comes in box uh for GCC it's not because you know it's more like the necessary support is not there so I didn't want to leave people on on something but you know you should also be mentioned that GCC also has um in support for modules okay and then there's one more on what compilers does gdr generally work with oh so uh the all the examples are built with msvc so the IFC format right now is very specific to admsvc compiler um you know I use my private you know Network private um build to do that so whatever preview is there as of today will will work um I would like to see the community um coalesce around a common format for a module bureau's module interface whether it is IFC or something else doesn't really matter but being able to have these tools work you know cross-platform cross compilers is is fundamental for for us the C plus probability to realize the uh the promise of you know modules being uh during opportunity yeah and I think that answers the next question as well which is could this work be implemented for other compilers like GCC and clang yeah um so the IFC spec is is is public and if someone feels energetic enough to to get a fork and and and generate uh IFC out of it it will work um you if you do that you do not need to change gcc's own internal representation you do not need to do that that's good it's one of work now what you will need to do is just ability to translate the IFC data structures into gccs or tax internal representation I think if I were to do that that's the way I would do it I will not uh sign up for every student right this is your client you're using obviously no no just ability to read all right that's it and then um still got time so another question is could the IFC spec be put in the C plus standard uh probably not C plus 26 or C plus 29. of course I would love that uh but the reality of thing is that from something like the LC you needed to evolve as quickly as possible the way compilers evolve whereas the the standards tend to be on three or six years raw so um if it could just be some kind of de facto stunner I think that will take care of all the Practical needs that we have and then let it evolve as quickly as it can and I would really love to to to see something like that happen great well we are out of questions and almost exactly on time um we stayed on time for the entire thing kind of thing suspicious you're running this thing quite well yeah it's our fourth year we're getting the hang of it so thank you very much Gabby thank you for everyone who has stuck around and watched all the talks uh these will be put online um on the the visual studio YouTube channel so um please keep your eye out for those going live and uh feel free to share them around if you have enjoyed um so thanks very much and hope to see you all next year

Beyond Copy + Paste Creating Interactive Documentation

next up we have beyond copy and paste creating interactive documentation with Maria Nagaya thank you so much Mika thanks everyone for staying tuned with Netcom 2019 and thank you for listening to my talk so my name is Maria Nikita I am a senior program manager on the visual studio.net team and I want to talk to you today about interactive documentation and how we think about that and how it's important for first-time developers as well as developers who are continuing to grow and build on our platform so let's talk about documentation documentation is how we build trust with our developers it's how we educate people it's how we sell our products and good documentation means that we are as invested in our product as much as you are it's important as we build our documentation from first-time developers to people who are building code every single day that we make sure that their own ramp is as smooth and as effortless as possible so let's talk about documentation today for a few minutes with documentation today it's getting really good but there are still a few assumptions that we continue to make about our customers first is the assumption of knowledge sometimes when content creators are writing documentation they assume that the people coming to our documentation have prior knowledge of the framework and the languages being taught the assumption of tech as a content author myself I sometimes continually find myself thinking of my experience as the only experience I sometimes reference the operating system I'm using I sometimes reference a version of Windows I always assume that someone has as good internet bandwidth as I do so a good example of this is providing links to certain specific downloads as well as screenshots that only reflect a particular operating system and the last one is the assumption of time we are all really guilty of doing that we assume that the people coming to read our content or use our videos or a documentation have more time than they do usually when people are learning things trying new things or testing something they have a limited amount of time whether you're an educator a hobbyist or a seasoned developer you're probably doing this over your lunch time or just before you go to bed or just before you start work so we need to make sure we cater for that so we look at documentation today majority of the documentation looks like this it's static code right and if we think about this from the perspective of a net u developer a brand new first-timer they're often left wondering what does this do so we then go to stack overflow we copy and paste a bunch of code from here and there but then we still up for the challenge especially as first-time developers what template do I use in Visual Studio what libraries would do I need what do all these error messages mean we are telling people that for their first few lines of code there's a huge on-ramp or even just to run a sample for seasoned developers you're probably working really fast and you don't want to copy and paste in a copy and paste code in and out of your codebase you just want to see if this is the best thing for you so we've noticed one thing as we begin to improve our documentation our expectations have changed and we expect more from the people building our content to do more video has done great work in this space and we just launched right now with dotnet videos on how we are investing in videos and how we are making sure that our developers have an interactive experience where they're able to listen pause and rewind but still we're assuming a bit of time on your side but it's really good content so please go and look out look it up another thing is interactive snippets online this has actually become a requirement for languages and frameworks when you can see popular languages like JavaScript and Python allowing people to test api's and syntax right within the browser but we're also seeing it in popularly emerging languages as well such as scholar and go where people are able to interact and test API is right within the browser but puzzle this is just a few pieces of the puzzles right so we have video on one side we also have syntax iteration online however people want to have experiences that Feliz native to the experience they would have in the browser we're seeing this in places like Microsoft learn where people are able to try and test things out which would be similar to what their local experience would be so when they do transition into an offline experience it feels vaguely familiar but then we also have the concept of trying now this is something I constantly do if I want to try out a new NuGet package I will create a throwaway predicate see if it's working I will delete it I will do it again but you're seeing places like MPN with the help of companies like run kids creating these experiences online we should be able to try out on you get packages and see what they're like right within the comfort of our browser and what we're continuing to see here is a narrowing of the divide between documentation and code and the reason why we're seeing this is a landscape is continuously growing we have developers such as people who are watching this show writing blog posts every single day we have hobbyists and the hobbyist field just keeps on growing from makers to web developers mobile developers IOT from social media influencers where they're just constantly learning how to own their own online experience we have data researchers who are using and mining data making these analytical choices to make more informed decisions we have educators both CS educators as well as non-technical educators where we're seeing in primary and secondary schools all around the world where non-technical teachers are given the task to unwrap the next generation to be comfortable in this new world of coding and finally we have our students who want to explore and learn as much as possible and we need to provide those opportunities for them so when we're creating these new experiences around documentation especially at Microsoft there are things that we wanted to make sure that we landed very comfortably with the customers we wanted to make sure that they had up-to-date documentation nice and fresh referencing articles are when were from 2019 versus 2003 we wanted to make it engaging and engaging is not just about making it flashy and cool you want to make the navigation really easy you want someone to land on a documentation page I know where they need to go you also want the steps to be clear and quick and easy so if you got go-to dotnet right now and you go getting started you will see how to get R up and running in ten minutes giving people the moment to feel empowered in ten minutes or less and finally we wanted to create a friction free learning experience we wanted someone to be able to go onto a web page and learn about the language without having to install all the tools or know everything and in 2017 we launched an interactive online experience with a product that I build called Trident net which allows people to experiment and try dotnet the language within the browser so let's talk about more about the Trident net interactive experience and what we offer them we have our initial goals were in 2017 was to have an interactive documentation online bring us up to speed with the other languages that had been providing this for their customers most importantly we wanted it to be login free we wanted to make sure that someone didn't have to install everything on their machine in order to just write console dot write line HelloWorld we wanted you to give that quick win and finally we wanted a fast on-ramp we wanted it so you could edit the code online click run and see the results we wanted you to feel that moment of success but we also noticed that Trident net is growing and those are some of the wonderful things I want to share with you today so when we first began in 2017 we wanted a friction free online experience and we did that with Trident net and you go to dock stopped Microsoft comm you're able to run c-sharp code right within the browser but as we began to notice that there were certain difficulties first of all what happened if someone didn't have good internet access what if somebody wanted to do this locally on their machine how are we creating that experience for you also we wanted to make a cheaper alternative that allowed people to run things easily within their website and luckily in 2018 we also got laser and it allowed us to pivot from running things and containers on Azure container instances to running things on the client side with blazer and only that because we created these experiences will also allow us to create a local experience with a.net try global tall and if you look at my slide right now we have a student in South Africa who calls is one of the most influential things that he's used that allows him to go and share c-sharp experiences with his fellow students so we thank you and we hope that you continue to use us and then we have a special surprise that I think a lot of you didn't expect but we also have dotnet running in notebooks and I'll be sharing that demo with you later today so let's go and see some demos now okay so as I said see Trident Nets started in the browser so if you go to any single sample on the docks of Microsoft comm quickstarts you notice that we have an editor right now you can copy the code over run it and you have the direct results you can also edit it easily right within the browser so you're not restricted by own but what is in the code and you run it again this is all running on blazer it's all running on the client side that allows us to create opportunities where people could possibly add this to their websites as well which we're hoping to enable in the future but I also talked about the offline experience if any of you have ever done a workshop or done a tutorial out there you've probably had to get people to download the tools clone the repo make sure than the right operating system and before you know it it's two-three hours into the workshop and nobody has done anything we wanted to make sure that people could be just successful with a dotnet SDK and the dotnet tribal global tool and get things up and running so I want to give you a quick demo of that so we have this repo it's our samples repo you can go to go to dotnet try slash samples on github and you'll see four clear extra instructions where we'll tell you to install the.net tri global tool which is available and you get today clone this repo then once you have this repo clone I want you to go into the directory and type dotnet try so as someone who prepares for demos ahead of time I did the first three steps ahead of time so I'm gonna great go right into here type dotnet try hit run and what this is going to do using kestrels going to start up my browser and it's going to give me an interactive markdown experience if you look at the top this is an MD file so I'm going to continue into introduction to programming with c-sharp and you'll notice that you have a list of instructions it's like an interactive book let's go ahead and run this code sometimes the first run can take a few seconds but bear with me you have hallo world I can go in change it again and I will put in my name run it again and I see the results this gives people the flexibility to run an experiment within the browser giving you that nice interactive experience so I hope that you'll give it a try for the next workshop that you're a tenth you're doing or if you just want to try give it a just try it out but the big question here is how are we doing this how are we able to have this mix of interactive code c-sharp code with a markdown file so I'm just going to go over to Visual Studio code and show you some of the magic that we're running so I'm just gonna close up the server here so this looks like markdown that you've probably written in the past if you've done anything with a readme file and if you add any sort of language language features within your markdown you usually have to use a flag so you notice that we have something called si si si s which is a c-sharp we are pointing to a specific region right so this is general c-sharp regions called intro we're pointing to a source file and we're pointing to a program dot C as in my app so let's see what this is if I go over to my program dot CS you will notice that I have a couple of regions adored you have a bunch of switch case statement and I have a region called intro so if I edited this and I said hello dot Netcom and I saved this file and let's just go ahead and run this again dotnet tri I go back into my introduction to c-sharp and I've edited it right so there's a seamless difference but another thing that we have to be careful with is that if anyone's written documentation sometimes it gets out of sync like how do we support our backing project as well as what we're putting in the documentation we wanted to make sure that we supported that so let's make some quick edits like how do we verify code so I'm going to go over to this code again and I'm just going to make some clumsy mistakes over here I am going to remove the Senate semicolon save that I am going to change from intros from intro to intros I'm gonna say that again and I want to show you a new addition we added it called dotnet verifying right so what it's saying sorry it's not net try verify okay so this is going through and it's actually checking your markdown and checking your backing project to make sure that everything's going okay and you'll notice that it says hey you're missing some things here you're missing a semicolon and we also haven't found the intros region so we wanted to make sure that before you hit push into github you're able to actually see any issues that might pop up and we're allowed we enable you to do that if you're someone who would prefer to see this in a UI format it's also supported on the server on the UI side as well so I'm just going to click do this do dotnet try it's going to launch the localhost again and if I go over to the introductions it will tell me that the region hasn't been found so on both sides you have this experience where users are easily able to catch what their mistakes are so let's go on some to seeing that if you want to look at this more you can go ahead to our github repo and please give the give it a try so I want to show you a little bit more and other experiences that we've been creating so I showed you the dotnet try global tool and I showed you don't know try running in the browser but I also wanted to show you something that we just did this week and I'm really looking forward to hearing your feedback if you go to our github repo and you do dotnet slash try and you scroll to the bottom which is pretty long you can notice that we have a lot of files in there you'll notice that we have the dotnet try enable bad but we also have launch to binder now binder is a project an open source project where it's able to point to a github repo and take out all the notebook files and run them in the browser so they spin up a nice container and you're able to look at it right within the browser over here I already got this started this is c-sharp notebooks oh sorry let me start that again let's launch binder this is going to take a few minutes because it's configuring a container for us and the beauty of like live demos is that this will happen as the circle spins around but what we wanted to show you here is that we want you to be able to try the dotnet notebook right within the browser we wanted you to play around with it let me make this into c-sharp we're going to go into samples and I have a housing ml sample right here right so let's walk through this experience you can install and you get packages right so this allows you to customize it a Dane you get packages that you'd like I'm going to hit shift enter enter what this is doing is it going to Newgate it's installing those packages for me this will take a few minutes but as we want you to know that if you are using this on your site you can install as many packages as you would like you can use work you can notice that we're using the ml package we're using Auto ml and we're also pulling that the data data frames NuGet package as well but as that's installing let's look through the rest of the code so I can run through it we're able to use our packages in the next cell as it some of you might know notebooks have cell by cell execution we also wanted to make sure that people had graphs being able to plot there so we wanted to make sure that people are able to display graphs scatter plots right within the new get packages was right within the notebook wanted to make sure that we made this feel authentic to people who are coming from the Python notebook space but we also wanted to make sure that our customers who are regularly who a regular dotnet developers but this also felt authentic and natural to them so I'm going to run the next browser maybe it's our next cell shift and turn alright and as you can see we have a nice table that has been delayed we've actually been able to display table of the housing data we can also plot some grass which I think would be the cool thing so let's start looking at some cool stuff all right let's run that again all right so I'm going to go over to duck's samples and housing let's pull in some packages bear with me I am so sorry but this should take a faster time the next time around we've installed our packages we're waiting for just one more which was been successfully installed let's run this the housing data alright so what we wanted people to be able to do is see the graphs and customize these graphs authentic clean and know ok so let's give it a moment and what we should see in a bit is a histogram that shows us H end of all the housing data across California well while we're doing that okay let's do it one more time think the third yes there we go it just needed one more time if you hit it hard enough it will happen so what we can see is that we have a histogram that shows all the data if you're someone coming from the notebook space we also have support so you can zoom in and see these things in more detail we also wanted to make sure that you're able you're able to do more interesting graphs like scatter plots so let's run this give in a moment all right and as you can see we have a scatter plot and you guess which state this is California sorry I don't have a live audience it's California as we can see the pricing is pretty high but let's say I wanted to zoom in a little more I can do this I can zoom in on some of the hot spots what this will do is I will actually cancel out everything else so we want that rich interactive experience that people have come to expect and we're looking forward to your feedback so if you have any questions on how to get started with the dotnet kernel that would come at around ignite time we won't have anything for people to try at the moment however we do have the mind binder experiences available right now so if you go over to our github page and you'll be able to launch it right there from launching launch my browser so we have a couple of minutes for questions I believe when we have a chance and we can give it a go we are ready for questions sake well hopefully you can see us here I brought my brand-new phone that was really awkward well you know the first thing that's kind of cool yeah yes yeah this one right here mica I feel about what you just showed us I think it's awesome have you ever tried have you ever tried tried net you're gonna love this I'm reading upside down it looks like a fairly simple way to learn and write some c-sharp code inside your browser without having to first create a visual Co solution plot plus lots of sample code aims at new learners check it out you have a fan yeah you really do and there's a there's a there's a gif and I'm gonna say gif for all of you out there listening I'm not I will not sage if it's not be nut butter okay of the the guy the Australian guy going like this two thumbs up alright what else do we have over here let's see wish this had been around when I was working on bit frost by frost by frost a few years back looks really impressive for dotnet open-source projects like I'm wondering if this guy's Thor I think you might be okay I think you might be ample time worth hi yeah oh yeah but of course hi for me to you alright here's another one from John great to see the improvements Microsoft has made in language platform documentation I still remember the huge stack of books from C 6.0 that's a long time ago should have included a back brace with the product this is pretty cool I love I love the idea of being able to learn and read as you go I'm personally a fan of notebooks I'm so glad c-sharp is coming to it and the try dotnet stuff is really cool so if you could give people one takeaway from your session what would it be it would be number one can you only be one or can I get two can you you could give as many as you want okay this is your session number one please go and try the dotnet try global tome give it a try make sure using it for your next workshop we're looking forward to hearing how you're doing with it we've had people try it with workshops that are pulling from Azure function so I would love to see more workshops with that also if you want to give it give the binder experience a try let me walk through that experience one more time so people can look at it because I had some technical issues because you know that's the world so let's do that so if you go to our github repo which is dotnet slash trying you scroll down all our code base you'll notice launch my binder right so when you launch my binder what this is doing is that it is spinning up a container for you and you're able to actually start running and writing that code right within the browser so it's pulling in the.net core SDK and all that kind of stuff now for it to even look nice um look at it in the lab format which I just think is always like a nicer way to look at this experience I'm a fan it's really cool I also want to point out we do have f-sharp support I don't know if people saw that exact is Phillips now they live in XNA we do have f-sharp support so if you weren't there you go to Doc's there's an output there is a bug which I can fix right now hit run but this has all the nice F sharp expectations that people will have and my team will continue to work on that fantastic um if you look at the C sharp as well let's go up when look at C sharp you will find two different samples you have one to the housing sample and just to give reference to this housing sample is literally pulled out of a data science book and Eric did a side-by-side and was able to replicate this entire experience right within the browser and we also have a repo one which I should have run to show you how we are actively keeping track on the issues that you're doing and we're actively trying to close them fantastic and then wait for ignite so you can start installing the bits on your machine all right nice we have another question is it possible to integrate try dotnet with doc FX documentation tried out net and doc effects not at the moment now okay okay and I think there's one more isn't this one yeah can I take a subset of the try dotnet code and use it to incorporate c-sharp scripts within existing applications Oh Jeremy good question yes you can just look at our repo and ask us questions and here's another one with another awesome yeah yep Yoda wise when it says so do what you can as there is no try try dotnet dotnet like I love the cool with Jupiter notebooks like that I'm trying to like parse it this is really good stuff okay it says so do what you can as there is no try try dot dotnet the cool with Jupiter notebooks tonic I will I will decipher that I think is a hideout net is cool and we're also excited about the Jupiter notebooks experience are we ready to go to the next yeah we have what's new in F sharp with Philip so Philip now is it Philip or fillers it's like doctor same with a British accent defib

Azure Services Every .NET Developer Needs to Know

up next app services every dotnet developer needs to know with Tim Heuer and Angelo's petropolis that I say right perfect off we go awesome thanks everybody good morning good evening good afternoon wherever you're watching from I'm Tim this is my esteemed colleague Angelo so we're here to talked with you about Azure services that every dotnet developer should know and get excited about using your apps so first I want to set the stage Angelo sands just make sure everybody we're gonna we're gonna throw out some terms about Azure you know we should probably make sure everyone knows what those terms are in Azure there's a lot of different things that we'll talk about but just a level set so we're gonna say things like accounts and subscriptions and accounts is something that represents you and me our actual identities that's how we authenticate with the service a subscription is something that we can share together right that's kind of a billable unit you'll also hear us talk throughout this session about resources and resource groups a resource represents an individual unit of any service that's created in Azure and so like I have an app service is actually which is one of the things we'll talk about today is an actual resource a resource group is things that we can group together perform some more security on establish some you know more boundaries of what can be in those services and configuration around there so we'll talk about those two things quite a bit most explicitly today we're going to talk about two things right Angelo's we're going to talk about hosting and services right and the way that we think about these things is hosting is you're gonna provide the code and Azure is gonna run it for you and the services that we're going to talk about is more you're gonna provide the data and Azure is gonna these Azure services are going to take some action on the data supposed to so specifically during this session we're going to focus on those two aspects of hosting and service and to do that Angelo's has built a very simple application to allow us to walk through that so we have a we're gonna we're gonna show an image gallery right and so was it worth me yeah we you you we were gonna IPO at the end of this want to get in at the bottom here so I think we should just like dive right in and get started and let's so throughout this we're gonna cover roughly five services that are really kind of table stakes that dotnet developers done at core developers should want to know everybody should be aware yeah so tell us about this this site and show us the first demo here let's jump straight in because we have a lot to cover so I have the simple asp.net core MVC application working here already running locally localhost it's called core image gallery I can register a new user and log in so I'm gonna go ahead and log in with my demo account this is as you're logging in yeah so what what are you using for this authentication here now this is powered by a speed on that core identity so go set for that if you want to know more about it but the whole register with different accounts social and all of that comes kind of for free and you basically configure it and it just works and it's all taken care of for you you know when you do the initial configuration right that's right so now I've logged in I'm gonna click upload image I can pick one for my local machine to upload it to our gallery it's gonna take a little while to upload it it's telling me it did some file processing and the file will be available shortly in the gallery and I can just click return to gallery and here's the picture I uploaded and I'll open it up to show you that the processing we're talking about it's just a little what am i copy mark copy right so that we protect our millions oh yeah this is this nobody cool still this no yeah all right so very simple application let me stop it from working let's go back to the code and check out what I just showed you simple solution a couple of projects I'll start with image gallery dot model nothing but a class library nothing interesting here really just a class with some properties that's what we use in the page that shows you the confirmation after the upload so just showing there's no tricks so nothing will interesting there the main project a speed net core MVC also you start up the CS go quickly classic stuff like we said we're using asp.net core identity we're using MVC but they think I want to draw your attention to is we have a service an interface called I storage service and in implementation of it with file storage service so let's start with the interface let's check that out it's pretty simple just a couple of operations on it Gate get images async that's so we can populate the gallery and add image async it's just when you do another upload so nothing too crazy here close it down actually I want to show you the I want to show you the implementation yeah but the one we're currently using yeah yeah so let's go and take a look at the class that implements I store at service and this is giving away the secrets immediately you'll see here there's going to be a folder called user images we're going to put it under double W root and that's where all the pictures we upload go into it's the local store for the server nothing really interesting in the constructor add image async I have a little helper method here to get some properties out of the image so I can show the confirmation page later we just get the path here for the destination we create a stream we use a little watermark in class to add the watermark I'll just show you that real quick just I'm not curious I don't really know what it's doing but it works all right and then finally we just record the upload and you get to see the screen that says go back to the gallery so it's a standard asp net core web application uses NBC yep nothing nothing special there's any cloud specific or binding us to any decisions at this point so let's now we've only been running it local yeah this is all local and I forgot to mention that asp.net core identity uses local DB so we have a dependency on sequel server right now but yeah it's a local instance of it that's right so let's take this application which is a typical application it's deployed to Azure and then slowly we'll try to modernize it and make it a bit more cloud native let's do it all right so I'm gonna right click on the project and I'm gonna click publish now the one thing that we've already done is we've already created that account in subscription that we talked about it yeah because we don't want to waste too much time now in the demo that's pretty easy to look up and you can do via the CLI through the portal it's all pretty easy so here when I right click published I'm picking other up service and because you're nice and you ready provision the resources for me I'm just gonna select existing and go find them I try to add value by yeah provisioning resource creates all this fantastic yeah so here it's gonna access my subscription and then it's going to go look for the resource groups under that subscription and then I will be able to find up service instances running in those resource groups so like you said a resource group is just a folder it's basically a nice way to organize your stuff so you can go find it easily and you can have more than one subscription and in fact that's we took it a little bit long because you do have a lot of subscribers sorry yeah alright so here's my demo resource group and I'm picking my existing instance of app service I'm clicking ok and now visual studio will talk to that instance capture some information and all I have to do now is hit publish before I do that I have to make sure my asp.net core identity data and schema makes it up to the new instance of sickle cell you've created for me right because we were using the local DB right and now we want to use an azure sequel provider in fact a direct sequel itself but you did all the provisioning so I'm not really sure what you did there but thankfully Visual Studio will let me do everything through its options so if I just edit the publish profile so I can access settings you will see here at the bottom of the dialog we're discovering data contexts what that means is Visual Studio is now hitting the app service instance I've selected and it's asking it if it has any sequel server connection strings cuz if you already done the work I might as well benefit from it yeah so now that the spinner is done in its real time this is real time yeah this is the communicating with our subscription and I've already done the provisioning and Azure sequel for you and provided a connection string force so why should I bother with that again right now all that is there I can just pick it checker box that will apply entity framework data migrations as soon as I publish so all I have to do is save hit publish now what's going to happen is visual studio of course will build a project will talk to the app service instance upload all of the content then it's going to go and check xico server run it the framework migrations and we try to give you you know visual clues what's going on you can always go to the output window and get more verbose information about what's happening here so why are we using app service and not a VM right so VMs are great in fact if you go and create a VM through the other portal we even have a very nice template where it will set up IRS and ms deploy and then you can just come into Visual Studio like I did now right click publish to the VM it's all great but this is a talk about you know services of also that you should know about an app service should really be your go-to hosting option in Azure at the very least you're getting a fully managed instance so you don't have to worry about parties and security fixes and frameworks all that kind of stuff it can very easily scale out and scale back based on just setting some metrics and some options up it can make sure that you can keep your site running even when you're deploying into the same instance by taking advantage of a feature called deployment slots like aging in production there's many many good reasons it's it's your go-to and don't be all these features if you don't necessarily need them don't think that it's superfluous there is different queues and tiers so there is different pricing and features for dev test than productions yeah maybe you don't need everything I think one thing that I like about app service is what you mentioned is you know VMs are great but there still is some configuration you have to do to kind of boots drop them whereas apps per app service as we just saw you know deploying even directly from an IDE or from dev ops you know it's it's taking care of a lot of that configuration for us we know we're just telling it hey we have a dotnet core framework and here's my bits yeah great okay so we deployed look the URL doesn't say localhost anymore right so this is lives that's running it now so right now awesome fantastic yeah so let's say let's go back to the slides real quick and just kind of review those first two things so we said we're going to cover hopefully cover five services here the first two things we we just were able to show is talking about two services app service which kind of is that hosting platform here app service is really great for web apps and api's as angelos mentioned it's a fully managed environment so you get the OS patching high availability and high scale by default with you able to kind of provide the throttling mechanisms within that and it's it's first-class tooling across visual studio family of products as well as you saw here we're using Visual Studio for Windows but we also have similar experiences in vs for Mac and code then the second thing because we were using ASP Nets identity integration we were using the local DB sequel server instance and so we were able to use any framework migration scripts to put that into Azure sequel so now our app that you know was running on Prem basically Prem bugging your box here is now hosted in Azure and our identity is also in Azure but we've got a couple more bits there right so we were uploading images were those images in sequel no okay let's take care of that yeah probably bad so yeah the app is running in either but we can do a bit better because if we want to take advantage of our service and its ability to scale out for example you will notice or you'll remember that the images are being stored on the WWE Road yeah the file storage provider that you had right so a new instance is provisioned then the folder will be empty if traffic goes to that server the gallery would look empty ah yeah relax we don't like red X images no all right let's solve that so we can go back to the demo all right so what I'm gonna do here is I'm gonna introduce the third as a service called Auto storage basically we want to be able to store files it's a common thing apps have to do also has a service for it so what I'm gonna go do here is show you a new implementation of I storage service the same interface we saw before some simple strings and variables here we'll talk about those it's nothing to worry about but let's go back to the add image async and compare it to the previous one so here we have getting as properties like before we have an upload container and we just get a reference to it this is basically a stream we can write into we then create a memory stream before we were creating a file stream because we're writing locally here when I do the watermarking so I'm gonna do it in memory and then image blob which is a reference to other storage which is going to copy the stream into it and now the picture is uploaded now those two api's that you're calling they're the get blocked blob reference and the upload from stream those aren't things that you wrote no no that's that's that's a sure that's a library that I get for free and so because we're making the decision we're using Azure storage and blob storage in this case we have an SDK available to us that allows us as dotnet developers and she sharpened developers in this case to work in the language we love get all the productivity in visual studio that we like and have kind of as this strongly typed interface with the service not have to worry about rest and all that exact type of thing perfect so now what I have here is the Apple work just as before but now it's gonna take the pictures and upload them into storage so even if new instances are fired up then they will just talk to the same instance of storage so I'm good but we can do even better when you're in the cloud and in your migrating applications it's a great opportunity to optimize and get efficiencies and modernize an application yeah and when you're on Prem they statically tasks like things firing off on timers and scheduled events and triggers that to get workflows and multiple operations and typically those things are achieved with let's say your window service running somewhere or Linnaean or crime-lab or something like but how do you do that in app service you can't really do whatever you want on that box so azor offers you a service called other functions which I'm gonna use now to take the watermarking process out of the main app and just do the watermarking after the picture has been put into storage with some sort of background task great so we're identified an area where it's not mission critical to us exactly has someone's uploading and we're kind of almost like a sync workflow in nature to offload this little micro service that you're gonna create yeah I mean it doesn't really matter if the image takes a second or two together name is one dollar an hour well I think okay nine it's good good what we lose will make up for in saving right on Azure they tell me all right so back on the project so I have a new project here in my solution called image gallery dot AZ functions how did I get this in here I did right click add new project and I picked other functions because I had picked it before or can search for other functions appear and I create a project now in I did I have my water market classroom before I just moved it over here it's the same color I still don't know I still don't know what it does yeah image uploaded so that's my first Amazon function I'm gonna right click and I'm gonna show you how I did that I click add new as a function you get to name it whatever you like I click Add and here's where I talked before about you know you probably want to have some sort of trigger or timer so here we have the list of possible ways you can execute your other function very commonly you have a TTP triggers maybe you do something with the website and the website calls the founders as I get and post and exactly actions yeah and but I also have or what I want here to use in this case which is The Blob trigger so as soon as the picture gets uploaded to blob storage I'm gonna get told that this happened yeah so I just give it a connection that's how I got it in there so let's take a look at the code there's not a lot to it I have my watermark up here I have an attribute telling me that this is actually going to be a natural function and the name can be you know whatever I wanted it can be different than the name of the method and I'm gonna look at my first parameter called input blob that's basically whenever the picture gets uploaded because the annotation I said it's a block to give exactly the name of the container is going to be called images and then whatever the file name is it's going to go into this variable called name so I have a string name here and I can reference it conveniently through here and then I have a second variable parameter which is basically my output so after I do my watermarking I'm gonna put the contents in here and it's gonna get written we're into a new folder container called images - watermark and that's also an azure storage blob container yeah in the blob container you can create as many of these groups as you like acharya so all this will do is be notified do the watermark and then move the picture but since i'm creating this two groups and i'm moving pictures from one to the other what i want to do is also clean up after myself so when i go and delete the original image that was uploaded so i'm gonna do is go to delete original image that's just another as a function again with a blob trigger so keep in mind you can have more than one per project sometimes it's often easy to miss I'm on more than one function per project and here what I'm doing is I'm showing you that you can even access configuration values in the definition ah so before where we had candy you had the hard-coded yeah blob name now you're pulling it from asp net config exactly so just showing you that both are possible the other one was just easier to read right so here what we're going to do is we're going to be told when the image lands inside the watermark container so that's after the first function has worked and what I'm going to do is I'm going to know to go into lit the original one now all right so I have this working and I think it's gonna work but I want to make sure it works locally before I put it into Azure and even though I'm using Azure functions something that is native to Asher I can still run my project locally including other storage what I have to do is fire off the azure storage emulator there's a good point so this is a another set of tools that are allowing you to do cloud developments right but have a faster inner loop development you know f5 debug kind of lifecycle and the emulator you have to start it on your own because it's kind of really hard for visual studio to know exactly when you're gonna access it and by then it might be too late okay but for other functions all I have to do is right-click set it as the startup project and what I put a breakpoint see what happens so that we've started the storage emulator and now you're starting the Azure function this is gonna run on the cloud now or this is also another emulator this is now the emulator being fired up by Visual Studio because it's clever enough to know that's exactly what you need and so there's a local instance of the azure functions runtime that's running ours that's right and you'll notice this is the 64 bit which we added support for recently nice so vs has detected the runtime is up he deployed my function and acquired a lock to it and now the function should be working now two ways second other functions there it's ready to listen it's yeah it's ready ready for the trigger all right exactly okay and since we're on the topic of working locally I also wanted to show you the other storage Explorer that's a kind of cross-platform app that you can download separately similar functionality exists in vs if you go to cloud that so look that up but I'll just towards Explorer lets me interact with other storage whether the instance is in the cloud or locally so here I can actually go and look at my storage account locally I can look at my emulator running I can look at my blog containers and I can actually see that the containers I had before images and images were marked so if I really want it to execute my user function locally I can literally just drug drop a file using this tool and it's gonna kick it off but let's do the full thing I'm gonna come back to visual studio and I'm gonna fire up the website and now we're gonna run there the app itself I'm gonna run that locally and just exercise the full end-to-end now what we have here as this is spinning up we're running our local process that's that's using the storage SDK instant using serverless functions but running both of those basically in a local inner loop that's exactly right we haven't published anything to our everything is local right now localhost so I'm gonna do the same thing now upload an image pick a different one this time so file is being processed blah blah blah it will be available to oh that's our breakpoint okay alright so that if I go here but a breakpoint on my delete 1 so go back to upload I'll just let it go come back to my website Oh didn't have enough chance a second trigger has fired off everything is happening in sequence Lee alright it's all good I'm gonna continue this now when I'm gonna hit return to gallery the image will already be there and it's already what I marked that's awesome so now we can go ahead and republish these republish our app to a sure at that point exactly so what I want you to see here is if I want to take this as a function and publish it to the cloud right click publish exactly the same experience as before I already had the profile there create the existing same configuration the same others difference I'm not gonna bore you with the same stuff awesome so now we've got we're using app service to host as your sequel in the cloud storage for our files and serverless for some lightweight functions at kind of asynchronous in nature we've got like four services we're running on top of the app itself so how are you gonna feel good about the health of the app here okay so feedback we get from customers a lot is running things in the cloud feels like maybe they're far away from the Diagnostics a little bit yeah that's not true that's not true let me show you how all right so let's go back close all this down I don't need anything local running I'm gonna go to my production cluster and I'm gonna go to my production research group so this is my website running in production right now and I have a report that if you try to upload an image without logging in first something happens to the app so let's go check it out I will go and upload the image pick one Scotland that one alright so we've got in we've got a crash here effective this is the dreaded you know something went wrong but you're not in the development mode and you can really get the call stack and now you're probably gonna be worried about well how do I get access to logs and this is annoying it was so much nicer when I was local okay let me just show you something called our zoo monitor I'm gonna what we're going is we're logging into the portal I'm gonna go back to the portal and you know how we said that we just groups are a nice way to organize your resources what I'm gonna go do here is we're going to go to my research groups scroll down until I find my production bridges group and here I get a list of all the services this users group has provisioned and you were kind enough when you provisioned our up service instance to actually attach it to our monitor what you get by just attaching it to our monitor is Diagnostics so all I'm doing is navigating to the instance and oh look there is a chart there for failed requests well that's exactly what I needed so I'm gonna click that see where it takes me okay I'm screwed okay so there's an action post upload yep that sounds like what I just did and it lets me drill into because I'm gonna keep clicking until I get to a call stuck here yeah so we're able to go to the portal now and is almost real-time diagnostics as well I just didn't and get basically to our core exception here and then so this has an end to end transaction it has automatically recorded for me without me doing anything special if I keep going I will eventually get to the call stack this is what we all wanted to see and we can figure out the exception there at this all right so this says Korematsu gallery extensions okay so I wrote me authorization yeah I mean it's kind of obvious I shouldn't let you upload the picture without sending in first but the point was getting to the cost right so now I can go back to my code and see that Gideon was proper this is assuming I'm authenticated base that's awesome so let's go back to the slides and review that what we've seen here so what Angeles was able to show is we had a typical asp.net core application for the simple one at this point that was doing a couple different things and we basically moved it all to the cloud not having to worry about managing our own box and infrastructure we got hosting out of app service we've got data storage in two ways actually using Azure sequel which you know if we needed relational database needs on top of our identity we could still use that as well we're using blob storage as kind of our durable storage for objects and things like that a serverless function that is just kind of asynchronous and actually by the way we only pay for that one we call it that's right so it's not this long-running process and then we have really rich insights and monitoring into our app so there's there's a ton more and after that we could do as well we didn't even talk about containers and things but that's kind of like the next level that I think you know an enterprise level application might look at is you know how do we do container orchestration and Azure has given any services that we can do there as well as other services that you know there's data services with cosmos DP active directory another service bus and sequel managed instance and everything like that so I think it's a really quick overview of kind of some key services that dotnet developers should should know here's some resources for you we want you to kind of go get the tools and SDKs done at core 3 release getting Visual Studio and both the core SDK and then as well that second link if you want to learn more about Azure and actually walk through some of the same tutorials of the services and get those SDKs that make it easier for a.net developer that's the place to go and if you haven't tried out you're yet you can get a free subscription that gives you free services some forever and some for a 12-month period I think the good thing about the you know we didn't there's a lot more richness in the monitoring and diagnostics and I think a good thing is the session right after this as Robin is gonna go over some more of what we've done more and dotnet core 3 and for those type of things so thanks Angelo said it was good good primer and encourage everyone to take a look at this Mika alright I thank you Tim and Angelo's as you don't know Tim is actually my boss how are you doing - I'm doing well you have a fantastic job thank you so yeah we have a few questions that we can go over right now let's see this one's for Tim good to see Tim representing brings back bittersweet memories of Silverlight you have anything to say about that probably not allowed to say anything let's see the next one can app services run laser app service yes and if you're into blazer and do app service also check out the azure signal our service if you need more info let me know yeah Dan Roth gave two presentations earlier today but also yesterday kind of how that kind of all works together as well with blazer here's another one this one's from John will vs generate the EF scripts if you just saved the published profile instead of clicking publish clicking publish actually deploys the app and then executes the migration scripts I had already set up before so I just didn't type you know create migration but you have to do that first and then publish will execute it for you so creating the profile doesn't create a migration script for it does it doesn't the server get yeah but but locally it doesn't you yeah locally yeah yeah

Building Bots Part 1

it's about time we did a toolbox episode on BOTS hi welcome to visual studio toolbox I'm your host Robert green and jo...