Mar 30, 2012

Errors on GAC operations

If on any GAC operation you receive gacutil.exe errors similar to this:

Failure adding assembly to the cache: Access denied. You might not have administrative credentials to perform this task. Contact your system administrator for assistance.

but, on contrary to the message, you have administrator rights then problem is, almost certanly in enabled UAC. Either use "Run as Administrator" or just disable damn UAC.

Digger.NET in development, part 3

Well, project progress is good (considering how little free time I spend on it). I must admit that XNA is very convenient framework to work with, so some glory goes there. By now I've converted all graphics, and project Digger.Convert can be treated as accomplished.

Now I've switched to actual DiggerGame project. As I previously mentioned first part would be implementing ultra-simple text editor using game's bitmap font. As of now, I partially succeeded in that, it was somethat simplier then I thought. Oddly enough such simple procedure as reading text input in XNA can become very complicated. Nonetheless, here it comes, first screen of a my very first, big expectations XNA app:














The screen size is original 320x200 resolution. I've decided to work initially with it, and add scaling later (yet not decided how to do it right). It types all pressed keys in one row. That's all. It doesn't correctly process keys other then letters. But I'm excited like I've written some good game. That's what I like about programmig. Game programming excites even more, because you basically see the result of your work.

Mar 27, 2012

A way to fix freezing WMI

Problem symptoms (as on my Windows Server 2008 R2 Standard x64), after reboot you have following problems:
  1. WMI functions are unacessible. For example, if you try to start "SQL Server Configuration Manager" (which uses WMI internally) it will fail to lauch with error. Other programs just won't start or freeze indefinetely;
  2. svchost.exe process which hosts "Windows Management Instrumentation" service (Winmgmt) will use 100% of single CPU core time;
  3. HDD led will glow constantly;
  4. If you wait for some time (some hours) all previous symptoms disapper and everything functions normally until next reboot.
My solution was to:
  1. Load into "Safe mode";
  2. Kill svchost.exe in question via Task Manager, and then quickly;
  3. Delete "%systemroot%\System32\wbem\Repository" folder;
  4. Reboot.
Again you need to perform steps 2 and 3 quickly, since Windows will restart "Winmgmt" service shortly after it was killed, and running "Winmgmt" blocks deletion of this folder.

After this procedure Windows will recreate this folder and symptoms described above will stop. I think this folder is some kind of cache, which becomes either corrupted (more likely) or very large and WMI service enters some kind of almost infinite loop on booting then processing this folder data. As an interesting fact "Repository" folder which I deleted on my system was 559Mb, while recreted folder is 22Mb which is 25 times difference.

Mar 25, 2012

View a contents of the GAC in .NET 4.0

Did you knew that the only correct way to view the content of GAC (as of .NET Framework 4.0) is by using gacutil –l command? Discovered that just now. My first reaction was "ORLY?". Microsoft must be joking but, no. Old good assembly folder indeed doesn't show all .NET 4.0 assemblies. ILSpy's (ILSpy 1.0.0.1000) "Open from GAC" also showed wrong results then searching assembly by name.

As I've discovered there are two GACs now, and this is the root of the problem. To complicate things more, there is two gacutil.exe (four if you count x86 and x64 versions) versions, one for CLR 2.0, and one for CLR 4.0.

Can't say for everyone, but searching some hundreds assemblies thru a console output of seems like a not very convenient work. That's an odd, strange behaviour for such developer oriented company as Microsoft. So currently I'm in search for good universal utility which will provide convenient interface to manage this GAC mess. I'll update this post if there will be any progress in this quest.

Update. Here is my discussion about gacutil.exe on StackOverflow.

Mar 21, 2012

Digger.NET in development, part 2

As mentioned in previous post I've started by convertion graphics data to real graphics file format. The easiest part was symbols data, i.e. game font. The result is as follows:













This is a 192x192 image (16x16 symbol grid), there symbol is located based on it's ASCII code value.

The symbol data was a simple single bit per pixel, there each pixel was half of the byte. For examle symbol A was represented as follows:

A
0x00 0xff 0xff 0xff 0x00 0x00
0x0f 0xff 0xff 0xff 0xf0 0x00
0x0f 0xf0 0x00 0x0f 0xf0 0x00
0x0f 0xf0 0x00 0x0f 0xf0 0x00
0x0f 0xf0 0x00 0x0f 0xf0 0x00
0x0f 0xff 0xff 0xff 0xf0 0x00
0xff 0xff 0xff 0xff 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00
0xff 0xf0 0x00 0x00 0xff 0x00


Initial A is a header the rest is the symbol data. Full symbol data file can be viewed here.

Mar 11, 2012

Digger.NET in development, part 1

As you probably may not know, I'm very interested in game development, but, unfortunatelly, after some attemps some years ago, still have not done anything interesting. Some time ago I've learned about XNA, and again was ready for another attempt in learning this part of software development world.

As a big first task I've decided to port a Windows version of Digger Remastered project to .NET. The original source is a DirectX Windows C application. The project I've started have two main goals: 1) maintain and improve original C source; 2) create XNA port of the game.

For a relatively long period of time I slowly cleaning up, commenting, and refactoring original source code. First big improvement was that I moved hardcoded graphics description data to a separate files. After that I was generally really bored with a project, since with such little comments in the original code it was really slow and frustrating task to decipher it. So, with a help of Learning XNA book I've decided to move on.

The first part is to convert original graphics data to real graphics format. For that porpose I've created Digger.Convert project. It's sole purpose would be a set of graphics files, which will be a sprites for a game.

Game uses custom graphical font to display text. I think it's a good idea, as a first step, make an XNA app which will print text with this custom font from a keyboard in realtime (kind of text editor). This will be my first milestone in XNA project.

Mar 7, 2012

Be careful with magical code

Just a link to a wonderful article, a must read for any developer who have that strange uncomfortable feeling working with another "silver bullet" framework.