The book of inspiration

March 19, 2010

Forget booleans

Filed under: tech — Tags: — zproxy @ 12:11 pm

While watching this Out of Browser Experience video I got the idea to reuse the is keyword:

Thoughts?

Update: IntelliSense for is operator should filter to types known to subclass the referenced member.

October 22, 2009

‘MS.Win32.Penimc.UnsafeNativeMethods’ threw an exception

Filed under: tech — Tags: , , — zproxy @ 11:30 am

Yesterday I installed Visual Studio 2010 beta 2. All good.

Today I tried to run a WPF application. Crash!

Unhandled Exception: System.TypeInitializationException: The type initializer for ‘MS.Win32.Penimc.UnsafeNativeMethods’ threw an exception. —> System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {14D4CBD9-7490-4F25-BAA6-1C5E22F6B1E3} failed due to the fo
llowing error: 80040154.
at MS.Win32.Penimc.UnsafeNativeMethods..cctor()


I needed to consult google to learn how to actually file a bug to microsoft. Oh and connect site does NOT work with Google Chrome.

Update: After a few days I created this forum thread.

This is by no means the first issue I have encountered with WPF. Previously I have seen WPF to become unresponsive just like the rendered is not there. I had to reboot to overcome that.

WPF is great, but it kind of fails once too much!

Update: Notified Jason about the issue.

Update: The fix looks like this at the time:

C:\Windows\Microsoft.NET\Framework\v3.0\WPF>regsvr32 PenIMC.dll

June 7, 2009

Program started via system diagnostics process hangs

Filed under: programming — Tags: , — zproxy @ 6:42 pm

wrong-mike.jpg

The other day I was reading the standard output of another process I had created. If the output happened to be somewhat longer then the application would hang. I found that really odd and started to blame the external application at first, but after consulting to google™ I was told what I was doing it wrong. The compiler could of had warned be about the issue but it didn’t and I was left with a hanging application, which sucked. In short you have to make sure your StandardError stream wont pile up its precious buffer of 4096 bytes.

[…] you have a more general problem, which is the possibility that the standard output
will wind up blocked because you haven’t been reading from standard error.

In most cases, this may not be a problem, assuming the output to
standard error is brief. But it’s a basic issue with redirection of the
Process class standard i/o streams: if you redirect more than one, you
need to make sure you are using some form of asynchronous access to send
or receive data from all of them as appropriate. Otherwise, the console
application winds up blocked trying to read or write to one of the
streams, causing a form of deadlock.

The documentation for the Process class has a good, detailed explanation
of this. It’s helpful to read that if you intend to redirect the streams.

Pete

Learn something new each day… I guess one day google will be able to have a look at your problem and simply suggest the fix, but until then that remains as a manual feature.

December 3, 2008

One cannot have multiple configuration files

Filed under: c# — Tags: , , — zproxy @ 3:33 pm

You really cannot have multiple configuration files, for example each per referenced assembly.

.NET configuration subsystem always uses a single configuration file per AppDomain, and it is very much .exe centric.

What this means is that even though you created separate config file for your library assembly, it will never be picked up — .NET config subsystem will always look at your .exe configuration file for settings.

What you should do is simply put all your configuration options, including Coherence configuration, into your main application’s App.config and remove library configuration file from your solution, as it will never be used.

If you really need to have separate configuration file for the library and want to specify Coherence configuration options there (and there are very few reasons why you would want to do that), you will need to load your class library into a separate AppDomain and specify the config file to use. Take a look at MSDN documentation for AppDomainSetup.ConfigurationFile property for an example on how to do that, but again, that’s probably not what you want to do.

Read more about the architecture over here.

Blog at WordPress.com.