Debugging C# Code in Visual Studio | Mosh

Debugging C# Code in Visual Studio | Mosh

Programming with Mosh

8 лет назад

358,402 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

God Rises
God Rises - 11.10.2023 23:36

Geeez!!! Learned more from the constant ads

Ответить
DIEZ919191
DIEZ919191 - 04.10.2023 20:47

Recorded 8 years ago, still actual 😅

Ответить
King Typhoon
King Typhoon - 21.08.2023 17:45

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

Ответить
Achal Pandit
Achal Pandit - 19.07.2023 20:57

Awesome video

Ответить
Supriya Naiya
Supriya Naiya - 21.12.2022 18:01

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

Ответить
Life is snow piece
Life is snow piece - 26.09.2022 21:27

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

Ответить
Paul Curry
Paul Curry - 07.06.2022 03:59

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

Ответить
Sahasransu Panda
Sahasransu Panda - 18.04.2022 08:04

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

Ответить
Pel_wang
Pel_wang - 17.02.2022 01:41

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?

Ответить
Dayana Marina Avila Castellano
Dayana Marina Avila Castellano - 16.01.2022 22:21

using System;
using System.Collections.Generic;

namespace CSharpFundamental
{
class Program
{
static void Main(string[] args)
{
var numbers = new List<int> { 8, 9, 10, 11, 12, 13 };
var smallests = GetSmallests(numbers, 3);

foreach(var number in smallests)
Console.WriteLine(number);
Console.ReadLine();
}

public static List<int>GetSmallests(List<int> list, int count)
{
var smallests = new List<int>();

while(smallests.Count < count)
{
var minim = GetSmallest(list);
smallests.Add(minim);
list.Remove(minim);
}
return smallests;
}
public static int GetSmallest(List<int> 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;
}
}
}

Ответить
Imre Dosa
Imre Dosa - 27.12.2021 12:34

excellent explanation, as ALWAYS from Mosh! Thanks.

Ответить
Veerabhadra Rao
Veerabhadra Rao - 16.12.2021 10:39

Clear cut explanation

Ответить
Abdullah Aboelkhair
Abdullah Aboelkhair - 22.07.2021 21:41

Thank You

Ответить
S B
S B - 18.05.2021 10:47

Very helpful! Thank you :)

Ответить
Robert Stimmel
Robert Stimmel - 08.05.2021 05:01

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.

Ответить
Keith Katane
Keith Katane - 15.04.2021 20:18

Thank you, bro.

Ответить
3367_Ngô Tấn Lộc
3367_Ngô Tấn Lộc - 07.03.2021 10:10

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

Ответить
James Larsen
James Larsen - 02.12.2020 03:51

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!

Ответить
ultron
ultron - 22.11.2020 23:26

Very good explanation sir. Thank you.

Ответить
Richard Payne
Richard Payne - 15.10.2020 16:22

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

Ответить
Zacky
Zacky - 01.08.2020 16:44

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?

Ответить
Jakub Hroník
Jakub Hroník - 01.06.2020 11:43

Instead of checking for count<0 and throwing an exception, would't it be more expressive to just have count be a uint?
And why disallow count == 0? That seems to me like a perfectly legit situation.

Ответить
Arren Santos
Arren Santos - 25.04.2020 06:19

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

Ответить
THE NO.1 CHANNEL
THE NO.1 CHANNEL - 12.04.2020 23:23

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

Ответить
armen bakir
armen bakir - 08.04.2020 07:27

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

Ответить
Layarion
Layarion - 25.03.2020 03:55

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

Ответить
Bayo Akins
Bayo Akins - 03.02.2020 12:51

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

Ответить
shivan2418
shivan2418 - 06.10.2019 14:49

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.

Ответить
Yusof AF
Yusof AF - 20.09.2019 15:00

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

Ответить
Timothy Woldt
Timothy Woldt - 11.07.2019 06:10

Good stuff! Thanks :)

Ответить
Michael Miller
Michael Miller - 05.03.2019 15:21

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

Ответить
Vitali Oja
Vitali Oja - 16.02.2019 20:24

thx, you are talanted teacher

Ответить
Brendan Bassett
Brendan Bassett - 26.10.2018 21:39

A concise and informative video. Thank you so much!

Ответить
Zsombor V
Zsombor V - 15.08.2018 19:35

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("\n 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("\n Ujra szamolunk. \n"); }

Ответить
mohammed Sadik
mohammed Sadik - 31.07.2018 00:52

Thanks too much

Ответить
Mc343 Cortana
Mc343 Cortana - 25.01.2018 08:20

deploy=eset

Ответить
Nazmul Hassan
Nazmul Hassan - 19.01.2018 15:31

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.

Ответить
thenewAdamB98
thenewAdamB98 - 16.10.2017 11:05

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

Ответить
Am Sun
Am Sun - 19.08.2017 06:25

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

Ответить
Abhay Raghuvanshi
Abhay Raghuvanshi - 04.08.2017 10:24

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

Ответить
Billy
Billy "The Sunbelt Samurai" Napier - 10.04.2017 22:32

what about debugging in c

Ответить
vinit patil
vinit patil - 23.01.2017 20:26

can u make videos on ethnic haking

Ответить
Semi Kolon
Semi Kolon - 22.01.2017 16:14

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

Ответить
Japheth Jay
Japheth Jay - 23.10.2015 07:50

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.

Ответить
Bernard Chisumo
Bernard Chisumo - 22.09.2015 14:43

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

Ответить
jacob p
jacob p - 22.09.2015 00:39

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!

Ответить
saif alradhi
saif alradhi - 20.09.2015 03:38

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

Ответить