No Internet on Azure VM

I have been using a Virtual Machine on Azure for development purposes for over a year now. I had used this machine several times this week, but from one day to another, "the internet disappeared" on it. Obviously, it was connected to the network, as I was able to log with an RDP session, and even pinging IP-s worked just fine, but no websites were loaded by any browser.

Did some searches on the issue, and found a couple of posts in the topic, but nothing helped.

Symptoms

  • Pages don't load in the web browers

  • Cannot connect to OneDrive

  • My test application could not connect to other Azure resources, like table store

  • RDP works

  • Ping works

  • nslookup fails

  • I did not change anything explicitly on the machine

  • I did not change anything explicitly on the Virtual Network, Network Interface or Network Security group resources

Find out more


ConcurrentDictionary over List 3

Doing it one way

In the previous post, I have shown why the following type can be dangerous:

ConcurrentDictionary<string, List>

The problem starts when we have multiple threads using (writing and reading) this dictionary at the same time. To avoid state corruption, we need to control this access by making it thread-safe.

Find out more


Perfomance testing within Unit tests bad idea

I have doing performance tests in regular Console apps and BenchmarkDotNet for a while. Recently I have been seeing people doing the same from unit tests. At first it seems to have many advantages to run a unit test to measure how long a certain peace of code runs.

Certain things I noted immediately:

  • The time to run a unit tests != the time your peace of code runs

  • It is a lot more difficult to measure only a certain portion of an algorithm, you will likely to include measuring test initializers

  • Running along with a test framework brings a lot of dependencies, which you would not have in a regular empty console application

  • Console out: some test frameworks makes it difficult to write out to the console, for example in xUnit you can use a special dependency: ITestOutputHelper

  • Memory profiling is more difficult too: capturing GC heaps for comparisons brings a lot of objects into the view, that are allocated by the test framework

  • Test might be run in Debug

  • CI/CD pipelines with multiple build agents might measure different results because of different load/underlying hardware

In conclusion, I would still suggest to use regular Release built C# console apps with a well-known benchmark framework for performance testing.

Find out more


ConcurrentDictionary over List 2

Doing it wrong again

In the previous post, I have shown why the following type can be dangerous:

ConcurrentDictionary<string, List<int>>

The problem starts when we have multiple threads using (writing and reading) this dictionary at the same time. To avoid state corruption, we need to control this access by making it thread-safe.

Find out more


ConcurrentDictionary over List 1

One of the rare situations, I face is having a dictionary of key-value pairs, where the values are a collection of some items. One example could be the following dictionary, where the keys are strings, and the values are a list of integers.

ConcurrentDictionary<string, List<int>>

In the series of this and the following posts, I will investigate how these collections can be made thread-safe.

Problem

Find out more