Debugging C# Code in Visual Studio | Mosh

Поделиться
HTML-код
  • Опубликовано: 11 сен 2024
  • 🔥Get the COMPLETE course (80% OFF - LIMITED TIME): bit.ly/2KJLPuS
    Learn to use debugging tools in Visual Studio to effectively debug your C# applications.
    EXERCISE FILES
    www.dropbox.co...
    TABLE OF CONTENT
    10:32 Writing Reliable Code
    19:52 Defensive Programming
    27:41 Call Stack Window
    29:28 Locals and Autos Windows
    MY OTHER C# TUTORIALS:
    Events and Delegates
    • C# Events and Delegate...
    Generics
    • C# Generics Tutorial: ...
    STAY IN TOUCH
    Website: programmingwith...
    Facebook: / programmingwithmosh
    Twitter: / moshhamedani
  • НаукаНаука

Комментарии • 71

  • @michaelmiller7892
    @michaelmiller7892 5 лет назад +22

    Some of the most in-depth, easy-to-digest information on the subject I've seen. Thanks!

  • @Mohsinkhan-mv9hi
    @Mohsinkhan-mv9hi 10 дней назад

    Sir you easily identified problems in program. but some peoples only made for subscribers and views . but sir you really learn from heart.

  • @yusef2610
    @yusef2610 5 лет назад +3

    I always get happy when I search for C# guides and tips and Mosh shows up in the results. Big up!

  • @urigross
    @urigross 4 года назад +4

    Thank you Mosh for explaining in such a clear language, step by step all the small details.

  • @arrensantos4869
    @arrensantos4869 4 года назад +5

    Awesome Debugging and Defensive programming tutorial. Would like to request that you create a tutorial for error handling, thank you!

  • @armenbakir112
    @armenbakir112 4 года назад +1

    man nice work i watched 8 videos and none of them explained the terms like step in and step out but after watching your video I got thanks to you and your hard work

  • @robertstimmel1100
    @robertstimmel1100 3 года назад +4

    Thank you for this video! You always do such a great job explaining everything! So far, I have only watched your videos for this and data structures\Big O notation. I will be back for more.

  • @supriyanaiya
    @supriyanaiya Год назад +1

    Best debugging video I've ever seen!
    Thank you, Mosh 😇

  • @zackydev
    @zackydev 4 года назад +6

    Can I get an F for respect for all those unlucky people who didn't know that there are C# tutorials from Mosh even after his "Learn C# Basics in 1 Hour" video?

  • @godrises8100
    @godrises8100 11 месяцев назад +3

    Geeez!!! Learned more from the constant ads

  • @achalpandit4038
    @achalpandit4038 Год назад +1

    Awesome video

  • @XXIcenturyblood
    @XXIcenturyblood 10 месяцев назад +1

    10:32 - Writing reliable code
    19:53 - Defensive programming
    27:38 - Call stack
    29:29 - Locals and autos

  • @dayanamarinaavilacastellan3532
    @dayanamarinaavilacastellan3532 2 года назад +3

    using System;
    using System.Collections.Generic;
    namespace CSharpFundamental
    {
    class Program
    {
    static void Main(string[] args)
    {
    var numbers = new List { 8, 9, 10, 11, 12, 13 };
    var smallests = GetSmallests(numbers, 3);
    foreach(var number in smallests)
    Console.WriteLine(number);
    Console.ReadLine();
    }
    public static ListGetSmallests(List list, int count)
    {
    var smallests = new List();
    while(smallests.Count < count)
    {
    var minim = GetSmallest(list);
    smallests.Add(minim);
    list.Remove(minim);
    }
    return smallests;
    }
    public static int GetSmallest(List list)
    {
    //Assume the first number is the smallest
    var min = list[0];
    for (var i = 1; i < list.Count; i++)
    {
    if (list[i] < min)
    min = list[i];
    }
    return min;
    }
    }
    }

  • @kingtyphoon
    @kingtyphoon Год назад

    Hi, this is a awesome tutorial! My first impression is that the syntax of C# looks similar that of JavaScript and PHP.

  • @jacobp4330
    @jacobp4330 9 лет назад +5

    Hello Mosh! Thanks for the quick video. I have a few questions.
    1) So with the Call Stack, as you move back up the stack it shows you what line it last executed in that method before entering the new method? If so that seems like that would be good so that you don't have to read the whole method or wonder where it began to crash. If it is a long method then you can spend a lot of time trying to figure out where and what caused it.
    2) How you know when you should throw an exception verses just alerting the user that his number is invalid? There is a rule of thumb or an article I should read?
    3) How do I know which exception to throw? Do i just create the error and then throw the same exception? Should i learn or memorize a list of exceptions?
    Thanks!

  • @brendanbassett8584
    @brendanbassett8584 5 лет назад +5

    A concise and informative video. Thank you so much!

  • @krishj8011
    @krishj8011 Месяц назад

    Excellent Tutorial...

  • @GoldenAngel3341
    @GoldenAngel3341 5 месяцев назад

    Currently at 10:30 in this video. I also thought to list the shortucts, because I couldn't find them anywhere on this page atm.
    ------------------------------
    F5| Run in debug mode
    Ctrl+F5| Run without debug mode
    Shift+F5| Stop the debug mode
    F9| Breakpoint
    F10| Step Over
    F11| Step Into
    Shift+F11| Step Out

  • @Seanog1231
    @Seanog1231 7 лет назад

    Much appreciated was putting print statements all over the place before.

  • @japhethjay4880
    @japhethjay4880 9 лет назад +1

    I know i might be bugging you right now, but the theme is really important to me, because it helps my vision, i have been putting on lenses for i don't know over 2 decades now, and just recently i started having migraines when i look at too bright a source of light, and most of the themes i use in visual studio even the dark one the white font-color is still too bright, so i just wanted to know more about the settings of the editor, if there is anything else you added after installing resharper.

    • @japhethjay4880
      @japhethjay4880 9 лет назад

      Thanks though, you have it installed, I will check on the syntax highlighting

  • @dosaimre
    @dosaimre 2 года назад

    excellent explanation, as ALWAYS from Mosh! Thanks.

  • @ultron7461
    @ultron7461 3 года назад

    Very good explanation sir. Thank you.

  • @abhayraghuvanshi5199
    @abhayraghuvanshi5199 7 лет назад

    Your tutorial are awesome !! I have completed c# console basics now what should i do next .

  • @paulcurry8383
    @paulcurry8383 2 года назад

    Your visual studio looks different than mine. Do you have any visual mods/settings you’d recommend? Thanks!

  • @veerabhadrarao258
    @veerabhadrarao258 2 года назад

    Clear cut explanation

  • @Young_as_Lenin
    @Young_as_Lenin 5 лет назад +1

    thx, you are talanted teacher

  • @MrSB007
    @MrSB007 3 года назад

    Very helpful! Thank you :)

  • @wgsl2005
    @wgsl2005 9 лет назад +2

    great tutorial!

    • @deadaccount3070
      @deadaccount3070 5 лет назад

      My classmate in 6th grade has the same full name as yours.

  • @jakubhronik8637
    @jakubhronik8637 4 года назад

    Instead of checking for count

  • @bernardchisumo4054
    @bernardchisumo4054 9 лет назад

    Hi
    I am having a error message in the code: Cannot convert from 'System.Collection.Generic.List to 'int'
    Cannot implicity convert 'int' to 'System.Collections.Generic.List . What does it mean?

  • @pel_wang55
    @pel_wang55 2 года назад

    hello can i get help how i can debug a file that was made after the main file
    when i debug a file it only runs the first file of cpp and then it completes it
    it doesn't run the second file that i have coded.
    if i wanted my second file to be debug i made a new project and make a new main file and the past my code there to debug.
    or it compels me write all the codes in one file and debug it.(too much code under one file is really messy)
    is there easy and simpler way to debug a particular file i want?

  • @keithkatane4854
    @keithkatane4854 3 года назад

    Thank you, bro.

  • @timothywoldt8649
    @timothywoldt8649 5 лет назад

    Good stuff! Thanks :)

  • @riscy00
    @riscy00 3 года назад

    Hi, is there reason for not include auto caption or subtitle?

  • @Layarion
    @Layarion 4 года назад

    Could you explain how to have a Application.Tests.Console launched Application.ConsoleUI AND still get debugging abilities in the non-test?

  • @bayoakins1004
    @bayoakins1004 4 года назад

    How do I get help with School assignments? I am a registered subscriber on your C# tutorial website.

  • @shivan2418
    @shivan2418 5 лет назад

    I know that this algorithm is purely illustrative, but does C# not have packages like collections.Counter from python?
    I was messing around with things like this when I started coding, then found out in that collections and itertools had all those functions built already.

  • @abdullahAboelkhair
    @abdullahAboelkhair 3 года назад

    Thank You

  • @nazrussel
    @nazrussel 6 лет назад

    you are simply brilliant. I would like subscribe one of your trainning course but its in dollar currency. I am from UK. How would I subscribe it out of USA.

  • @sahasransupanda8169
    @sahasransupanda8169 2 года назад

    When we are excuting the statement var min= list[0] then the value of min should be 1 but why it's showing 0? Anyone who got this

  • @shallonstrange
    @shallonstrange 2 года назад

    #Mosh 🤩🙌

  • @saifalradhi673
    @saifalradhi673 9 лет назад

    Great Job Mosh , Waiting for The Entity Framework course.
    I'm curious when u will upload it? :)

    • @saifalradhi673
      @saifalradhi673 9 лет назад

      +Programming with Mosh That is fine. at least I can use my effort to prepare for my thesis defense :D

  • @EgyptUnderGroundArmy
    @EgyptUnderGroundArmy 9 лет назад

    first comment :P
    I'm curious where do you come from? your name sounds middle eastern

    • @robertanic7799
      @robertanic7799 9 лет назад

      +EgyptUnderGroundArmy Second :) Great tutorial.

  • @ThePasojim
    @ThePasojim 3 года назад

    A much better solution would be to post decriment the count variable in the while loop. Then you don't need all the convoluted if's and it will run without errors. If you enter return 17 lowest numbers and there are only 3 in the list.... the code returns 3! My solution causes not crashes even if you enter a neg number for the return number. It just returns an empty list//// no crashes no problems. I do not like ode that creates crashes!

  • @semikolon4229
    @semikolon4229 7 лет назад

    Watch window option is missing in my visual studio.
    Which version of visual studio are you using?

    • @andreacicci2058
      @andreacicci2058 4 года назад

      The question is old but here is the answer, the watch option is available only if you are in debug mode (f5).

  • @billythesunbeltsamurainapi3670
    @billythesunbeltsamurainapi3670 7 лет назад

    what about debugging in c

  • @mohammedsadik3974
    @mohammedsadik3974 6 лет назад

    Thanks too much

  • @zsomborv5976
    @zsomborv5976 6 лет назад

    Hello. I tried to solve the problem before going to the next video, what do you think of my solution? The 2nd & 3rd lines tell the user about the issue and ask for a new count-er from 1 to the size of the list. Then I check if the input can be parsed to integer if yes continue normally but if not then ask again. This way even if the input is a letter, symbol, a space or return key press, it will not be an issue.
    while(count < 1 || count > list.Count){
    Console.WriteLine("
    Az elvono ertek vagy kissebb mint 1 vagy nagyobb mint ahany szam van.");
    Console.WriteLine(" Irjon be egy elvono erteket 1-tol " + list.Count + "-ig:");
    var uj_szam = Console.ReadLine();
    bool uj_ = Int32.TryParse(uj_szam, out int count_);
    if(uj_ == false){ continue; }
    count = Int32.Parse(uj_szam);
    Console.Write("
    Ujra szamolunk.
    "); }

    • @zsomborv5976
      @zsomborv5976 6 лет назад

      pastebin.com/6eLySgHE
      Is this good enough or could it have been done better / differently at such a beginner level?

  • @shimaxu
    @shimaxu 9 лет назад

    Can you upload the exercise file, so that it will be easier to follow along with, Thanks

    • @robertanic7799
      @robertanic7799 8 лет назад

      +Programming with Mosh Hi, your skills and knowledge is excellent and one of best I saw in tutorials. Keep up great work. Probably I will subscribe on Udemy for your tutorials to get more skills.

    • @noblejack9882
      @noblejack9882 4 года назад

      @@programmingwithmosh Hi, the link is broken :c could you update it?

  • @DIEZ919191
    @DIEZ919191 11 месяцев назад

    Recorded 8 years ago, still actual 😅

  • @_NgoTanLoc
    @_NgoTanLoc 3 года назад

    I wish this video has sub language. It's hard for me to understand all :v. I maybe have to watch this many times.

  • @roadrageman1210
    @roadrageman1210 7 месяцев назад +4

    CONSOLE APPS ARE USELESS!

    • @teddylu6295
      @teddylu6295 5 месяцев назад

      No, they’re not. Stay away from me with your f* GUI‘s which are slow, cumbersome and inefficient.

  • @mc343cortana5
    @mc343cortana5 6 лет назад

    deploy=eset

  • @vinitpatil4990
    @vinitpatil4990 7 лет назад

    can u make videos on ethnic haking

  • @amsun6201
    @amsun6201 7 лет назад

    Your lesson don't follow any rhythm, jumping from scenario to scenario just confusing beginners.

  • @Mohsinkhan-mv9hi
    @Mohsinkhan-mv9hi 10 дней назад

    Some of the most in-depth, easy-to-digest information on the subject I've seen. Thanks!

  • @Mohsinkhan-mv9hi
    @Mohsinkhan-mv9hi 10 дней назад

    Thank you Mosh for explaining in such a clear language, step by step all the small details.

  • @lifeissnowpiece4505
    @lifeissnowpiece4505 Год назад

    Sir you easily identified problems in program. but some peoples only made for subscribers and views . but sir you really learn from heart.

  • @Mohsinkhan-mv9hi
    @Mohsinkhan-mv9hi 10 дней назад

    Geeez!!! Learned more from the constant ads