Menu

Skip to content
  • Home
  • About
  • Color Coder
Hamid Mosalla
Twitter Email LinkedIn GitHub Stack Overflow RSS

Hamid Mosalla

Programming Adventures

.Net

.NET is a large collection of a bunch of different things really; including compilers, runtimes, programming languages and a bunch of different tools and technologies.

It provides a lot of common functionality that can be tapped into rather than recreating it from scratch.

C# is one language that can be used on .NET. It get compiled initially by Roslyn and can get additional compilation at runtime by RyuJIT. Other languages include F#, which can all be compiled and run against its runtimes.

This works because it’s generally not compiled to a particularly low level language but rather to an Intermediate Language that can be executed by a .NET runtime. The runtime then does the appropriate translations to actual system/hardware calls allowing you to not have to worry about it.

When you create at least C# projects, you have to specify what runtime you’re targeting so that it can be compiled appropriately to work; not just whether it’s Framework or Core, but also the version number since functionality of the same thing may be different.

One of the goals with .NET 5+ is to reduce the confusion by bringing many of the parts together under one umbrella, but it’s going to be a while before that replaced enough existing software to really get rid of the confusion (especially since .NET 5 isn’t going to have Long Term Support).

July 31, 2018 by Hamid Mosalla on .Net, C#, Unit Test

xUnit: Share an SUT Instance Between Two Class Using Collection

In my previous post I talked about how we can Share Expensive Object Between Tests By Using IClassFixture. My previous post is about situations when we want to share a class instance between all test methods. Because a test class is created once per test method so its constructor is executed per test methods. But … →

 
July 21, 2018 by Hamid Mosalla on .Net, C#, Unit Test

Share Expensive Object Between Tests By IClassFixture

When XUnit run a test method, it’s going to create a new object of our test class for each and everyone of our test method. This can create a problem when the creation of the object is expensive and slow our tests down. But there’s a solution to it, we can use IClassFixture to share … →

 
July 17, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Asynchronous Programming Series

Recently I wrote a series of posts regarding asynchronous programming. You can find the links to this series down below. In these series of posts I started from the definition of concurrency and how it’s different with parallelism. Then I moved on deeper into the subject by each post. My 10th post in this series … →

 
July 9, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Thread Safety

There a lot of things that can go wrong in our code. But when we introduce concurrency or parallelism in our code, we potentially could experience different set of bugs. These are race conditions, deadlocks and data corruption to name a few. This happens because there might be a share piece of data between different … →

 
June 30, 2018 by Hamid Mosalla on .Net, Asp.Net Core, C#

Dependency Injection: Conditional Resolving of Multiple Implementation of Interface

Sometimes we need to resolve a dependency but not with one implementation, but with multiple. There are couple of scenarios that calls for conditional resolving of types. Such as when using a generic class and methods with a dependency on another class. Now imagine the aforementioned class is an abstract one, and we need to … →

 
June 24, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

What Is SynchronizationContext

SynchronizationContext is one of those topics that deserves a better understanding if we want to fully know how asynchorony works in .Net. It’s true that most of these concerns handled behind the scene. But we can benefit by understanding what exactly happens when we offload a task to a worker thread or release the thread … →

 
June 19, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Exception Handling In Asynchronous Code

It is important to know how exceptions are handled in an asynchronous program. Partly because these subtle points can sometime become a headache. When exception are thrown in a code that runs inside a task, all the exceptions are placed on the task object and returned to the calling thread. When exceptions happen, all the … →

 
June 10, 2018 by Hamid Mosalla on .Net, C#, Visual Studio

NDepend 2018 Review: A Flexible Static Analyzer

NDepend is an static analyzer which can provide various useful information about the quality of the code base. With its built in rules, it calculates how much technical debt the project is in, and estimate how many hours it takes to pay them. For the first time users, the UI might be a little overwhelming, … →

 
May 27, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Task.Run Vs TaskCompletionSource Vs Task.Factory.FromAsync

There’s a lot of small intricate details that one can miss when we deal asynchronous programs. Even though these days far more superior APIs exist that make things a lot easier. For example a lot of people think if we want to call any synchronous code asynchronously, we just simply  wrap it in Task.Run. It’s … →

 
May 17, 2018 by Hamid Mosalla on .Net, Asp.Net Core, C#

Build UI Tree With Recursive Asp.Net Core View Component

Previous version of Asp.Net MVC had the concept of local view helpers that could contain HTML too. You see an example of this here. But this feature is removed in Asp.Net Core, but we have a better tool to do it. There might be a lot of other replacement solution for using @helper, but in … →

 
Older Posts →
Page 4 of 7
← Newer Posts

Archives

Categories

 
Subscribe!
Copyright © 2022 Hamid Mosalla
Casper Theme By Lacy Morrow