The Wiert Corner – irregular stream of stuff

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

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

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

    Join 1,862 other subscribers

Archive for the ‘.NET 1.x’ Category

Igor Ostrovsky: C# – The C# Memory Model in Theory and Practice;

Posted by jpluimers on 2013/07/16

Just found out that Igor Ostrovsky wrote two really nice articles on .NET memory management as part of his great series of other .NET articles there:

  1. C# – The C# Memory Model in Theory and Practice.
  2. C# – The C# Memory Model in Theory and Practice, Part 2.

–jeroen

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 »

Using ILDASM to determine the .NET Framework version an Assembly/DLL requires (via StackOverflow)

Posted by jpluimers on 2013/07/11

Josh Stodola wrote a nice answer on the Determine .NET Framework version for dll – Stack Overflow question for using ILDASM to show the required .NET Framework/CLR version for an assembly.

From that, I wrote this tiny batch file:

ildasm.exe %1 /metadata[=MDHEADER] /text /noil | find "Metadata section:"

It gives output like this:

ildasm.exe C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.XML.dll /metadata[=MDHEADER] /text /noil | find "Metadata section:"
// Metadata section: 0x424a5342, version: 1.1, extra: 0, version len: 12, version: v4.0.30319

The cool thing is that older ILDASM versions work on assemblies requiring newer .NET Frameworks/CLRs.

So it is relatively future proof.

–jeroen

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, Development, Software Development | Leave a Comment »

A few more interesting links on Delphi, C# and CLR history (trip down memory lane; Peter Sollich)

Posted by jpluimers on 2013/02/27

The continuation of the trip down memory lane

Few people know the name Peter Sollich, as he always chose not to be a public figure (for instance, he is absent on the Outstanding Technical Achievement video).

Peter has been very important for both the Delphi and the .NET worlds: he was the original author of the 32-bit product that became the Delphi x86 compiler.

A few interesting links came up when using his name in some Google searches.

–jeroen

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, .NET 3.5, .NET 4.0, .NET 4.5, .NET CF, C++, C++ Builder, Delphi 1, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Development, Software Development | 2 Comments »

Behind the Code with Anders Hejlsberg (via: Cape Cod Gunny Does Delphi: Priceless)

Posted by jpluimers on 2013/02/26

I remember having heard this interview on audio a long while ago, but couldn’t find it back. Now I stumbled across Cape Cod Gunny writing about this great video where Anders Hejlsberg is interviews by Research Channel for an hour. To quote Cape Cod Gunny:

I just watched this interview with Anders Hejlsberg for the first time. This is truly an amazing interview. It’s rather long, about 1 hour, but it is so worth it. I’m not giving anything away… you’ll have to just watch and enjoy.

I am giving a few things away: trip down memory lane, putting big parts of software development history into perspective,

Since Anders has been so versatile, influential and still humble, this is a must watch for anyone in the software field. To quote Research Channel:

This episode features industry luminary, Anders Hejlsberg. Before coming to Microsoft in 1996 he was well noted for his work as the principal engineer of Turbo Pascal and the chief architect of the Delphi product line. At Microsoft, he was the architect for the Visual J++ development system and the Windows Foundation Classes (WFC). Promoted to Distinguished Engineer in 2000, Anders is the chief designer of the C# programming language and a key participant in the development of Microsoft’s .NET Framework. In this show, Anders is joined by a surprise guest. This episode of ‘Behind the Code’ is hosted by Barbara Fox – former senior security architect of cryptography and digital rights management for Microsoft.

Thanks Gunny for pointing me at this!

–jeroen

via: Cape Cod Gunny Does Delphi: Priceless: Behind the Code with Anders Hejlsberg.

