Logs matter. In Azure, logs generally live in Application Insights, in the Transaction Search section. This post reverse engineers the Azure Application Insights Transactions URL, and details how to construct a link to take you directly there, using both TypeScript and C#.
18 posts tagged with "c#"
View All TagsESLint your C# in VS Code with Roslyn Analyzers
ESLint provides a great linting experience for TypeScript and JavaScript in VS Code. The suggestions, fixes and ignore options make creating clean code a joy. A similar experience is available for C# in VS Code through Roslyn Analyzers - this post tells us more.
NSwag generated C# client: Open API property name clashes and decimal types rather than double
NSwag is a great tool for generating client libraries in C# and TypeScript from Open API / Swagger definitions. You can face issues where Open API property names collide due to the nature of the C# language, and when you want to use decimal
for your floating point numeric type over double
. This post demonstrates how to get over both issues.
Directory.Build.props: C# 9 for all your projects
.NET Core can make use of C# 9 by making some changes to your .csproj
files. There is a way to opt all projects in a solution into this behaviour in a single place, through using a Directory.Build.props
file and / or a Directory.Build.targets
file. Here's how to do it.
C# 9 in-process Azure Functions
C# 9 has some amazing features. Azure Functions are have two modes: isolated and in-process. Whilst isolated supports .NET 5 (and hence C# 9), in-process supports .NET Core 3.1 (C# 8). This post shows how we can use C# 9 with in-process Azure Functions running on .NET Core 3.1.
NSwag: TypeScript and CSharp client generation based on an API
Generating clients for APIs is a tremendous way to reduce the amount of work you have to do when you're building a project. Why handwrite that code when it can be auto-generated for you quickly and accurately by a tool like NSwag? To quote the docs:
Nullable reference types; CSharp's very own strictNullChecks
'Tis the season to play with new compiler settings! I'm a very keen TypeScript user and have been merrily using strictNullChecks
since it shipped. I was dimly aware that C# was also getting a similar feature by the name of nullable reference types.
Task.WhenAll / Select is a footgun 👟🔫
This post differs from my typical fayre. Most often I write "here's how to do a thing". This is not that. It's more "don't do this thing I did". And maybe also, "how can we avoid a situation like this happening again in future?". On this topic I very much don't have all the answers - but by putting my thoughts down maybe I'll learn and maybe others will educate me. I would love that!
Snapshot Testing for C#
If you're a user of Jest, you've no doubt heard of and perhaps made use of snapshot testing.
Concatting IEnumerables in C#
I hate LINQ's Enumerable.Concat
when bringing together IEnumerable
s. Not the behaviour (I love that!) but rather how code ends up looking when you use it. Consider this:
TFS 2012, .NET 4.5 and C# 6
So, you want to use C# 6 language features and you’re working on an older project that’s still rocking .NET 4.5. Well, with some caveats, you can.
IQueryable... IEnumerable... Hmmm...
So there I was, tip-tapping away at my keyboard when I became aware of the slowly loudening noise of a debate. It wasn't about poverty, war, civil rights or anything like that. No; this was far more contentious. It was about the behaviour of <a href="https://msdn.microsoft.com/en-gb/library/bb351562(v=vs.100).aspx">IQueryable<T></a>
when mixed with <a href="https://msdn.microsoft.com/en-gb/library/9eekhta0(v=vs.100).aspx">IEnumerable<T></a>
. I know, right, how could I not get involved?
(Top One, Nice One) Get Sorted
I was recently reading a post by Jaime González García which featured the following mind-bending proposition:
Getting up to speed with Bloomberg's Open API...
A good portion of any devs life is usually spent playing with APIs. If you need to integrate some other system into the system you're working on (and it's rare to come upon a situation where this doesn't happen at some point) then it's API time.
Giving OData to CRM 4.0
Just recently I was tasked with seeing if we could provide a way to access our Dynamics CRM instance via OData. My initial investigations made it seem like there was nothing for me to do; CRM 2011 provides OData support out of the box. Small problem. We were running CRM 4.0.
ClosedXML - the real SDK for Excel
Simplicity appeals to me. It always has. Something that is simple is straightforward to comprehend and is consequently easy to use. It's clarity.
Making PDFs from HTML in C# using WKHTMLtoPDF
Updated 03/01/2013
I've written a subsequent post which builds on the work of this original post. The new post exposes this functionality via a WCF service and can be found here.
Making PDFs from HTML
I wanted to talk about an approach I've discovered for making PDFs directly from HTML. I realise that in these wild and crazy days of PDF.js and the like that techniques like this must seem very old hat. That said, this technique works and more importantly it solves a problem I was faced with but without forcing the users to move the "newest hottest version of X". Much as many of would love to solve problems this way, alas many corporations move slower than that and in the meantime we still have to deliver - we still have to meet requirements. Rather than just say "I did this" I thought I'd record how I got to this point in the first place. I don't know about you but I find the reasoning behind why different technical decisions get made quite an interesting topic...
JavaScript - getting to know the beast...
So it's 2010 and I've started using jQuery. jQuery is a JavaScript library. This means that I'm writing JavaScript... Gulp! I should say that at this point in time I hated JavaScript (I have mentioned this previously). But what I know now is that I barely understood the language at all. All the JavaScript I knew was the result of copying and pasting after I'd hit "view source". I don't feel too bad about this - not because my ignorance was laudable but because I certainly wasn't alone in this. It seems that up until recently hardly anyone knew anything about JavaScript. It puzzles me now that I thought this was okay. I suppose like many people I didn't think JavaScript was capable of much and hence felt time spent researching it would be wasted. Just to illustrate where I was then, here is 2009 John's idea of some pretty "advanced" JavaScript: