Tag Archives: .net

.NET Framework 2.0 is not installed on Windows 8 Developer Preview by default

.NET Framework 2.0 is not installed on Windows 8 Developer Preview by default.

To install it, go to Control Panel – Programs – Turn Windows features on or off – Check ‘Microsoft .NET Framework 3.5.1’ – OK.

Note, that .NET Framework 2.0 is included into version 3.5.

Below are some screenshots from the installation process.

Call to OpenFileDialog or SaveFileDialog hangs or freezes

Today I was debugging a very strange issue when call to OpenFileDialog and SaveFileDialog hanged, froze, never returned…

At first I thought the problem is, that call is made from SysTray (Notification area) hidden window. However, digging deeper things got more bizarre. I found a thread in MS forum, where was a workaround – add help button to OpenFileDialog.

When I say that it “hangs” I mean that the dialog does not display but no exception is thrown and the system eventually throws in a little wait cursor to indicate that the program is getting time. It doesn’t hang the entire computer, fortunately, but the application has to be terminated.

For OpenFileDialog the ShowHelp property must be explicitly set.
For SaveFileDialog the ShowHelp, CreatePrompt, and OverwritePrompt properties must be explicitly set.

It’s not consistent though. I’ve had SaveFileDialog work with just ShowHelp set in simple situations. But I have an app which didn’t start running again until I also set CreatePrompt and OverwritePrompt properties then it started working again. They don’t have to be set to true, they just have to be initialized to either true or false.

Original forum post: click here.

So I tried:
myDialog.ShowHelp = true;

And it worked. So bizarre I thought.

After little more testing I found next problem. If file is not found, then dialog must show warning that ‘File not found. Check the file name and try again.’ And it showed the warning… and hanged…

From the beginning I was ignoring one fact, that this actually is a .NET COM object, and that I am calling it from MTA threading model (multi-thread apartment). By default .NET COM objects advertise themselves as BOTH (STA, MTA), so I changed calling thread to STA. Changed CoInitializeEx to CoInitialize, and suddenly everything worked like a charm.

I am not a COM expert, so if you find some flaws please let me know in comments!

2011 links no. 1

3D Software Rendering Engine – Part I by darkoman.

Fluent CSV/XML Exporter For List by Sacha Barber allows to export / save any C# container to CSV and XML.

Push Framework – A C++ toolkit for high performance server development in Windows by Ahmed Charfeddine.

Next part in Task Parallel Library: 5 of n by Sacha Barber.

ISO C++ Committee Approves C++0x Final Draft. Standard is going to be published, to be known as C++ 2011.

Is it reasonable to use the prefix increment operator ++it instead of postfix operator it++ for iterators. Andrey Karpov about C++ iterators.

Which Version of .NET is Built into Windows? To my surprise, Windows Server 2008 have .NET 3.0 off by default.

Microsoft Mathematics (formerly Microsoft Math) is free as in beer.

What do you do for lunch every day? Where do you eat it? With whom? Joel Spolsky writes about software teams.

Invoke .NET Assembly from Native C++ Code. With examples for Visual Studio. Hosted on CodePlex.

The attackers plant their PHP scripts, similar to those I described in previously mentioned diaries. These scripts vary from simple to very advanced scripts that can automatically monitor Google trend queries and create artificial web pages containing information that is currently interested. More on Google image poisoning.

Video: How Google is protecting their Data Centers (logically and physically).