I spend most of my working life building website code at work, and sometimes I get involved in performance work with that sort of system. In fact I've written and presented on that topic for Sitecore in the past. But some code I've been working on in my own time needs much more focus on code performance than that - the maths-heavy code for ray tracing. I've been looking at some optimisiations for that recently. And one thing that this has reinforced for me is how "easy to write" code can have some performance challenges...
I was having a chat recently about alternatives to
Postman
if you needed to send HTTP requests to arbitrary web endpoints. I mentioned using Visual Studio's support for
.http
files for this during that discussion, and then found myself trying it out for some work too. But it seems there's a couple of tricky little bugs hiding in here, which tripped me up when I tried to set up a call to one of Sitecore's XM Cloud GraphQL endpoints.
The approach I read on how to "how to attach your debugger to Sitecore inside Docker" by running
docker inspect
to fetch the current IP address, and pasting it into Visual Studio can be a bit of a faff. So I got to wondering: Are there other ways to achieve the same result?
I've been using VS2019 for all my personal development work pretty much since the first preview came out. For general coding and debugging it's been good so far – stable, and effective. And little things like git stash control from the UI make me happy... It got its full release recently, just before I spoke at SUGCON 2019 – where I said I'd blog something about how 2019 changed the performance measurement stuff that I was presenting. Having done some tests in the last few days, it's not looking so shiny any more...
Working on a couple of personal projects recently, I've been reminded again how helpful I find the profiling tools that Visual Studio's debugger gives you. As you may have guessed from some of my previous posts, every so often I get to worry about the performance of .Net code at work – but it's useful for any sort of project, not just Sitecore. And investigating some issues in my own code, memory snapshots and deltas helped me out again. So maybe they could help you too?
I got the chance to speak at the Manchester Sitecore user group recently, introducing some tools and tricks that can be used to measure site performance while you're developing your Sitecore code. For anyone who wasn't there (and those who were but, want to refer back to what I said) here's a summary of the important bits of content from that talk...
I've been using the built-in code snippets in Visual Studio for years, but for some reason until last week it had never crossed my mind to work out how to create my own. After getting bored writing the same chunk of code too often, I was reminded of the old saying "You should automate any task you have to do more than once". So I decided to have a go at some snippets. Turns out it's both a useful trick to know, and not hard to do:
Recently the hard drive in my trusty old laptop failed. Annoying, but ultimately it was just an excuse to go shopping, ignore most of my backup of the old machine and re-install all my programs from scratch. As part of that I decided that I'd try experimenting with the latest pre-release version of Visual Studio 15, to see if it was stable enough for me to use for my personal projects and blog coding now.
So having worked out how you re-install a "free upgrade from Win7" copy of Windows 10 and gone through through Visual Studio's new installer, I tried to clone some code from my private git server. Having been greeted with some cryptic errors, I've spent some time working out how to resolve the issue. So as ever, I'm writing it all down in case it's of help to others...
It is quite possible that this issue is entirely down to some odd aspect of the setup of the Virtual Machine I'm developing on at the moment, but recently I've experienced quite a few hangs when loading Sitecore solutions. Starting up Visual Studio to be greeted with a never ending progress bar:
A bit of a change of tack this week. Rather than writing about something I've been doing, I'd like to ask for your ideas on something I've been thinking about. This issue is way to complex to compress into a tweet to ask on Twitter, and it seems too opinion based to be asked on Stack Overflow. So I'll ask it here, in the hope that some of you clever people might offer your opinions. Comment below, tweet me, write blog posts in response, send carrier pigeons or whatever. All thoughts appreciated...
So here's what I'm thinking about: How do you set up your projects for development?