(PS: how a video published in the C# 3 era can be so current <g>).

And if you feel for more, here, hereherehere and here are some more, are a few lists of videos where Anders speaks.
From a historic perspective, I like these most:

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, Delphi, Delphi 1, Delphi 3, Delphi 4, Delphi 5, Delphi 6, Development, Software Development | 4 Comments »

.NET/C#: do not do “if (!Directory.Exists(path)) Directory.CreateDirectory(path))”

Posted by jpluimers on 2013/01/24

During code reviews, I often see people do things like this:

if (!Directory.Exists(directoryPath))
    Directory.CreateDirectory(directoryPath);

or this:

DirectoryInfo directoryInfo = new DirectoryInfo(directoryPath);
if (!directoryInfo.Exists)
    directoryInfo.Create();

You don’t need the if statements here. Read the rest of this entry »

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, Development, Software Development | 1 Comment »

Tips, links & tools to help you out when you find yourself in .NET assembly hell

Posted by jpluimers on 2013/01/23

A while ago I found myself in .NET Assembly hell.

I inherited a bunch of interdependent .NET projects with no clear build instructions that were halfway ported between .NET 1.x and 4.x had various binaries here and there, a mix of of imported Office COM libraries and PIAs, links to various source code and binary versions 3rd party libraries like Microsoft Enterprise Library (which is very unforgiving when you get configuration wrong, and – because it uses dynamic loading and the version used was from before MEF – is painfully hard to track down wrong types and assemblies).

Basically the right assemblies got into the wrong places, the wrong assemblies in the right places, and a version mix up all over the place.

All in all it was a mess, and I was in .NET assembly hell.

It was a tedious and painful process to solve, so below are a few tips, links to posts and tools that helped me getting this solved. Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 4.0, Development, Software Development | Leave a Comment »

Converting Visual Studio 2003 WinForms to Visual Studio 2005/2008/2010/2012 partial classes (via: Duncan Smart’s Weblog)

Posted by jpluimers on 2013/01/10

In the .NET 1.x past, the WinForms designers in Visual Studio .NET and Visual Studio 2003 would put the C# or VB.NET code containing the form code as the InitializeComponent method of the top most class monolithic C# and VB.NET files that also contain the user code (for events and such).

As of Visual Studio 2005 (actually: Whidbey and higher), this code is based on partial classes. For each form (actually designable entity, but lets limit this to WinForms forms) you get a MyForm.cs and MyForm.Designer.cs

As a side note, with a bit of effort, you can generate the Windows Form Designer generated code yourself as this answer shows. This is for instance convenient when you have form definitions in a different technology and want to convert it to WinForms, WPF or another form of designer based .NET code.

I long time ago I wrote a short manual for co-workers on converting the monolithic files (for people interested, it is below).

Since then I found a couple of very interesting links: Read the rest of this entry »

Posted in .NET, .NET 1.x, .NET 2.0, .NET 3.0, C#, C# 1.0, C# 2.0, C# 3.0, C# 4.0, C# 5.0, Development, Software Development, Visual Studio 11, Visual Studio 2002, Visual Studio 2003, Visual Studio 2005, Visual Studio 2008, Visual Studio 2010, Visual Studio and tools, WinForms | 1 Comment »

.NET/C#/WinForms: small code snippet to enable Ctrl-A for select all in a single/multi-line TextBox

Posted by jpluimers on 2012/12/04

WinForms does not automatically enable Ctrl-A as “Select All” action.

The below code snippet works when you bind it to the KeyDown event of a TextBox (actually the event is on Control).

The e.SuppressKeyPress = true suppresses the bell sound in a multiline TextBox, as e.Handled = true won’t.

        private void textBox_KeyDown_HandleCtrlAToSelectAllText(object sender, KeyEventArgs e)
        {
            TextBox textBox = sender as TextBox;
            if (null != textBox)
            {
                if (e.Control && e.KeyCode == Keys.A)
                {
                    textBox.SelectAll();
                    e.SuppressKeyPress = true;
                }
            }
        }

–jeroen

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, Development, Software Development | Leave a Comment »

Some notes on finding the cause of a .NET app generating a “application has generated an exception that could not be handled”

Posted by jpluimers on 2012/11/15

A while ago, one of the users at a client got an error in a .NET 1.1 app of which the sources were not readily available:

“application has generated an exception that could not be handled”

I think it is a e0434f4d  exception.

This particular site has very strict rules about what you can and cannot do as a developer. Which means that on a production system, you basically cannot do anything.

A few links that should help me finding the solution, and escalate far enough upstream to get someone with local admin rights to assist me:

If WinDbg is allows to be ran, these should help me:

–jeroen

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, Development, Software Development | Leave a Comment »

Some #reflector URLs

Posted by jpluimers on 2011/02/17

While it is still free…

The current version: http://reflector.red-gate.com/Reflector.zip

The “Check for Updates” entry in the “Help” menu checks this URL: http://reflector.red-gate.com/Reflector.version

Which currently returns:

6.6.0.30
6.1.0.0
http://reflector.red-gate.com/Download.aspx?File=Reflector&Client={Client}&Version={Version}

When Reflector detects there is a new version, you get a dialog like this:

—————————
.NET Reflector
—————————
A new version of .NET Reflector is available. Do you want to install automatically?
—————————
Yes No
—————————

When you press [Yes], it starts downloading from a URL that depends on the current version: http://reflector.red-gate.com/Download.aspx?File=Reflector&Client=Reflector&Version=6.5.0.135

{Client} was replaced by Reflector, and {Version} was replaced by 6.5.0.135 (the version of the currently running Reflector).

–jeroen

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