The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My work

  • My badges

  • Twitter Updates

  • My Flickr Stream




    More Photos
  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,524 other followers

Archive for the ‘.NET’ Category

C# Settings reminder

Posted by jpluimers on 2015/11/26

As a reminder to self: Settings are nice (too bad they advertise them as Windows Forms Application Settings, as they are just as useful for other assemblies), but be aware…

When using Settings.Default, it will get the values to the state of the app.config (or defaults if there is no app.config) of the assembly that defined the settings, not the app.config of the starting process.

This is unless your settings are merged into the app.config of the starting process.


Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, Development, Software Development | Leave a Comment »

Raise specific exceptions like InvalidOperationException, not generic ones like ApplicationException.

Posted by jpluimers on 2015/11/25

Code Analysis in Visual Studio objects against using very generic exception types:

CA2201 Do not raise reserved exception types

‘BusinessClass<T>.StopProcessing()’ creates an exception of type ‘ApplicationException’, an exception type that is not sufficiently specific and should never be raised by user code. If this exception instance might be thrown, use a different exception type.

Company.Departement.Functionality BusinessClass.cs 157

Indeed ApplicationException and SystemException are bad (both mapping to also very generic COM HRESULT values COR_E_APPLICATION / -2146232832 / 0x80131600 and COR_E_SYSTEM / -2146233087 / 0x80131501).

Using InvalidOperationException is much nicer in this case. It still maps to a COM exception (in this case COR_E_INVALIDOPERATION / -2146233079 / 0x80131509).


Posted in .NET, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Development, Software Development | Leave a Comment »

Ensure you know the state of an instance.

Posted by jpluimers on 2015/11/24

A while ago, I came across a class having (among other members) two methods named like this:

  • Start
  • Stop

Within one of the other members of the class, I had to (temporarily) Stop processing, then Start it again.

But I couldn’t, as neither Start, nor Stop would make a record of the state it left the instance in.

Always ensure you know the state of an instance.

So I added the state, and tests to ensure a Stop/Start change was indeed not breaking things.


Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, C# 6 (Roslyn), Delphi, Delphi 10 Seattle, Delphi 2007, Delphi 2009, Delphi 2010, Delphi XE, Delphi XE2, Delphi XE3, Delphi XE4, Delphi XE5, Delphi XE6, Delphi XE7, Delphi XE8, Development, Software Development | 1 Comment »

Stack Exchange – Android Apps on Google Play

Posted by jpluimers on 2015/11/18

I missed when the StackExchange App for Android was finally launched, but I totally agree with Paul Lammertsma:

Exceeds expectations This was a long time coming, but it didn’t disappoint. It’s a great aid for a regular on Stack Overflow like me!


via Stack Exchange – Android Apps on Google Play.

Posted in .NET, Delphi, Development, Pingback, Power User, Software Development, Stackoverflow | Leave a Comment »

Universal Android ADB driver for Windows – koush/UniversalAdbDriver

Posted by jpluimers on 2015/11/17

If you ever need a universal Android ADB driver for Windows, then use this one: koush/UniversalAdbDriver.

I never noticed it was there until Koushik Dutta posted about a signing trick on Google+.

Windows drivers need to be signed, so what he does is generate a self signed certificate on the fly during installation, sign the driver install it, and drop the private key of the certificate.

Each installation has its own key, Microsoft is happy, and it is proven the driver signature mechanism in Windows has a hole.

If you want to do similar things, then this commit is what you are looking for: Use a self signed, self destructing signing cert. · e8b78fe · koush/UniversalAdbDriver.

It isn’t rocket science, but not trivial C# either, so this is a great example of something that works.


Posted in .NET, Android, C#, Development, Mobile Development, Software Development | Leave a Comment »


Get every new post delivered to your Inbox.

Join 1,524 other followers

%d bloggers like this: