No video

Debugging in C# - Finding and Fixing Problems in Your Application

  Рет қаралды 70,485

IAmTimCorey

IAmTimCorey

Күн бұрын

Пікірлер: 111
@AbiyeKetema
@AbiyeKetema 2 жыл бұрын
Debugging has always been a draw back for me because I never had a good teacher or resource like this. Thanks!
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@kozavr
@kozavr Жыл бұрын
I like how you explain everything slowly and going into every detail. Most of the KZfaq bloggers shoot the words like they had to pay KZfaq for every second of their videos.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thank you!
@lungelongcobo9875
@lungelongcobo9875 2 жыл бұрын
Thanks for the lesson Tim , I learnt more about debugging than I did in college , continue the great work.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Awesome!
@jonatancordoba7984
@jonatancordoba7984 4 жыл бұрын
This was actually a lot of fun; it's like a puzzle. You should make a "Debugging of the week" series. Love your content!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thanks for the idea!
@vinuhosanagar1
@vinuhosanagar1 6 жыл бұрын
Thank you. You are very underrated KZfaqr Sir. Once people come to know about your channel, you are going to become too famous, which shall happen very soon :) :)
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
I appreciate the kind words.
@AbiyeKetema
@AbiyeKetema 4 жыл бұрын
@@IAmTimCorey I second that, teachers makes and breaks and you are the best teacher and I love your passion. I love learning and teaching with great passion, I am a programmer but I like to watch tutorials even if I know about it. I learn not only different way of doing stuff other soft skills. Thanks! -aK>
@RalfsBalodis
@RalfsBalodis 4 жыл бұрын
4:23 - test the application for bugs and 5 steps to take when dealing with them 11:01 - "boolean" bug (dealing with user input) 15:43 - "do-while loop" bugs 21:53 - "for loop" bugs 26:32 - debugging the "for loop" 30:02 - "global variable" bugs 43:14 - "class instantiation" bugs 52:35 - testing edge cases and finding more bugs 56:25 - dealing with user input 1:13:15 - "if statement" bug. Flawed calculations. 1:18:27 - video summary and a piece of advice
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thanks! I added them to the description.
@FahadUlHassan
@FahadUlHassan 3 жыл бұрын
Tim, Thanks for your help. According to me, you are the best teacher on C# and Programming.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You're very welcome!
@vartikagupta8816
@vartikagupta8816 3 жыл бұрын
Thats a great video on debugging! I appreciate how patiently you explain every step along the way! Really helpful.
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Glad you enjoyed it!
@korsbar1978
@korsbar1978 3 ай бұрын
You're the best at C# tutorials I've seen so far.
@IAmTimCorey
@IAmTimCorey 3 ай бұрын
Thank you!
@shannonmoss-ehrmantraut6735
@shannonmoss-ehrmantraut6735 Жыл бұрын
This was a well put together, clearly communicated video. Thank you, Tim!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Glad you enjoyed it!
@MrLuckyalmond
@MrLuckyalmond 4 жыл бұрын
D on't panic. R ead that error message. I dentify the purpose of the code that broke. F igure out what breaks that code. T ry a new solution. I love how you said to enjoy debugging. I get really frustrated and self-critical when I have issues, but like you said it's part of programming. And programming is awesome.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Good summary.
@venvilhenrydsilva8354
@venvilhenrydsilva8354 2 жыл бұрын
Simply amazing. Really appreciate the work you put forward, especially the edge cases... and different scenarios.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thank you!
@SomeGuy-be5cq
@SomeGuy-be5cq 6 жыл бұрын
Might be mentioned but im at work atm. _____THIS is so important._____ It's basically more then half of your work sometimes and always the solution to "Don't know why, but it works", not writing millions of lines of new code. The senior developers at work always starts with breaking points and start searching the call stack and not looking at the code at first. Just a tip for someone who just started out as a junior developer or are in school. Great video as always Tim! Cheers!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thanks!
@torrvic1156
@torrvic1156 5 ай бұрын
But how will you learn as to where you should put your breakpoint if you didn’t even understand what it does?
@harag9
@harag9 6 жыл бұрын
Excellent video Tim, even though I'm experienced in this area, I still watched it all. You never know what you tips & tricks you might pick up from others, no matter how experience you are. Couple of my tips - Don't use "double" when you want values for things like currency or hours worked - use "decimal". Decimal is more precise, double is better for fractions. I cringed when I saw you put a double in here :) Breakpoints - Not really covered here, but use it's features (condition breaking, label name). Labels on break points is great, when you have a large application, and currently debugging several issues over a few days. When you look in the breakpoint window (under the debug menu) you can see which breakpoints are for which bugs your trying to fix. e.g. We use "JIRA" A bug system, and I tend to label my breakpoints using the ID number from the jira. I can then quickly disable the ones I'm currently not debugging as debugging sessions can run into multiple days. Comments - Personally I don't like "comments" in code, the code should be clear and variables well named "t", "w", "ttl" - What do these mean? Name them properly - the compiler doesn't care if it's 20 characters long. Pointless comments. I see the below type of comments so many times... // Refresh the form. myFormName.Refresh(); The code tells the developer what it's doing, the comment is pointless and makes the code look messy. However you use use the XML comments - the ones with 3 slashes and comment your classes & methods etc.! Again great video for the new developers!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thanks for the comments. The only place I'll disagree is on the double. Decimal is much more expensive to use and work with so we typically reserve it for only those areas that need a much higher precision (monetary operations). The precision of double is not as great but that is relative. A double is precise to 15 places (vs 28 places for a decimal). So, if you need those extra 13 places of precision, go for it. However, I don't think hours worked falls in that category.
@AbiyeKetema
@AbiyeKetema 4 жыл бұрын
@@IAmTimCorey Why not use float? Won't it be more efficient?
@torrvic1156
@torrvic1156 5 ай бұрын
Brilliant and very realistic lesson! Funny but sad thing is that I had a situation in my life when company paid me less because of the mistake in their software. They did not wanted to fix it and so they just didn’t paid me part of my money. I’ve had to argue with them and only after long and nasty conversations they agree to pay me my money.
@IAmTimCorey
@IAmTimCorey 5 ай бұрын
Thanks for sharing!
@EmersonWiller
@EmersonWiller 3 жыл бұрын
Hi Corey. Thank you for the video. Despite all things I learned here, definitely, the last part (piece of advice) was that you rock on!
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
You are welcome.
@Dame4Lyf3
@Dame4Lyf3 6 жыл бұрын
People always say Mondays are the worse, I look forward because I know Tim will be dropping knowledge. I try to approach debugging by thinking like the user as I write, i.e let me put a letter in number box, this help me track the potential spots to check, appreciate the insight you provide on a weekly basis, looking for to another awful Monday next week 👊
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
I do try to bring a bit of enjoyment to Monday. I'm glad it gives you something to look forward to.
@adhoom
@adhoom 6 жыл бұрын
you are like one of the most underrated guys on youtube and that bothering me
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
It takes time. I'm ok with that. I'm just glad I get to help so many people.
@torrvic1156
@torrvic1156 5 ай бұрын
Maybe because there are not so many programmers overall and it is kind of a rare profession.
@jaytran247
@jaytran247 2 жыл бұрын
thanks a lot for putting alot of effort making this video. really love this.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Glad you enjoyed it!
@YesYou123333
@YesYou123333 6 жыл бұрын
The reason so many applications look like a mess out in the real world is because your boss wants it RIGHT NOW!!!! You don't have time to do it the right way. Too many software companies are lead by non-programmers that have NO IDEA what object orientation is OR EVEN CARE. You don't have time to write logging classes or create Exception classes that make the program easier to debug later.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
I agree to an extent. I've been there. You need to get code out the door ASAP (or before) so you rush through a fix. However, there are ways to still write good code fast. One way is to reuse code properly (no copy and paste). That allows for bigger fixes in shorter amounts of time. Another is to build trust with your boss over time. Then you can demonstrate how a little extra time can eliminate a lot of debugging time later. The problem is most rookie developers try to push this from day one and they over-exaggerate the benefits and underestimate the time involved. They want to spend four weeks on a simple fix to "do it right". There is a balance and, if you don't hit it correctly, you burn yourself (and the next guy who comes along) for next time with your boss.
@boneyabraham7506
@boneyabraham7506 4 жыл бұрын
Thanks Tim. I will definitely follow strategies you have outlined.
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Excellent!
@bharathyadav3614
@bharathyadav3614 6 жыл бұрын
Kudos to the condition using TryParse. Learn’t something new. As always, great tutorial Corey. Keep it coming.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Cool. Glad you saw something new to put in your toolbox.
@risechess7114
@risechess7114 8 ай бұрын
a lot to learn in this video thanks, i think u will do a do while loop in the next video for the first section, and some improvment could be to prevent the user from entering a negative number and not above 100 hour maybe and put the user in loop until he answer clear answer, also for yes or no we can force him to enter yes or no and put him in loop if he answer yeah or naaa until he give clear answer yes or no. and maybe if first question making sure he enter acme or abc if something else we also put him in loop. never trust the user :)
@IAmTimCorey
@IAmTimCorey 8 ай бұрын
I am glad it was helpful.
@krossruiz1657
@krossruiz1657 5 жыл бұрын
Every programmer needs to watch this video. If they did, the world would be a better place.
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
:-)
@adhoom
@adhoom 6 жыл бұрын
man, i really love you thanks a lot
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
I'm glad you enjoyed it.
@anoopkothapally5000
@anoopkothapally5000 11 ай бұрын
Great session Tim!! Very insightful
@IAmTimCorey
@IAmTimCorey 11 ай бұрын
I am glad it was helpful.
@edvinbroman2587
@edvinbroman2587 6 жыл бұрын
Hey Tim, I love your videos. Although as a beginner I feel like they're very difficult. I have a inquery, Would you wanna briefly cover how to communicate through different forms? Example: how to edit a variables value through another form. Thank you so much. And keep doing your thing!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
I do cover that in my C# Application from Start to Finish course (which you can find here on KZfaq for free or you can buy to get the source code and other bonuses). We take information from one form and move it to another quite a bit.
@LiakatHossain
@LiakatHossain 6 жыл бұрын
Good example but in real world you have to fight with complex stored Procedure models with complex database. To learn basic debug good video. Thanks for sharing
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
It all depends on the project. I rarely have to debug around stored procedures. More often it is the C# itself that causes the issues. By the time I wire up a stored procedure, it has already been tested and validated.
@boyanpetrov4628
@boyanpetrov4628 4 жыл бұрын
nice one Tim! ->nuggets in every video
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Thanks!
@vikramupadhyay7668
@vikramupadhyay7668 3 жыл бұрын
14:43 , if u take true, it will not allow you to enter what what you did.
@syafiqbasri_
@syafiqbasri_ Жыл бұрын
Nice advice. Thanks!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@brunokucevic4288
@brunokucevic4288 6 жыл бұрын
Could you please do a video on Func and Action in c#???? I love your videos and i think youll be able to thoroughly describe its functions in real world.
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
I'll be covering them in my upcoming delegates video. :-)
@brunokucevic4288
@brunokucevic4288 6 жыл бұрын
Excellent. Cant wait. Them delegates have been an enigma for me so far.
@maricelpurusniuc7038
@maricelpurusniuc7038 2 жыл бұрын
Great video! I've learned this the hard way..I'm still fighting the D from DRIFT. This could be referenced in schools
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
Thanks!
@RalfsBalodis
@RalfsBalodis 4 жыл бұрын
3:41 15 mins to fix it. With explaining every thing step by step, it took one and a half hours. So this raises a some of questions. Was that a reasonable statement? What if one can't do it in 15 mins? How does one knows if he's ready (good enough) to even attempt to get his 1st c# job? How efficient you have to be? How to test your self? Maybe you could expand on issues like these in your dev question series? I know you have a video about "how to get a c# job", but I feel that it's more for people that already has some kind of job experience in the first place. What do you do when you are self taught, have no official education in this field, and have 0 job experience as a programmer (not counting ones own test apps)? :)
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
I will add it to the list. Thanks for the suggestion.
@Vadim-kt3yq
@Vadim-kt3yq 6 жыл бұрын
Your video fixed bugs in mind :)
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
:-)
@williamFrSFO16
@williamFrSFO16 6 жыл бұрын
Hi Tim! Thank you for the great videos! I tried for the mailing list; gets to 50% and stops. Anyway, good job and thanks again!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Hmmm, not sure why. I just tested it and it worked. Can you try again? Make sure you fill in the fields fully. Maybe it was a bad character or something.
@williamFrSFO16
@williamFrSFO16 6 жыл бұрын
Hi Tim! Thanks! I'm in. 'Not sure what it was, but it could be MS Edge. 'Used Chrome this time. Great tutorials . . . So much to see!
@onyebuchiboss
@onyebuchiboss 6 жыл бұрын
Tim, how will you advise new junior developers to read and understand bunch of codes that was written over years. I find myself in such situation ??
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
That can be tough. Try to learn one little piece at a time. If possible, write code comments over every method or tricky bit of code once you understand it. That way you will remember later and it will make your application more understandable over time.
@onyebuchiboss
@onyebuchiboss 6 жыл бұрын
IAmTimCorey Thank you! This is a tough job
@mohammadranjbaran1897
@mohammadranjbaran1897 2 жыл бұрын
Thank you very much.
@IAmTimCorey
@IAmTimCorey 2 жыл бұрын
You are welcome.
@zackisser2451
@zackisser2451 6 жыл бұрын
YOU DESERVE MORE VIEWS !!!!!!!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thanks!
@tavishithapa6730
@tavishithapa6730 6 жыл бұрын
very good sir
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thanks!
@theramblingbrit4431
@theramblingbrit4431 3 жыл бұрын
If this is a legacy piece of code would it not be appropriate to keep it so that users putting true will enter something else in the datasheet (as well as using yes)? Some users will have gotten used to that as an entry field and whilst this is a relatively simple application and the changes wouldn't make a huuuge difference to the user experience, on something more complex it could be a bigger issue. Very good video though! Learnt a lot from your stuff, just thought if you're representing it as if it's an active piece of code it would perhaps be a good idea to mention restrictions like backwards compatibility you might be placed under :)
@abdallahdamra5602
@abdallahdamra5602 10 ай бұрын
hello @ 21:39 for this code string answer = Console.ReadLine(); cont = false; if(answer.ToLower() == "yes") { cont = true; } I did it like this string answer = Console.ReadLine(); while (true) { answer = answer.ToLower(); if ((answer != "yes") && (answer != "no")) { Console.WriteLine("Please enter yes or no"); answer = Console.ReadLine(); } else { break; } } Is my version better because it can handle input other than yes and no? and is it better to place it in a function?
@hollyjo161821
@hollyjo161821 4 жыл бұрын
Thank you. Thank you. Any tips on debugging massssive solutions? Having issue debugging css, everything is labeled !important and overrides everywhere? Again, Thank you!
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
Ouch. That's a messy situation. Ideally, you would back out those !important flags. Those are ideally never used because they break the natural working of CSS. I don't have many suggestions other than to try eliminating them. It will cause more short-term issues but long-term, it will be better for your project.
@amjadmahmood5904
@amjadmahmood5904 6 жыл бұрын
Wonderful!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Thanks!
@adilet123
@adilet123 6 жыл бұрын
It's really useful for beginners. I learned a phrase: I worked at acme. :) Thank you!
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
:-)
@akshitdas2012
@akshitdas2012 3 жыл бұрын
Hi Tim... I have two questions... 1. Is there any way to obtain the name of the company from the User input and later using it while writing "Simulating Email..."? 2. I'm trying my best but I couldn't figure out why I'm getting an exception if I enter an instance of Acme then ABC and then again Acme. Could you please help me with that?
@torrvic1156
@torrvic1156 5 ай бұрын
It seems like you didn’t heard the latest part of what he said…
@peteredenburg6464
@peteredenburg6464 6 жыл бұрын
Hi Tim, I think I'm doing something wrong here, because when I clicked the link from the YT video to get here for the source code download, I got the source code for your previous video on Events. Although the link to the debugging source code is named Events Demo on your blog site... Love to hear from you, Greetings, Peter
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
Nothing wrong on your part. That was my issue. I had a problem uploading the files but I forgot to come back to it. I just fixed them so they should be correct now. Thanks for letting me know.
@wiktoriaciesla1870
@wiktoriaciesla1870 6 жыл бұрын
Hello! Question for the debugging professionals: What you think about reverse debugging technology? Have you ever tried it? How does it work in practice? I want to buy RevDebug because it looks promising, especially the ability to debug on production. Is that a good choice?
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
RevDebug has some nice features. I haven't used it myself but I've looked it over. However, some of this is built into Visual Studio. You can replay your debugging session or even go backwards in debugging right inside Visual Studio. I'm going to have to do a video on it at some point. It is really cool stuff.
@tnrfiles
@tnrfiles 3 жыл бұрын
I clicked for most source codes but still not got them. Is there any problem with posting them?
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
I'm sorry that you are experiencing problems getting the files. Please email Help@IamTimCorey.com to request a resend. You must include to specific video reference so I know which files to send you. Thank you for being a part of the IamTimCorey community.
@vijaymohan7150
@vijaymohan7150 5 жыл бұрын
please can you rectify my problem.. I am getting Breakpoint will not currently be hit. No symbols loaded for this document in visual studio.. please suggest me what to do?
@IAmTimCorey
@IAmTimCorey 5 жыл бұрын
It sounds like you are running a version of your application that does not quite match your code. The most likely reason is that when you run your application, it tells you that the application failed to compile and asks if you would like to run the last known good configuration. In that case, your code is broken at compile time and you need to address that first. Another option is that you just need to do a Rebuild. That will clean out the old versions and ensure your code matches what is running.
@vijaymohan7150
@vijaymohan7150 5 жыл бұрын
@@IAmTimCorey Thank You sir, its very pleasure.. my problem is rectified, i am really thankful to you... and one more thing such an immediate response from you, i didn't expect this which is really happened.. once again thank you sir..
@LuigiZambetti
@LuigiZambetti 6 жыл бұрын
Hi Tim, what do you think about ASP.NET SignalR? Could be useful make a video on this topic too?
@IAmTimCorey
@IAmTimCorey 6 жыл бұрын
It is a good technology. I'll definitely be doing a video on it at some point.
@MemoryLane396
@MemoryLane396 3 жыл бұрын
hi Tim Thanks for all your content. I could not receive the source code from the source code link after registering
@IAmTimCorey
@IAmTimCorey 3 жыл бұрын
Please sent an email to Help@iamtimcorey.com with the video that you need to source code for.
@fadizakzouk2084
@fadizakzouk2084 4 жыл бұрын
Maaannnnn get to the point instead of saying don't panic for 5 min... Anyway thx for the video :/
@IAmTimCorey
@IAmTimCorey 4 жыл бұрын
That was part of the point. Teaching isn't just about demoing the tip. Instead, it is helping the students actually use it in the real world. Part of that is teaching that feeling overwhelmed is normal and step one is to not panic. If people don't get past that part, it doesn't matter how well they know the debugging tools, they will fail.
Delegates in C# - A practical demonstration, including Action and Func
1:09:11
My Cheetos🍕PIZZA #cooking #shorts
00:43
BANKII
Рет қаралды 27 МЛН
طردت النملة من المنزل😡 ماذا فعل؟🥲
00:25
Cool Tool SHORTS Arabic
Рет қаралды 10 МЛН
Идеально повторил? Хотите вторую часть?
00:13
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 18 МЛН
Can This Bubble Save My Life? 😱
00:55
Topper Guild
Рет қаралды 70 МЛН
C# Dependency Injection with Autofac
54:45
IAmTimCorey
Рет қаралды 294 М.
Python Debugging (PyCharm + VS Code)
24:18
mCoding
Рет қаралды 36 М.
How To Debug React Apps Like A Senior Developer
21:07
Web Dev Simplified
Рет қаралды 121 М.
Mocking in C# Unit Tests - How To Test Data Access Code and More
1:02:34
Don't throw exceptions in C#. Do this instead
18:13
Nick Chapsas
Рет қаралды 256 М.
My Cheetos🍕PIZZA #cooking #shorts
00:43
BANKII
Рет қаралды 27 МЛН