00:00:04.188 --> 00:00:10.914 You can go over the other if you want insomnia, the other others,
00:00:10.914 --> 00:00:13.258 but take it away, yeah.
00:00:11.328 --> 00:00:14.518 The other others. OK, yeah.
00:00:14.848 --> 00:00:17.968 Alright, so yeah, we're gonna talk a little bit about.
00:00:20.308 --> 00:00:25.110 Back in debugging and I figured it would make sense to have some
00:00:25.110 --> 00:00:29.838 of the front end team here just because you know sometimes when
00:00:29.838 --> 00:00:33.828 you're working on front end stuff, believe it or not,
00:00:33.828 --> 00:00:38.408 sometimes back in code has bugs that happens, sometimes it's.
00:00:38.458 --> 00:00:40.778 I know it's hard to believe you may have.
00:00:40.788 --> 00:00:41.428 Never even seen it?
00:00:42.218 --> 00:00:46.316 Umm, but in those scenarios it it helps that you guys also know
00:00:46.316 --> 00:00:50.094 how to troubleshoot them and at the very least to get more
00:00:50.094 --> 00:00:53.808 information on the problem before somebody else has to go
00:00:53.808 --> 00:00:57.778 through the entire repro process and at best maybe you know a
00:00:57.778 --> 00:01:01.685 little bit on how to debug it and you end up finding exactly
00:01:01.685 --> 00:01:04.118 what the problem is in the 1st place.
00:01:04.128 --> 00:01:07.364 And as I you're unblocked and you don't have to wait for
00:01:07.364 --> 00:01:10.771 somebody else to get a ticket, make make a fix, do a PR, et
00:01:10.771 --> 00:01:11.168 cetera.
00:01:11.398 --> 00:01:13.428 So. Umm.
00:01:13.508 --> 00:01:15.498 So yeah, let me see.
00:01:15.508 --> 00:01:21.729 I was working on uh PCs, so I'll see if I can find something on
00:01:21.729 --> 00:01:22.118 PCs.
00:01:22.128 --> 00:01:22.808 That's Nat.
00:01:23.188 --> 00:01:28.608 There's PCs to find something on TCS that we can debug.
00:01:36.708 --> 00:01:40.759 It's still spinning up a thing because I restarted the app pool
00:01:40.759 --> 00:01:44.240 a little bit ago for a build, but I guess I could just
00:01:44.240 --> 00:01:47.468 purposely actually let me check this UAT document.
00:01:47.478 --> 00:01:48.668 Maybe it's got a bug I can fix.
00:01:51.078 --> 00:01:51.938 Two birds, one stone.
00:01:58.958 --> 00:02:00.108 OK, not really.
00:02:00.178 --> 00:02:03.088 Most of these are like are they fixed or?
00:02:05.958 --> 00:02:06.948 Or front end related.
00:02:09.808 --> 00:02:10.098 OK.
00:02:10.108 --> 00:02:10.598 Well, that's fine.
00:02:13.308 --> 00:02:13.678 That's.
00:02:13.688 --> 00:02:14.498 You know, that's fine.
00:02:14.508 --> 00:02:15.088 Let's go over here.
00:02:15.928 --> 00:02:19.078 Umm never mind, I just remembered where bug is.
00:02:19.668 --> 00:02:21.098 I'm sorry, I'm all over the place right now.
00:02:21.148 --> 00:02:21.748 I'm very tired.
00:02:23.018 --> 00:02:26.980 Umm, so I keep noticing every time I load the admin on PCs
00:02:26.980 --> 00:02:30.942 that this top ten winners call happens but it errors every
00:02:30.942 --> 00:02:31.278 time.
00:02:31.518 --> 00:02:33.738 I don't know where it's supposed to be or what it was for.
00:02:33.748 --> 00:02:33.988 I don't.
00:02:33.998 --> 00:02:37.627 I think it's not something that's being used anymore, but
00:02:37.627 --> 00:02:41.256 some things still making the network call and the network
00:02:41.256 --> 00:02:43.008 call has this error message.
00:02:44.058 --> 00:02:48.004 Umm, those of us who who work in back end code regularly or have
00:02:48.004 --> 00:02:51.404 have been here for a minute probably know what this one
00:02:51.404 --> 00:02:51.768 means.
00:02:53.478 --> 00:02:57.367 But for those that don't, uh, this is what happens when you
00:02:57.367 --> 00:03:01.580 try to read a property or call a method or etcetera on something
00:03:01.580 --> 00:03:02.358 that's null.
00:03:02.948 --> 00:03:06.579 So it's this is effectively the same thing for C sharp as like
00:03:06.579 --> 00:03:09.518 cannot read properties of undefined in JavaScript.
00:03:10.398 --> 00:03:11.698 Umm these two?
00:03:12.458 --> 00:03:15.418 These two are the same, uh.
00:03:15.428 --> 00:03:20.391 So let's say that I wanted to figure out why this was breaking
00:03:20.391 --> 00:03:21.258 and fix it.
00:03:21.848 --> 00:03:25.544 Well, the first thing that I will probably do is check, you
00:03:25.544 --> 00:03:29.240 know, basic stuff for what I'm sending, as does the payload
00:03:29.240 --> 00:03:29.918 make sense?
00:03:29.928 --> 00:03:33.137 Do I know of anything that should be sent on this that's
00:03:33.137 --> 00:03:36.458 missing, which in this case I'm assuming this is good, but
00:03:36.458 --> 00:03:39.779 that's always a good place to start with debugging is am I
00:03:39.779 --> 00:03:43.438 even sending the right thing or am I calling the right endpoint?
00:03:44.178 --> 00:03:47.528 Umm, every now and then that gets you.
00:03:48.018 --> 00:03:51.702 It's it's pretty rare, but it's still a good good first step
00:03:51.702 --> 00:03:55.205 because I have caught myself sending, you know, I'll I'll
00:03:55.205 --> 00:03:58.466 notice that the wrong information, something I didn't
00:03:58.466 --> 00:04:02.150 expect is being sent and and it turns out that the maybe the
00:04:02.150 --> 00:04:05.532 back end code could be more robust and give me a better
00:04:05.532 --> 00:04:06.378 error message.
00:04:06.388 --> 00:04:09.881 But I am also sending it whatever you know, malformed
00:04:09.881 --> 00:04:12.468 payload or something and it's my fault.
00:04:12.888 --> 00:04:17.095 For whatever front end thing I'm writing at that time, but this
00:04:17.095 --> 00:04:20.973 looks like everything's OK, so the next thing that I would
00:04:20.973 --> 00:04:25.048 probably want to do is go find this endpoint on the back end.
00:04:25.868 --> 00:04:26.478 Umm.
00:04:26.808 --> 00:04:33.839 And on that note, does anyone who uh, who isn't on the back
00:04:33.839 --> 00:04:40.518 end team want to tell me where I would start to do that?
00:04:40.588 --> 00:04:40.708 That.
00:04:46.088 --> 00:04:46.588 The headers.
00:04:48.678 --> 00:04:50.158 To find the headers tab OK.
00:04:51.738 --> 00:04:57.848 And the NPC after API, dash, whatever side you're on.
00:04:58.648 --> 00:05:01.528 OK, so I'm on the admin so we're looking at API admins.
00:04:58.998 --> 00:05:00.268 So in this case.
00:05:01.538 --> 00:05:02.808 You saying everything after this?
00:05:03.618 --> 00:05:04.648 Well, not everything.
00:05:04.658 --> 00:05:06.478 I'd take everything up to the question, mark.
00:05:07.178 --> 00:05:07.408 OK.
00:05:08.618 --> 00:05:09.068 Nice.
00:05:09.478 --> 00:05:10.488 That is correct.
00:05:10.558 --> 00:05:11.518 That's a place to get it.
00:05:10.828 --> 00:05:10.998 Then.
00:05:11.528 --> 00:05:14.066 You can also get it by just like mousing over this and you can
00:05:14.066 --> 00:05:16.685 see that it's in the little tool tip, but this actually lets you
00:05:16.685 --> 00:05:17.128 copy paste.
00:05:17.138 --> 00:05:20.558 So umm, I'll copy that.
00:05:21.488 --> 00:05:24.553 And like Michael said, you don't need and and specifically in
00:05:24.553 --> 00:05:27.421 this case you don't want the query parameters that are on
00:05:27.421 --> 00:05:28.558 this because we're not.
00:05:29.068 --> 00:05:31.238 That's just data we're sending to the back end.
00:05:31.248 --> 00:05:36.447 We need to find the actual route that we're looking at, so
00:05:36.447 --> 00:05:41.821 include the leading slash and copy that and go back into the
00:05:41.821 --> 00:05:43.848 code and the next step.
00:05:43.898 --> 00:05:46.486 The easiest way to find these typically is I'll just control
00:05:46.486 --> 00:05:49.158 shift F, which will usually it will open the find and replace,
00:05:49.158 --> 00:05:50.728 but I just have it docked down here.
00:05:50.738 --> 00:05:53.888 Can I use it all the time you paste it there and hit enter?
00:05:54.138 --> 00:05:57.088 If it doesn't come up, you might need to make sure that this is
00:05:57.088 --> 00:05:58.148 set to entire solution.
00:05:58.158 --> 00:06:00.908 Make sure that your file type isn't filtering out CSS files.
00:06:01.138 --> 00:06:04.394 Basic stuff like that make sure match case isn't on match whole
00:06:04.394 --> 00:06:04.648 word.
00:06:04.658 --> 00:06:08.740 All that, just make sure that this it looks like this
00:06:08.740 --> 00:06:13.048 basically, but on that search result it found the route.
00:06:13.478 --> 00:06:16.988 So this is the endpoint in question.
00:06:18.258 --> 00:06:23.271 Umm, which doesn't have any required out and occasions so
00:06:23.271 --> 00:06:24.308 that's good.
00:06:25.788 --> 00:06:27.128 It's like required role.
00:06:29.378 --> 00:06:30.198 Yeah, right like that.
00:06:32.468 --> 00:06:33.838 We're going to make that require a roll.
00:06:35.468 --> 00:06:39.521 That's not relevant to debugging, but just you know,
00:06:39.521 --> 00:06:40.898 while I'm in here.
00:06:41.788 --> 00:06:45.612 OK, so the next actually I'm gonna remove that because it's
00:06:45.612 --> 00:06:49.436 gonna make it not able to attach so, but I'll remember that
00:06:49.436 --> 00:06:50.838 that's there probably.
00:06:51.648 --> 00:06:53.508 OK, so we found our route.
00:06:54.198 --> 00:06:59.951 Umm, the next step to this is we want to find the route handler
00:06:59.951 --> 00:07:02.648 so in service stack there's a.
00:07:02.718 --> 00:07:06.577 This class defines the actual route itself, so you can see
00:07:06.577 --> 00:07:09.848 that it defines the path that hits this endpoint.
00:07:09.978 --> 00:07:15.066 The verb uh and the members of the class here are the body, or
00:07:15.066 --> 00:07:17.328 in this case the parameters.
00:07:17.338 --> 00:07:19.928 Since it's a get and point that we can send.
00:07:20.958 --> 00:07:21.558 Umm.
00:07:22.108 --> 00:07:23.028 So let's start dating it.
00:07:23.038 --> 00:07:27.005 Date, which as we saw we were in fact sending start date and end
00:07:27.005 --> 00:07:30.178 date and they are not misspelled or anything weird.
00:07:30.188 --> 00:07:30.938 So those are correct.
00:07:32.898 --> 00:07:37.155 So we go back over here depending on if you have code
00:07:37.155 --> 00:07:41.884 lens on or not, you can click this one reference and you'll
00:07:41.884 --> 00:07:45.668 usually see a public async task blah blah blah.
00:07:45.838 --> 00:07:47.903 You can just double click on that and it takes you to the
00:07:47.903 --> 00:07:48.188 handler.
00:07:48.418 --> 00:07:51.730 If you don't have code lens on which is just this little extra
00:07:51.730 --> 00:07:54.780 piece up here, the next thing you can do is you can right
00:07:54.780 --> 00:07:58.040 click on the class name here and then find all references and
00:07:58.040 --> 00:08:01.404 you'll get that sort of similar thing down here and again, just
00:08:01.404 --> 00:08:02.088 double click.
00:08:03.158 --> 00:08:07.398 Alright, so yeah, was it?
00:08:04.218 --> 00:08:07.748 Brendan, I had a quick question regarding this.
00:08:08.178 --> 00:08:12.431 How does it know that this is the handler that's associated
00:08:12.431 --> 00:08:13.778 with that endpoint?
00:08:13.788 --> 00:08:18.227 Like I usually search by the class, but like it's kind of
00:08:16.638 --> 00:08:16.898 Umm.
00:08:18.227 --> 00:08:22.896 just giving the class to the function you know argument like
00:08:22.896 --> 00:08:23.968 what actually.
00:08:23.188 --> 00:08:23.588 Yeah.
00:08:24.008 --> 00:08:26.062 Is there something behind the scenes like mapping that
00:08:26.062 --> 00:08:26.398 together?
00:08:27.308 --> 00:08:27.918 That's just.
00:08:27.928 --> 00:08:31.338 Yeah, that's service stack. The way.
00:08:30.568 --> 00:08:31.188 Surface that.
00:08:31.488 --> 00:08:34.798 Yeah, service stack is a third party service that we use.
00:08:35.328 --> 00:08:39.568 It's a a library that basically just makes building.
00:08:41.198 --> 00:08:42.888 I'm trying to be as nice as I can.
00:08:42.898 --> 00:08:44.348 I don't like service stack personally.
00:08:42.928 --> 00:08:44.238 Go ahead and say it, Brendan.
00:08:44.308 --> 00:08:45.118 Go ahead and say it.
00:08:44.558 --> 00:08:44.758 Yeah.
00:08:45.658 --> 00:08:48.448 Uh, just getting my opinion out of the way immediately.
00:08:48.458 --> 00:08:53.042 I personally don't like service deck, but well it it is a rest
00:08:53.042 --> 00:08:57.190 server building library basically among other things and
00:08:57.190 --> 00:09:00.828 primarily we use it for building our rest server.
00:09:01.398 --> 00:09:06.134 So this is just the way that service Stack works is you have
00:09:06.134 --> 00:09:10.793 a service class umm and that service class has methods that
00:09:10.793 --> 00:09:14.908 are called get or post or probably all gets in here.
00:09:14.918 --> 00:09:16.158 There might be a post somewhere.
00:09:16.638 --> 00:09:17.438 It doesn't matter anyway.
00:09:17.998 --> 00:09:22.687 Umm, your methods are called whatever verb, so get or post or
00:09:22.687 --> 00:09:24.048 patch or whatever.
00:09:24.278 --> 00:09:29.054 And the argument to that is the request that's being sent in and
00:09:29.054 --> 00:09:33.462 service stack uses reflection, which is a C magic umm to at
00:09:33.462 --> 00:09:37.577 runtime collect all of these methods and then basically
00:09:37.577 --> 00:09:42.132 between their name and the type of the first argument, figure
00:09:42.132 --> 00:09:46.982 out which route those correspond to, and then set up so that this
00:09:46.982 --> 00:09:50.288 method gets called when that route gets hit.
00:09:51.668 --> 00:09:53.678 So it's all inside service stack.
00:09:53.688 --> 00:09:56.807 It's not CEF code, it's not something that we, uh, maintain
00:09:56.807 --> 00:09:59.978 or need to really worry about, because if that breaks, we've
00:09:59.978 --> 00:10:01.018 got bigger problems.
00:10:01.518 --> 00:10:04.538 Uh, so. But it.
00:10:01.788 --> 00:10:04.778 You can that was helpful.
00:10:05.308 --> 00:10:06.658 Yeah, cool.
00:10:06.708 --> 00:10:13.318 Alright, so when I go back up here and OK, that's right.
00:10:13.328 --> 00:10:14.668 Thought it was so.
00:10:14.718 --> 00:10:17.188 Now we know exactly where we're actually going to.
00:10:20.308 --> 00:10:22.894 We're actually going to hit in the code when this when this
00:10:22.894 --> 00:10:25.567 method gets called or when this endpoint gets called from the
00:10:25.567 --> 00:10:25.998 front end.
00:10:26.968 --> 00:10:29.898 So this is kind of your your start point.
00:10:32.488 --> 00:10:34.228 Lot of different ways you can debug.
00:10:34.238 --> 00:10:36.138 Here you me personally.
00:10:36.148 --> 00:10:39.256 I usually just throw a break point right here, but you can
00:10:39.256 --> 00:10:42.627 also like click on this method itself so the as you can see all
00:10:42.627 --> 00:10:45.735 we're doing in this method and this method specifically is
00:10:45.735 --> 00:10:48.896 we're just calling a workflow and immediately returning the
00:10:48.896 --> 00:10:52.320 result, so that being the case, you can click on the method that
00:10:52.320 --> 00:10:55.586 we're calling and don't F 12 because if you just F-12, you're
00:10:55.586 --> 00:10:59.010 going to get this, which is the interface which doesn't help you
00:10:59.010 --> 00:11:00.538 debug anything at the moment.
00:11:00.588 --> 00:11:03.698 It's just a waste of mental energy.
00:11:04.338 --> 00:11:04.968 Umm.
00:11:05.498 --> 00:11:08.640 If you control F-12, that will take you to the actual
00:11:08.640 --> 00:11:11.899 implementation of that interface, which has all the fun
00:11:11.899 --> 00:11:12.248 stuff.
00:11:12.318 --> 00:11:12.798 What's up, Greg?
00:11:13.818 --> 00:11:17.300 I was going to say if you go back to the request handler real
00:11:17.300 --> 00:11:20.614 quick, one of the things that I do, if you see that it's a
00:11:20.614 --> 00:11:23.928 simple calling a workflow, you can go back and look at the
00:11:23.928 --> 00:11:27.297 request that's being made and especially if it's just query
00:11:27.297 --> 00:11:30.948 parameters you can see here when it's passing in, you know right
00:11:30.948 --> 00:11:34.318 off the bat that you're getting an end date and start date.
00:11:35.078 --> 00:11:35.218 Yeah.
00:11:36.038 --> 00:11:39.404 So you've eliminated the fact that it's passing that in right
00:11:39.404 --> 00:11:41.848 off the bat that the that being the problem.
00:11:42.608 --> 00:11:46.862 Yep, assuming that those are deserializing correctly, which
00:11:42.938 --> 00:11:48.498 So we know it's making a passive yes, correct, yeah.
00:11:46.862 --> 00:11:49.628 is most of the time a safe assumption.
00:11:50.708 --> 00:11:52.528 Umm, but we can jump into here now.
00:11:53.628 --> 00:11:57.265 Uh, and now this is our implementation and something in
00:11:57.265 --> 00:12:01.098 here is apparently null as we saw because it's complaining
00:12:01.098 --> 00:12:05.060 that the an object reference is not set to an instance of an
00:12:05.060 --> 00:12:08.308 object, which again just means something is null.
00:12:08.668 --> 00:12:13.637 And we tried to read it so at that point in the Gray space, or
00:12:13.637 --> 00:12:18.448 depending on your color scheme, I guess this might be white.
00:12:18.998 --> 00:12:20.238 You can put a break point over here.
00:12:21.138 --> 00:12:21.728 Umm.
00:12:21.948 --> 00:12:24.838 Fun fact, you can put break points on brackets like this.
00:12:24.928 --> 00:12:27.753 I prefer to do it because I hate when it highlights the entire
00:12:27.753 --> 00:12:29.188 line in red and I can't read it.
00:12:29.198 --> 00:12:31.363 There's no syntax highlighting, so I usually just put it in
00:12:31.363 --> 00:12:31.688 brackets.
00:12:34.548 --> 00:12:35.948 There's a heads up as well.
00:12:36.028 --> 00:12:39.457 If you put it on the opening bracket of like an if condition,
00:12:39.457 --> 00:12:42.775 this break point will only be hit if this condition passes,
00:12:42.775 --> 00:12:46.039 whereas if you put it right here, this break point will be
00:12:46.039 --> 00:12:48.638 hit every time even if this condition doesn't.
00:12:48.708 --> 00:12:52.656 It doesn't evaluate to true, so I personally prefer putting it
00:12:52.656 --> 00:12:53.408 on brackets.
00:12:53.418 --> 00:12:55.898 Like I said, just that it makes the code easier to read.
00:12:56.608 --> 00:12:58.128 Umm so.
00:12:58.258 --> 00:13:04.237 But I'm going to have this breakpoint right here and the,
00:13:04.237 --> 00:13:10.525 uh, the last important thing before we can actually get into
00:13:10.525 --> 00:13:13.308 debugging is how to attach.
00:13:13.318 --> 00:13:16.726 Because right now, if I go run that endpoint again, by the way,
00:13:16.726 --> 00:13:19.228 fun fact, right click an endpoint, replay XHR.
00:13:19.238 --> 00:13:19.598 Pretty cool.
00:13:20.628 --> 00:13:23.117 Umm, I'm pretty sure everybody knows that already, but in case
00:13:23.117 --> 00:13:24.618 anybody didn't, you could just rerun.
00:13:26.968 --> 00:13:29.903 And then point over and over again in the browser without
00:13:29.903 --> 00:13:31.928 having to refresh the page or anything.
00:13:31.938 --> 00:13:35.704 So if you've got a specific repro, if you have something
00:13:35.704 --> 00:13:39.470 that's like really tough to repro and you finally have a
00:13:39.470 --> 00:13:43.434 failing request, assuming it's not like a chain of requests
00:13:43.434 --> 00:13:45.218 like checkout, uh, you may.
00:13:45.268 --> 00:13:48.421 You may be able to just live on that page without refreshing and
00:13:48.421 --> 00:13:51.478 just replay that failing request so that it's easier to repro.
00:13:51.908 --> 00:13:55.948 Umm so but anyway, but you can see that I'm running in.
00:13:55.958 --> 00:13:58.228 It's not hitting my break point because I'm not attached.
00:13:58.998 --> 00:14:02.844 So again, somebody who's not a back end developer that's
00:14:02.844 --> 00:14:06.488 attached a bajillion times and the last however long.
00:14:07.398 --> 00:14:09.538 Does anybody want to tell me how to attach?
00:14:11.928 --> 00:14:14.998 I've been doing this so much this last week.
00:14:15.008 --> 00:14:21.305 So you can go to debug up in the top there and then attach to
00:14:21.305 --> 00:14:22.118 process.
00:14:24.838 --> 00:14:29.623 And then in that little search bar to the right type W3 and you
00:14:29.623 --> 00:14:31.118 were in admin right.
00:14:31.548 --> 00:14:31.728 Yep.
00:14:32.328 --> 00:14:34.208 Do you want to click on admin and then click attach?
00:14:34.778 --> 00:14:35.888 Yep, exactly.
00:14:35.898 --> 00:14:38.668 And I'm glad you mentioned that that bit about being an admin.
00:14:39.018 --> 00:14:42.057 That's a easy thing to forget about sometimes when you're,
00:14:42.057 --> 00:14:45.251 especially if you're jumping back and forth between app pools
00:14:45.251 --> 00:14:48.239 like debugging on storefront, debugging on admin back and
00:14:48.239 --> 00:14:48.548 forth.
00:14:49.028 --> 00:14:53.176 If you attach to the wrong one, your break point will not be hit
00:14:53.176 --> 00:14:55.218 and no symbols have been loaded.
00:14:55.228 --> 00:14:56.968 For this talk about, that's unfortunate.
00:14:59.458 --> 00:15:00.258 Maybe a refresh?
00:15:00.278 --> 00:15:00.998 Will fix that.
00:15:03.468 --> 00:15:04.778 It didn't let me retry.
00:15:04.788 --> 00:15:05.848 Let me try to retouching.
00:15:06.548 --> 00:15:09.368 Your instructions were completely correct though, but
00:15:09.368 --> 00:15:12.553 yeah, be sure whenever you're attaching this title, one will
00:15:12.553 --> 00:15:14.798 tell you if it's whichever app pool it is.
00:15:14.808 --> 00:15:18.938 Just make sure you attach to the right one, cuz we've all done it
00:15:18.938 --> 00:15:22.819 attached to the wrong one and then spend 15 minutes wondering
00:15:22.819 --> 00:15:26.699 why the break points and not being hit only to realize oopsie
00:15:26.699 --> 00:15:27.888 so good call there.
00:15:28.318 --> 00:15:29.808 Make sure you're attached to the right one.
00:15:31.528 --> 00:15:35.058 I am attached to the right one, but for some reason it's being
00:15:35.058 --> 00:15:35.338 dumb.
00:15:35.448 --> 00:15:36.868 So what I'm gonna do is.
00:15:41.808 --> 00:15:44.928 Kill it and restart it and see if that helps.
00:15:47.658 --> 00:15:51.757 As a side note, relevant to what I just did there, if you attach
00:15:51.757 --> 00:15:55.414 immediately as an app pool is spinning up, you might have
00:15:55.414 --> 00:15:59.198 trouble getting it to load symbols, in which case you would
00:15:59.198 --> 00:16:02.792 need to just restart or like detach and then reattach in
00:16:02.792 --> 00:16:05.378 Visual Studio and that usually fixes it.
00:16:07.248 --> 00:16:11.950 I don't know why it does that, but it it it does that sometimes
00:16:11.950 --> 00:16:12.538 alright.
00:16:12.548 --> 00:16:14.478 This is unfortunate.
00:16:14.588 --> 00:16:22.598 And uh, alright, well fine, I guess I'll.
00:16:25.578 --> 00:16:25.848 Uh.
00:16:25.858 --> 00:16:28.102 Signal R is reconnecting because I have the storefront open
00:16:28.102 --> 00:16:28.888 another tab, I think.
00:16:29.948 --> 00:16:30.618 No, I don't.
00:16:30.748 --> 00:16:31.398 OK, I don't know.
00:16:33.588 --> 00:16:33.938 I don't know.
00:16:36.188 --> 00:16:39.758 Stop the app pools and then I'm gonna run a rebuild real quick.
00:16:39.768 --> 00:16:43.138 Just to just to be safe, if you're ever having your symbols
00:16:43.138 --> 00:16:46.621 not showing up like you have that little caution sign next to
00:16:46.621 --> 00:16:50.159 a break point, that's telling you that that break point is not
00:16:50.159 --> 00:16:51.058 going to be hit.
00:16:51.688 --> 00:16:56.177 Uh, basically what I just did is you're you're optimal
00:16:56.177 --> 00:16:58.218 troubleshooting strategy.
00:16:58.288 --> 00:17:01.364 Restart the app pools and reattach and then if that
00:17:01.364 --> 00:17:05.210 doesn't work, stop the app pools completely and then rebuild and
00:17:05.210 --> 00:17:08.641 you can you can skip the stopping and you just restarting
00:17:08.641 --> 00:17:12.132 the first time if the if you mouse over the caution symbol
00:17:12.132 --> 00:17:15.504 and it says the compiled code does not match the current
00:17:15.504 --> 00:17:19.172 document or something like that cuz that just means that some
00:17:19.172 --> 00:17:22.840 you've changed some code in this file since the last time you
00:17:22.840 --> 00:17:25.798 built and it's not going to work until you build.
00:17:26.298 --> 00:17:30.014 But if it just says no symbols have been loaded, you know it's
00:17:30.014 --> 00:17:33.199 not the most helpful error message in the world, so a
00:17:33.199 --> 00:17:34.438 restart doesn't hurt.
00:17:34.448 --> 00:17:37.701 And if that still doesn't fix it, I'll rebuild doesn't hurt,
00:17:37.701 --> 00:17:39.408 so we'll see where this gets us.
00:17:41.288 --> 00:17:43.738 If this doesn't work, I'm gonna be really confused.
00:18:24.898 --> 00:18:26.398 Almost there.
00:18:28.348 --> 00:18:28.898 What's up, Justin?
00:18:30.278 --> 00:18:34.210 I was gonna say I gotta question to fill the void like the
00:18:34.210 --> 00:18:38.141 breakpoint files are the PDB files that are in the plugins
00:18:38.141 --> 00:18:38.608 folder.
00:18:40.248 --> 00:18:44.800 From my understanding and then the DLL folder files are like
00:18:40.468 --> 00:18:42.148 Correct, yes.
00:18:44.800 --> 00:18:49.650 the actual compiled code and so I was wondering what are the XML
00:18:49.650 --> 00:18:50.098 files?
00:18:51.678 --> 00:18:57.320 You may have noticed that we have these three slash comments
00:18:57.320 --> 00:18:59.448 with XML documentation.
00:18:59.778 --> 00:19:04.234 The XML files are the compilation of all of these XML
00:18:59.888 --> 00:19:00.138 Umm.
00:19:04.234 --> 00:19:09.515 docs put into one file, and it's supposed to basically serve as
00:19:09.515 --> 00:19:14.218 documentation for the code or for the relevant assembly.
00:19:12.358 --> 00:19:13.028 Cool.
00:19:13.138 --> 00:19:15.718 I didn't know that gotcha.
00:19:23.708 --> 00:19:24.868 OK, let me build this done.
00:19:30.828 --> 00:19:34.138 Spin PCs back up and refresh this admin.
00:19:37.678 --> 00:19:40.377 And hope that it works this time, because if it doesn't,
00:19:40.377 --> 00:19:42.318 like I said, I'm gonna be very confused.
00:19:43.808 --> 00:19:46.128 Suppose it's possible that there's an override for this.
00:19:46.138 --> 00:19:47.198 Well, but it should still.
00:19:47.968 --> 00:19:51.656 This breakpoint should still light up even if there is an
00:19:51.656 --> 00:19:55.790 override, and it would be weird for there to be and override for
00:19:55.790 --> 00:19:56.998 a custom end point.
00:20:01.108 --> 00:20:01.788 Yeah, there's not.
00:20:21.528 --> 00:20:22.868 Ohly almost there.
00:20:36.718 --> 00:20:40.896 Any second I'm pointing at the stage database, so it's a little
00:20:40.896 --> 00:20:45.074 bit slower going over the VPN to a database instead of locally,
00:20:45.074 --> 00:20:46.118 but there it is.
00:20:46.128 --> 00:20:47.368 OK, let's try to attach again.
00:20:55.188 --> 00:20:55.928 Interesting.
00:20:57.748 --> 00:20:59.428 I see why it's because I'm a fool.
00:21:01.158 --> 00:21:02.338 I built it and release mode.
00:21:03.368 --> 00:21:03.768 I'll do it.
00:21:05.278 --> 00:21:10.318 So yeah, let's putting everything into a when you call
00:21:10.318 --> 00:21:15.999 that as your box a while back, and I guess I never changed it
00:21:15.999 --> 00:21:19.298 back from release to the bug. Oops.
00:21:23.998 --> 00:21:24.808 So yeah, if you're.
00:21:27.368 --> 00:21:32.102 If for whatever reason this is not debug, then debugging won't
00:21:32.102 --> 00:21:32.478 work.
00:21:33.028 --> 00:21:33.718 Go figure.
00:21:34.248 --> 00:21:37.788 And if you change this, you need to rebuild before you can debug.
00:21:39.208 --> 00:21:39.768 Umm.
00:21:40.088 --> 00:21:42.788 So just make sure that says debug up there.
00:21:43.708 --> 00:21:48.258 Most of the time it will 99.9% of the time it will.
00:21:48.308 --> 00:21:52.169 It's very rare that there's any reason to change it unless
00:21:52.169 --> 00:21:55.768 you're doing a production deployment by hand, which is
00:21:55.768 --> 00:21:58.778 unfortunately how we have to do that for PCs.
00:22:00.148 --> 00:22:00.528 Umm.
00:22:01.818 --> 00:22:05.830 So in those scenarios, just make sure you remember to switch it
00:22:05.830 --> 00:22:09.716 back to debug when you're done so that you can hence the name
00:22:09.716 --> 00:22:10.218 the bug.
00:22:15.208 --> 00:22:21.568 While this builds the next bit of this, uh, urgent, that's
00:22:21.568 --> 00:22:22.538 exciting.
00:22:30.278 --> 00:22:31.288 To that's a payment provider.
00:22:35.918 --> 00:22:36.408 What?
00:22:36.978 --> 00:22:40.538 Ohh Yep.
00:22:37.278 --> 00:22:41.597 Since since Stripe on the back end I was like, ooh, that's a
00:22:41.597 --> 00:22:42.588 paper printer.
00:22:50.998 --> 00:22:52.438 Uh, yeah, that'll be fun.
00:22:57.318 --> 00:22:58.128 Anyway, uh, what?
00:22:57.518 --> 00:22:57.668 Yeah.
00:22:58.138 --> 00:23:02.269 I was going to say there is, uh, the other part of this that I
00:23:02.269 --> 00:23:06.400 want to get into, which we're running, running a little low on
00:23:06.400 --> 00:23:06.728 time.
00:23:06.738 --> 00:23:08.308 So I'm just gonna jump ahead a little bit.
00:23:08.718 --> 00:23:13.948 Is postman and other such tools insomnia and etcetera.
00:23:14.098 --> 00:23:18.770 They all work very similarly, but this is a tool that allows
00:23:18.770 --> 00:23:21.528 you to just make requests manually.
00:23:22.458 --> 00:23:26.568 So this is a great way to particularly for back end
00:23:26.568 --> 00:23:27.438 developers.
00:23:27.448 --> 00:23:30.513 If you're building a feature that obviously you know the
00:23:30.513 --> 00:23:33.847 front end can't build a front end until the end points exist,
00:23:33.847 --> 00:23:37.181 I mean it could build something visual, but it's not gonna be
00:23:37.181 --> 00:23:38.418 calling your endpoints.
00:23:38.468 --> 00:23:41.920 If you need to test your endpoints before the front end
00:23:41.920 --> 00:23:45.743 has built anything for them, then you can use postman and I'm
00:23:45.743 --> 00:23:49.442 pretty sure all of us already know that, but just to show a
00:23:49.442 --> 00:23:52.278 little bit of that looks some PCs stuff cool.
00:23:56.528 --> 00:23:57.078 See here.
00:23:58.128 --> 00:24:02.625 Uh, you basically can come in here and just type in or choose
00:24:02.625 --> 00:24:03.858 the uh, the verb.
00:24:04.028 --> 00:24:05.538 There's some pretty cool ones in here.
00:24:06.898 --> 00:24:09.848 Purge only.
00:24:09.858 --> 00:24:12.018 I wanna make a purge endpoint in Seth.
00:24:12.028 --> 00:24:12.538 That would be fun.
00:24:13.288 --> 00:24:14.318 Only once a week.
00:24:13.538 --> 00:24:17.748 Uh, true.
00:24:14.328 --> 00:24:18.278 Every year, can you use it or once a month?
00:24:18.288 --> 00:24:18.558 Yeah.
00:24:18.568 --> 00:24:22.078 Yeah, you know what I was going for there?
00:24:22.118 --> 00:24:22.548 Yeah.
00:24:22.618 --> 00:24:22.758 Yeah.
00:24:25.208 --> 00:24:30.188 But anyway, so you choose your verb, you type in the route.
00:24:30.718 --> 00:24:32.388 It says the whole the full route.
00:24:32.398 --> 00:24:33.148 It doesn't know.
00:24:33.158 --> 00:24:36.268 You can't just do like slash, import or whatever like how you
00:24:36.268 --> 00:24:39.227 copy paste it out of a the browser earlier on this failing
00:24:39.227 --> 00:24:39.428 one.
00:24:40.098 --> 00:24:44.465 If you wanted to do this, you would need to copy the whole
00:24:44.465 --> 00:24:47.278 thing like that, including the route.
00:24:47.848 --> 00:24:49.598 I'll make a new one over here and paste it.
00:24:50.028 --> 00:24:52.218 This is a get request.
00:24:52.228 --> 00:24:53.178 We can see right here.
00:24:53.228 --> 00:24:58.957 So we'll make that, say git, and in order to add parameters for
00:24:58.957 --> 00:25:02.358 get requests there's this params tab.
00:25:02.428 --> 00:25:08.181 So then we can say start date and then end date and we can
00:25:08.181 --> 00:25:14.130 just copy pasta whatever is in here that was invite don't do
00:25:14.130 --> 00:25:16.568 that and then start date.
00:25:19.378 --> 00:25:22.619 Like so and you can see now that it it actually did put all that
00:25:22.619 --> 00:25:23.068 in there.
00:25:23.078 --> 00:25:25.802 So I guess I could have just copied this entire thing and
00:25:25.802 --> 00:25:28.621 pasted it into here and it would have added those into this
00:25:28.621 --> 00:25:29.748 little UI and et cetera.
00:25:30.018 --> 00:25:35.476 But now I could send this to the back end and theoretically and
00:25:35.476 --> 00:25:36.158 out org.
00:25:37.008 --> 00:25:40.285 So things are now spun or rebuilt and spin it back up real
00:25:40.285 --> 00:25:40.618 quick.
00:25:41.048 --> 00:25:43.418 Apologies for the for the delay.
00:25:43.788 --> 00:25:47.638 I I guess now I know to check that first.
00:25:53.988 --> 00:25:56.638 That's probably spun up enough to go ahead and attach.
00:25:57.818 --> 00:26:01.738 Umm on red circle.
00:26:01.748 --> 00:26:02.828 Alright, there we go.
00:26:02.878 --> 00:26:03.718 Fantastic.
00:26:04.688 --> 00:26:09.561 Umm, so now I'm attached, which means if I hit that endpoint
00:26:09.561 --> 00:26:11.318 again, it should fail.
00:26:11.328 --> 00:26:14.582 In fact, it probably will here in just a minute because the
00:26:14.582 --> 00:26:16.318 admin site is still spinning up.
00:26:17.388 --> 00:26:18.998 So it hasn't called that endpoint yet.
00:26:34.318 --> 00:26:37.758 Something I personally like to do when I am debugging on the
00:26:37.758 --> 00:26:41.198 back end is there's a a handful of useful tabs that come up.
00:26:42.068 --> 00:26:45.593 Uh, and if you don't have these, you can find them under the
00:26:45.593 --> 00:26:47.558 debug and then windows over here.
00:26:48.208 --> 00:26:52.258 It's a bunch of useful stuff over here, but hey, look, it hit
00:26:52.258 --> 00:26:53.238 my break point.
00:26:56.168 --> 00:27:00.659 The three most useful things here are the these tabs down
00:27:00.659 --> 00:27:04.918 here, autos, locals, and watch, which I'm gonna clear.
00:27:04.928 --> 00:27:08.614 My watch here cause I don't need all that the exception settings
00:27:08.614 --> 00:27:12.243 which you'll want to make sure this one has a check mark, not a
00:27:12.243 --> 00:27:14.908 filled box, not an empty box but a check mark.
00:27:15.658 --> 00:27:19.448 UM, and then the call Stack tab.
00:27:20.148 --> 00:27:23.060 Uh, here's all that service stack stuff we were talking
00:27:23.060 --> 00:27:23.788 about earlier.
00:27:23.798 --> 00:27:28.915 You can see that the the call stack is from bottom to top in
00:27:28.915 --> 00:27:32.438 terms of how long ago something happened.
00:27:32.448 --> 00:27:33.918 So this is where we are now.
00:27:34.188 --> 00:27:35.718 This is what called where we are now.
00:27:35.728 --> 00:27:36.768 This is what called that.
00:27:36.778 --> 00:27:38.538 This is what called that this is etcetera.
00:27:38.548 --> 00:27:41.318 So the first thing that happened was all the way down here.
00:27:41.608 --> 00:27:45.673 And because we actually have some of that code somewhere, you
00:27:45.673 --> 00:27:49.673 can, I guess we don't in here, which I'm very fine with, But
00:27:49.673 --> 00:27:53.345 anyway you get the point if it's if it says Clarity dot
00:27:53.345 --> 00:27:57.542 ecommerce, you can just double click on it and it will take you
00:27:57.542 --> 00:28:01.607 to where that is in the code, which is cool, it makes it easy
00:28:01.607 --> 00:28:04.558 to to jump around and see what was going on.
00:28:04.568 --> 00:28:06.961 And you can even look at, you can mouse over values in here
00:28:06.961 --> 00:28:08.078 and see what the values are.
00:28:08.088 --> 00:28:10.535 So you can see that, hey, it did get start and end date they
00:28:10.535 --> 00:28:11.458 deserialized correctly.
00:28:11.468 --> 00:28:12.778 Those look like what I sent.
00:28:13.088 --> 00:28:13.778 That's fantastic.
00:28:15.078 --> 00:28:18.016 Umm, so we can go back up and then we can start stepping
00:28:18.016 --> 00:28:18.428 through.
00:28:18.758 --> 00:28:21.388 You have these four buttons right here that are useful.
00:28:21.838 --> 00:28:24.821 You also technically have this one, but there's a cooler way to
00:28:24.821 --> 00:28:27.617 do this that I'll talk about here in just a moment, but the
00:28:27.617 --> 00:28:30.460 most common thing you would probably use is step over, which
00:28:30.460 --> 00:28:32.418 is basically just go over this next line.
00:28:33.078 --> 00:28:33.628 Umm.
00:28:34.068 --> 00:28:39.041 As you can see, unfortunately, the rest of this entire method
00:28:39.041 --> 00:28:43.452 is one statement, which means the null ref is probably
00:28:43.452 --> 00:28:45.698 happening in here somewhere.
00:28:47.058 --> 00:28:52.946 Umm, just because I am pretty sure I already know where this
00:28:52.946 --> 00:28:59.123 is from looking at it, I'll say that uh, and again, I hate that
00:28:59.123 --> 00:29:02.598 it highlights everything in yellow.
00:29:02.608 --> 00:29:03.438 It's like I can't.
00:29:03.488 --> 00:29:04.518 I can't read any of this.
00:29:05.658 --> 00:29:08.568 Umm, So what?
00:29:08.578 --> 00:29:12.379 I was going to say a moment ago the better way to do this step
00:29:12.379 --> 00:29:16.120 backward is you can put your mouse on the the arrow over here
00:29:16.120 --> 00:29:17.448 and then just drag it.
00:29:18.638 --> 00:29:22.204 And as long as you remain inside the same method scope, you can
00:29:22.204 --> 00:29:25.658 just drag it in and around and whatnot, and it's pretty cool.
00:29:26.488 --> 00:29:34.232 Umm so you can use that to skip over conditions that you are not
00:29:34.232 --> 00:29:36.258 as interested in.
00:29:36.268 --> 00:29:39.364 For example, if there's like an early out or something in a
00:29:39.364 --> 00:29:42.459 method and you're like, I want to skip past that early out,
00:29:42.459 --> 00:29:45.761 even if it would have evaluated the true, you can just drag the
00:29:45.761 --> 00:29:48.238 arrow past that condition and it's pretty cool.
00:29:49.768 --> 00:29:50.118 Umm.
00:29:50.128 --> 00:29:54.268 So anyway, uh, we will.
00:29:54.278 --> 00:29:58.608 Uh, step over and we can see now that this entire thing is here.
00:29:59.168 --> 00:29:59.798 Umm.
00:30:00.748 --> 00:30:05.389 As a useful side note, I already know just from personal
00:30:05.389 --> 00:30:10.518 experience, I know that's not the best debugging or, you know,
00:30:10.518 --> 00:30:11.658 teaching item.
00:30:11.718 --> 00:30:14.398 You know, it doesn't help a lot to just say just know this.
00:30:14.728 --> 00:30:18.855 But uh, when you're when you're looking at back in code, you can
00:30:18.855 --> 00:30:22.919 be relatively certain that this is never gonna be null, because
00:30:22.919 --> 00:30:25.268 if it was, that would be really bad.
00:30:25.838 --> 00:30:30.780 And we have bigger problems to figure out and everything
00:30:30.780 --> 00:30:33.988 between this down to an enumeration.
00:30:33.998 --> 00:30:37.458 So in this case the two list nothing in here is gonna be
00:30:37.458 --> 00:30:40.857 throwing a null ref unless something unless an external
00:30:40.857 --> 00:30:44.498 variable is being referenced inside of there, in which case
00:30:44.498 --> 00:30:45.348 it's possible.
00:30:45.418 --> 00:30:46.748 Unlikely, but possible.
00:30:47.098 --> 00:30:50.166 So what that means is that it's not going to be any of these
00:30:50.166 --> 00:30:50.468 lines.
00:30:50.478 --> 00:30:51.408 It's something down here.
00:30:53.168 --> 00:30:53.558 Umm.
00:30:53.768 --> 00:30:58.581 Most likely what's happening here that I'm seeing is that
00:30:58.581 --> 00:31:03.228 this is doing a first or default, which means that it's
00:31:03.228 --> 00:31:08.372 either the first one or null if there are none, and then down
00:31:08.372 --> 00:31:13.683 here we are immediately grouping by that value without checking
00:31:13.683 --> 00:31:14.928 if it was null.
00:31:15.758 --> 00:31:16.298 Umm.
00:31:16.508 --> 00:31:24.158 So ideally, umm, we would just do aware right here to fix this.
00:31:26.048 --> 00:31:29.619 And actually, I'll, uh, before I do any other changes I already
00:31:29.619 --> 00:31:33.135 have that exception box ticked, so I'm just gonna hit continue
00:31:33.135 --> 00:31:34.028 and there it is.
00:31:34.038 --> 00:31:35.148 I was exactly correct.
00:31:35.158 --> 00:31:36.518 It's on that line right there.
00:31:37.258 --> 00:31:42.008 Umm, so uh winning bid is null here.
00:31:43.408 --> 00:31:44.218 That's the problem.
00:31:44.668 --> 00:31:47.638 So that is, uh, that's nice.
00:31:47.648 --> 00:31:48.118 That's good.
00:31:48.128 --> 00:31:48.708 It's easy to fix.
00:31:49.058 --> 00:31:49.758 Umm.
00:31:50.038 --> 00:31:53.543 But at this point, even if I didn't have any breakpoints set,
00:31:53.543 --> 00:31:57.218 if I just had this exception box ticked and I was attached and I
00:31:57.218 --> 00:31:59.988 ran that endpoint, I would get this exact thing.
00:31:59.998 --> 00:32:02.847 It would literally highlight the part that's null for me where
00:32:02.847 --> 00:32:05.108 the problem is and take me straight to that file.
00:32:05.578 --> 00:32:11.757 So if you are experiencing something like this and you're
00:32:11.757 --> 00:32:18.788 able to attach and whatnot, this is as good as screen shot as you
00:32:18.788 --> 00:32:21.238 could possibly give of.
00:32:21.308 --> 00:32:22.238 This is the method.
00:32:22.248 --> 00:32:23.138 This is the line.
00:32:23.148 --> 00:32:24.018 This is the error.
00:32:24.028 --> 00:32:25.158 This is what's highlighted.
00:32:25.168 --> 00:32:26.498 This is the file name.
00:32:26.788 --> 00:32:30.793 This is the endpoint I hit all of that information should take
00:32:30.793 --> 00:32:34.353 very little time to collect whenever an issue like this
00:32:34.353 --> 00:32:34.798 arises.
00:32:35.108 --> 00:32:38.772 Now if it's a more complicated issue like you attach and do,
00:32:38.772 --> 00:32:42.616 you get, you know 7 layers deep and you're still not sure where
00:32:42.616 --> 00:32:44.478 it's coming from at that point.
00:32:45.328 --> 00:32:49.965 Just go ahead and give it, you know, give it to a back end
00:32:49.965 --> 00:32:54.680 developer because swimming through the layers of lasagna is
00:32:54.680 --> 00:32:55.938 what we do best.
00:32:55.998 --> 00:33:01.408 So, uh, uh or other fine Italian cuisine?
00:33:04.148 --> 00:33:07.002 But this is fantastic because it's a very simple way to
00:33:07.002 --> 00:33:08.938 exactly isolate where the problem is.
00:33:09.788 --> 00:33:14.648 Uh, and you will save any any back end developer a lot of time
00:33:14.648 --> 00:33:19.662 not having to repro this because ideally somebody should be able
00:33:19.662 --> 00:33:24.368 to look at this and just say ohh I just need to add a where.
00:33:25.738 --> 00:33:27.448 OK, Visual Studio is going to freeze on me.
00:33:27.458 --> 00:33:28.238 That's classic.
00:33:29.258 --> 00:33:29.658 There we go.
00:33:30.428 --> 00:33:33.138 Uh winning bid?
00:33:33.208 --> 00:33:37.641 It's not equal to null, and by the way, this can be done here
00:33:37.641 --> 00:33:39.428 or this can be done here.
00:33:40.068 --> 00:33:45.645 Umm, does anybody want to take a guess as to what the difference
00:33:45.645 --> 00:33:49.678 is between putting it here or putting it here?
00:33:55.808 --> 00:33:57.578 You're asking the front end developers, Brendan.
00:33:58.108 --> 00:34:02.664 I'm asking anybody who wants to give it a guess, but preferably
00:34:02.664 --> 00:34:05.298 somebody who who doesn't do back in.
00:34:04.198 --> 00:34:07.978 I I'll take a stab or ohh Michael's hand.
00:34:07.988 --> 00:34:08.808 Hand he can do it.
00:34:08.818 --> 00:34:09.438 He raised his hand.
00:34:09.138 --> 00:34:11.828 Ohly I I had my hand raised with something else.
00:34:11.478 --> 00:34:12.068 Oh.
00:34:11.838 --> 00:34:12.778 No, I'm not.
00:34:11.958 --> 00:34:13.038 Oh, I missed that, sorry.
00:34:12.238 --> 00:34:15.028 Ohh, OK OK.
00:34:12.818 --> 00:34:14.058 I'm not offering this tribute.
00:34:15.258 --> 00:34:18.347 I'm guessing and I don't know the answer, so I'm a good person
00:34:15.478 --> 00:34:15.648 But.
00:34:18.347 --> 00:34:18.788 to guess.
00:34:19.268 --> 00:34:19.488 Right.
00:34:19.318 --> 00:34:22.751 I'm guessing the difference is that if it's above configure
00:34:22.751 --> 00:34:26.127 await, it's included in the query to the database as we're
00:34:26.127 --> 00:34:29.732 of its after configure weight, it is filtering out the results
00:34:29.732 --> 00:34:31.678 it already got from the database.
00:34:32.508 --> 00:34:33.368 Correct.
00:34:33.438 --> 00:34:36.683 And technically it's not the configural weight that's the the
00:34:36.683 --> 00:34:38.148 boundary, it's the two list.
00:34:38.828 --> 00:34:39.388 Ohh OK.
00:34:38.908 --> 00:34:44.443 Umm, but the the two lists and they're white live together. So
00:34:44.443 --> 00:34:45.058 mostly.
00:34:44.578 --> 00:34:44.738 Yeah.
00:34:45.068 --> 00:34:46.378 Yes, that's that's exactly it.
00:34:52.448 --> 00:34:52.698 OK.
00:34:52.758 --> 00:34:56.652 That in any framework is called in or or in in Lync is in a
00:34:56.652 --> 00:35:00.482 numerator, so this method call actually goes and basically
00:35:00.482 --> 00:35:04.377 tells the all the stuff above transpile all this C into SQL
00:35:04.377 --> 00:35:07.038 and go get me results from the database.
00:35:07.228 --> 00:35:10.086 So if you were to put this after that, then you would be getting
00:35:08.398 --> 00:35:08.598 OK.
00:35:10.086 --> 00:35:12.767 all of the results regardless of if they were valid and then
00:35:12.767 --> 00:35:14.438 filtering out invalid ones in memory.
00:35:14.448 --> 00:35:16.208 So you're just wasting database energy?
00:35:14.878 --> 00:35:16.678 So much right.
00:35:16.688 --> 00:35:20.302 Much more, much more efficient to do it first, I'm guessing,
00:35:17.098 --> 00:35:19.708 Umm. Correct.
00:35:19.778 --> 00:35:20.008 Yeah.
00:35:20.058 --> 00:35:23.694 So anyway, that was extra credit and not related to debugging,
00:35:20.302 --> 00:35:20.598 yeah.
00:35:23.288 --> 00:35:27.093 There was a custom paging endpoint and JBM that had that
00:35:23.694 --> 00:35:24.098 but uh.
00:35:27.093 --> 00:35:30.898 problem that ended up being pretty slow because of that.
00:35:30.968 --> 00:35:35.390 It had already enumerated everything by two, listing right
00:35:31.268 --> 00:35:31.448 Yeah.
00:35:35.390 --> 00:35:39.438 and and at cetera et cetera, but I fixed it and then.
00:35:37.078 --> 00:35:37.568 Yep.
00:35:37.658 --> 00:35:41.258 So something to watch out for, unexpected enumeration can also
00:35:40.898 --> 00:35:41.078 You know.
00:35:41.258 --> 00:35:41.658 happen.
00:35:42.788 --> 00:35:46.438 Umm, where you didn't mean to enumerate, but you did.
00:35:46.448 --> 00:35:49.506 But anyway, that's all that we did in any framework training
00:35:49.506 --> 00:35:52.665 not that long ago and and it's something that I enjoy screwing
00:35:52.665 --> 00:35:53.868 with optimizing queries.
00:35:53.878 --> 00:35:56.931 So I could continue talking about that for a while, but I
00:35:56.931 --> 00:35:57.458 will stop.
00:35:58.048 --> 00:36:03.585 But now we've fixed this one and I'm gonna go ahead and
00:36:03.585 --> 00:36:05.958 temporarily remove that.
00:36:06.208 --> 00:36:10.090 And so I can reattach real quick and just show using postman for
00:36:10.090 --> 00:36:10.448 stuff.
00:36:11.438 --> 00:36:13.408 Umm, so again we typed all this in.
00:36:13.418 --> 00:36:14.818 Here we can send this request.
00:36:16.278 --> 00:36:17.648 Uh, and I got a 401.
00:36:17.818 --> 00:36:18.608 That's actually perfect.
00:36:19.058 --> 00:36:22.971 Umm, because you might be asking well, how the heck do I log into
00:36:22.971 --> 00:36:23.208 CEF?
00:36:23.218 --> 00:36:25.768 In postman, there's no UI for that.
00:36:26.238 --> 00:36:30.695 You're correct, there's not, but logging in is just one endpoint,
00:36:30.695 --> 00:36:32.248 and I usually have one.
00:36:32.258 --> 00:36:35.436 Here it is, so the only thing you need to do and funny enough,
00:36:35.436 --> 00:36:38.564 you can do this on either API, storefront or API admin or any
00:36:38.564 --> 00:36:38.968 of them.
00:36:38.978 --> 00:36:41.216 It doesn't matter because they share the cookies, but I'm going
00:36:41.216 --> 00:36:43.313 to go ahead and make an API admin, so I have to wait for it
00:36:43.313 --> 00:36:43.698 to spin up.
00:36:44.528 --> 00:36:47.928 Uh, you hit slash auth slash identity.
00:36:48.318 --> 00:36:50.588 It's a post request in the body.
00:36:51.968 --> 00:36:55.610 You need the username and the password formatted like that and
00:36:55.610 --> 00:36:56.188 that's it.
00:36:56.378 --> 00:37:00.047 Then you send it and it takes a while, because I'm logging into
00:37:00.047 --> 00:37:03.486 the clarity admin, which has a bajillion permissions, loads
00:37:03.486 --> 00:37:07.098 them all up from the database, so we'll just give it a moment.
00:37:15.698 --> 00:37:16.868 Wait for it.
00:37:18.408 --> 00:37:20.228 Wait for it.
00:37:24.878 --> 00:37:25.768 Keep waiting.
00:37:28.268 --> 00:37:28.988 Hold on.
00:37:30.008 --> 00:37:32.408 We've managed to sell them the slowest part of our site.
00:37:35.418 --> 00:37:39.224 Yeah, to be fair, this user does have like 9000 permission
00:37:39.224 --> 00:37:40.708 records attached to it.
00:37:46.648 --> 00:37:48.778 Your average user is not going to have that many.
00:37:50.888 --> 00:37:54.070 I'm also terrified by all these little triangular squares,
00:37:54.070 --> 00:37:56.228 because these are all database queries.
00:37:59.888 --> 00:38:03.773 OK, there might be something we need to figure out in the auth
00:38:03.773 --> 00:38:07.288 provider cause it shouldn't be making this many queries.
00:38:08.868 --> 00:38:09.218 Great.
00:38:09.578 --> 00:38:14.508 What could it possibly be checking that can't be right?
00:38:11.238 --> 00:38:12.168 And onward.
00:38:13.138 --> 00:38:14.308 Yeah, it's.
00:38:14.518 --> 00:38:18.918 Something this were you goofing around on stuff and you?
00:38:15.568 --> 00:38:17.098 Yeah, something's goofy here.
00:38:17.568 --> 00:38:22.871 Select ID not in this project select ID, name from contact
00:38:22.871 --> 00:38:25.298 Commission where ID equals.
00:38:27.048 --> 00:38:30.618 I guess it's just it's just loading every permission by ID.
00:38:27.068 --> 00:38:30.958 It's doing all the permissions 1 by 1.
00:38:31.708 --> 00:38:33.028 That's crazy.
00:38:31.908 --> 00:38:33.368 What they can't be right?
00:38:33.658 --> 00:38:34.258 Ohh.
00:38:34.898 --> 00:38:40.792 There's probably a lazy executed SQL query somewhere in the auth
00:38:40.792 --> 00:38:45.598 logic that needs some scrubbing, and it's it's it's.
00:38:43.138 --> 00:38:45.098 Scrubbing it looks like you need a hammer.
00:38:45.648 --> 00:38:50.577 Yeah, it's particularly slow because I'm a attached and be
00:38:50.577 --> 00:38:55.923 pointed at the staging database over VPN, so it'll be done in a
00:38:55.923 --> 00:38:56.508 minute.
00:38:56.518 --> 00:38:58.388 Don't worry, I it doesn't.
00:38:58.858 --> 00:39:01.788 It doesn't normally take this long, but it does take a moment.
00:39:02.678 --> 00:39:03.058 Under what?
00:39:04.118 --> 00:39:05.198 What line does that?
00:39:06.918 --> 00:39:08.028 Well, we can take a look.
00:39:08.038 --> 00:39:10.288 I'm gonna scooch this over here so I can keep an eye on it.
00:39:12.568 --> 00:39:14.938 More debugging, except this is more like optimizing.
00:39:14.298 --> 00:39:14.478 Yeah.
00:39:16.998 --> 00:39:18.098 Could be an authentication.
00:39:19.868 --> 00:39:24.218 It's probably going to be in either here or here.
00:39:22.868 --> 00:39:23.818 In the repository.
00:39:25.918 --> 00:39:34.646 Something loads the user, probably that load user auth
00:39:30.268 --> 00:39:30.488 What?
00:39:34.646 --> 00:39:37.978 info and it's a stub.
00:39:36.998 --> 00:39:39.998 I always try to find it before you, but I I don't think I'm
00:39:39.998 --> 00:39:40.298 gonna.
00:39:42.558 --> 00:39:44.418 We were just talking about this earlier.
00:39:44.788 --> 00:39:46.698 There are 0 implementations to this.
00:39:46.708 --> 00:39:47.978 That's pretty sweet.
00:39:57.428 --> 00:39:58.708 Umm well.
00:40:00.968 --> 00:40:03.038 Getting permissions, would it be in the validate?
00:40:01.038 --> 00:40:05.898 Let's gringe it shouldn't be I.
00:40:05.968 --> 00:40:08.870 It's there's a thing that gets called in here where it actually
00:40:08.870 --> 00:40:09.958 goes and loads the user.
00:40:15.158 --> 00:40:17.008 I was just poking through here earlier.
00:40:16.788 --> 00:40:19.028 Yeah, try with indicate that would be the other one.
00:40:19.038 --> 00:40:19.888 I would think to look at.
00:40:23.148 --> 00:40:24.918 Get user auth by username.
00:40:27.148 --> 00:40:28.618 Mapped user to user auth.
00:40:29.038 --> 00:40:30.118 Oh, that's gonna be it.
00:40:30.208 --> 00:40:33.048 Ohh yeah yeah.
00:40:31.098 --> 00:40:32.228 There it is.
00:40:36.438 --> 00:40:37.178 What's wrong with that?
00:40:38.348 --> 00:40:40.588 The dot select many is that the dot select many.
00:40:40.848 --> 00:40:44.643 It's so this loads the user out of the database and all of these
00:40:44.643 --> 00:40:48.145 includes are not here, so it's not eagerly loading them out
00:40:48.145 --> 00:40:49.488 with the initial query.
00:40:49.188 --> 00:40:49.458 Huh.
00:40:50.408 --> 00:40:55.828 Then what's happening in here is that we go into permissions and
00:40:55.828 --> 00:41:00.498 then for each role this where triggers a lazy evaluate.
00:41:00.508 --> 00:41:04.395 Well, OK, it doesn't do it yet, but it's the select many
00:41:04.395 --> 00:41:07.601 distinct this two list enumerates the previous
00:41:07.601 --> 00:41:11.830 ienumerable and when that runs it triggers a lazy load of the
00:41:11.830 --> 00:41:16.126 roles and then for every one of those roles a lazy load of all
00:41:16.126 --> 00:41:18.718 of the permissions, which I guess is.
00:41:17.858 --> 00:41:19.838 Why is the previous thing commented out?
00:41:19.898 --> 00:41:22.748 I wonder where you were kind of at a minute ago.
00:41:21.918 --> 00:41:22.408 I don't know.
00:41:23.668 --> 00:41:23.998 I don't know.
00:41:23.708 --> 00:41:26.598 Is it clearly was supposed to be the way you were saying before?
00:41:27.568 --> 00:41:28.438 I would imagine so.
00:41:31.128 --> 00:41:36.367 But uh anyway, we're still loading, so let me detach and
00:41:36.367 --> 00:41:42.065 see if that speeds it up because you said it's it's slow, but
00:41:42.065 --> 00:41:44.638 it's not normally this slow.
00:41:44.648 --> 00:41:48.468 This is a little bit it's a little bit excessive.
00:41:55.868 --> 00:41:57.118 But depends many roles.
00:41:57.128 --> 00:41:58.148 This clarity have on it.
00:41:59.548 --> 00:42:03.426 It's probably got all the roles including global admin which has
00:42:01.578 --> 00:42:02.488 That's what I was.
00:42:02.548 --> 00:42:04.188 That's what I was thinking too.
00:42:03.426 --> 00:42:04.798 all the permissions so.
00:42:04.258 --> 00:42:04.438 Yeah.
00:42:04.448 --> 00:42:06.958 Because then, like you know the all the other administrator
00:42:06.958 --> 00:42:09.008 roles have a ton of permissions on them as well.
00:42:09.498 --> 00:42:09.958 Yeah.
00:42:10.468 --> 00:42:15.774 And the distinct, yeah, the distinct is far enough after the
00:42:11.638 --> 00:42:12.918 That's going to call them separately.
00:42:15.774 --> 00:42:20.558 fact that it doesn't really matter because it's still.
00:42:26.588 --> 00:42:29.908 Wherever that was, that's the other way around.
00:42:31.488 --> 00:42:34.228 Well, anyway, you get the point lifespan.
00:42:40.118 --> 00:42:42.088 Anyway, so this would be how you would log in.
00:42:42.648 --> 00:42:50.061 Uh, if uh, if there wasn't a bug that I probably need to fix, UM,
00:42:50.061 --> 00:42:55.341 but uh, eventually this will come back and say
00:42:55.341 --> 00:42:57.138 congratulations.
00:42:57.148 --> 00:43:00.170 You got successfully logged in or it'll come back and say
00:43:00.170 --> 00:43:03.401 something goes wrong, in which case you hope it didn't take 5
00:43:03.401 --> 00:43:03.818 minutes.
00:43:05.198 --> 00:43:05.638 Uh.
00:43:05.648 --> 00:43:06.988 Because they're gonna have to do it again.
00:43:07.738 --> 00:43:11.378 But if it if it didn't work, probably your password.
00:43:11.678 --> 00:43:13.944 But if you're attached, you can always put a break point and
00:43:13.944 --> 00:43:15.058 find out exactly where it was.
00:43:16.158 --> 00:43:20.065 Figure out there's a there's a cheat code I won't show how to
00:43:20.065 --> 00:43:21.388 do here, but you can.
00:43:21.718 --> 00:43:24.267 When you're attached, you can log in technically as any user
00:43:24.267 --> 00:43:26.733 with that one to reset their password by just skipping the
00:43:26.733 --> 00:43:28.028 password check in the debugger.
00:43:29.168 --> 00:43:33.138 Umm, it's pretty useful.
00:43:33.858 --> 00:43:35.668 Umm, don't ever do that.
00:43:36.038 --> 00:43:39.201 On a production site, he shouldn't be attached on the
00:43:39.201 --> 00:43:40.138 production site.
00:43:40.368 --> 00:43:41.438 Let me just start there.
00:43:41.508 --> 00:43:43.178 Don't attach to a production site.
00:43:44.268 --> 00:43:48.925 Uh, but if you're pointed at a production database, which
00:43:48.925 --> 00:43:52.538 again, please don't do that either. I don't.
00:43:52.668 --> 00:43:57.302 Don't also log in as random users using the debugger, so
00:43:57.302 --> 00:44:02.018 that was a lot of don't dudes, but don't do those things.
00:44:04.088 --> 00:44:04.328 Right.
00:44:05.068 --> 00:44:07.078 Tony Stark, don't do anything I would do.
00:44:08.158 --> 00:44:08.848 Don't do anything.
00:44:08.858 --> 00:44:11.428 I wouldn't do the nice silver lining.
00:44:11.678 --> 00:44:12.398 That's where you stay.
00:44:14.628 --> 00:44:16.648 So finally worked and it only took 7 minutes.
00:44:17.118 --> 00:44:19.398 Umm, but you could see.
00:44:18.078 --> 00:44:21.220 Because of the being attached and the rules thing that we're
00:44:21.220 --> 00:44:23.178 going to fix that roles thing, right?
00:44:23.248 --> 00:44:23.918 Yeah.
00:44:24.028 --> 00:44:27.629 Well, I just logged into clarity admin in the browser earlier
00:44:27.629 --> 00:44:30.358 today and it did not take 7 minutes to log in.
00:44:30.368 --> 00:44:31.138 It's it's.
00:44:31.208 --> 00:44:36.556 It still took like 20 seconds, which is a while, but is most of
00:44:33.048 --> 00:44:36.058 But it's using the remote database is is part of it.
00:44:36.068 --> 00:44:38.982 I never use the remote data spaces anymore because it it
00:44:36.556 --> 00:44:37.308 it, yeah.
00:44:38.982 --> 00:44:40.158 used to be really fast.
00:44:40.168 --> 00:44:43.428 I remember it's something to do with getting full or something.
00:44:44.138 --> 00:44:51.071 It's probably a combination of more utilization and uh, less
00:44:51.071 --> 00:44:52.548 optimization.
00:44:54.128 --> 00:44:59.318 Umm, but yeah, that's correct.
00:44:55.068 --> 00:44:57.028 That was pretty vague answer dude, but.
00:45:01.228 --> 00:45:01.508 Uh.
00:45:02.838 --> 00:45:02.998 Yes.
00:45:04.528 --> 00:45:05.338 Uh-huh.
00:45:06.208 --> 00:45:11.375 But anyway, so now I'm logged in and I can go back over here and
00:45:11.375 --> 00:45:14.158 rerun this endpoint and it worked.
00:45:14.268 --> 00:45:15.928 I'm not attached anymore, so let me reattach.
00:45:19.008 --> 00:45:23.034 And again, something I point out earlier, I'm nowhere near that
00:45:23.034 --> 00:45:24.418 break point right now.
00:45:24.428 --> 00:45:27.639 In fact, I'll go in here and the breakpoints thing and disable
00:45:27.639 --> 00:45:30.238 every break point I have, of which there are many.
00:45:31.588 --> 00:45:35.004 So much PCs work, but I have no break points enabled by
00:45:35.004 --> 00:45:38.663 exception settings are still checked if I run this, it will
00:45:38.663 --> 00:45:40.798 still take me right to that error.
00:45:42.868 --> 00:45:46.728 So this is a very nice thing to have.
00:45:47.058 --> 00:45:50.382 Keep this checked if you're getting annoyed by certain
00:45:50.382 --> 00:45:54.190 EXCEPTIONS popping up that you don't care about, you can check
00:45:54.190 --> 00:45:57.816 this accept when thrown from uh, or if it's like a specific
00:45:57.816 --> 00:46:01.684 exception type of like the not authorized one or something, and
00:46:01.684 --> 00:46:03.618 you're not trying to debug that.
00:46:03.628 --> 00:46:06.872 You can uncheck that break when this exception type is thrown
00:46:06.872 --> 00:46:09.855 right here and you'll see that it changes that to not be
00:46:09.855 --> 00:46:12.942 checked anymore because we unchecked the type of exception
00:46:12.942 --> 00:46:13.308 but so.
00:46:16.328 --> 00:46:16.538 Yeah.
00:46:19.048 --> 00:46:21.712 So that's the majority of what we wanted to cover here, I
00:46:21.712 --> 00:46:21.988 think.
00:46:26.138 --> 00:46:26.538 Maybe.