Bugs

Is select (System.Uri) broken?

I can’t really figure out what is going on! Take a look: The value : http://localhost:58080/indexes/categoriesByName?query=CategoryName%3ABeverages&start=0&pageSize=25 And the problem is that I can’t figure out why calling this once would fail, but calling it the second time would fail. That is leaving aside the fact this looks like a pretty good url to me. Any ideas? This is perfectly reproducible on one project, but I can’t reproduce this on another project. Updates: This is System.Uri The issue that it fails the first...

posted @ Thursday, March 04, 2010 9:05 PM | Feedback (20)

Where do git repositories go when they die?

My RDB repository started giving me this error; fatal: Not a git repository (or any of the parent directories): .git I don’t think that I did anything to it, but it is still dead. Any ideas how to recover this? Update: Found why Git doesn't like my repository, it doesn't have .git\objects, but I have no idea where it could have gone to… or why.

posted @ Tuesday, March 02, 2010 3:33 PM | Feedback (6)

Answer: Debugging a resource leak

As it turns out, there are a LOT of issues with this code: public class QueueActions : IDisposable { UnmanagedDatabaseConnection database; public string Name { get; private set; } public class QueueActions( UnmanagedDatabaseConnectionFactory factory) { database = factory.Create(); database.Open(()=> Name = database.ReadName()); } // assume proper GC finalizer impl public void Dispose() { ...

posted @ Thursday, February 11, 2010 12:00 PM | Feedback (0)

A marketing mistake: WCF Data Services & WCF RIA Services

There are some things that I just don’t understand, and the decision to name two apparently different technologies working in the same area using those two names is one of them. The image on the right is from In Search Of Stupidity, an excellent and funny book, which talks about a lot of marketing mistakes that software, dedicate a whole chapter for this error. Coming back to WCF Data Services & WCF RIA Services, I read this page, and I am still confused. It appears that the major difference in that RIA services will generate the Silverlight client...

posted @ Sunday, February 07, 2010 12:00 PM | Feedback (12)

When the design violates the principle of least surprise, you don’t close it as By Design

I don’t actually have an opinion about the actual feature, but I felt that I just have to comment on this post, from Brad Wilson, about the [Required] attribute in ASP.Net MVC 2. Approximately once every 21.12 seconds, someone will ask this question on the ASP.NET MVC forums … The answer is the title of this blog post. ([Required] Doesn’t Mean What You Think It Does) If this is the case, I have to say that the design of [Required] is misleading, and should be change to match...

posted @ Thursday, January 21, 2010 9:14 AM | Feedback (7)

How to opt out of Program Compatibility Assistant?

A recent change in the profiler has resulted in the following dialog showing up whenever you close the application on x64 Vista/Win7 machines. Just to be clear, I am not using flash in any way, but something is triggering this check. Basically, I think that somewhere a call like the one described here is made. Checking for the presence of flash, and that is what triggers the PCA dialog. That makes a sort of sense, mostly because we now shell out to IE to do some stuff for us (we use WPF’s builtin WebBrowser...

posted @ Tuesday, January 12, 2010 9:10 AM | Feedback (1)

The operation was successful, but the patient is still dead… deferring the obvious doesn’t work

So, I have a problem with the profiler. At the root of things, the profiler is managing a bunch of strings (SQL statements, stack traces, alerts, etc). When you start pouring large amount of information into the profiler, the number of strings that it is going to keep in memory is going to increase, until you get to say hello to OutOfMemoryException. During my attempt to resolve this issue, I figured out that string interning was likely to be the most efficient way to resolve my problem. After all, most of the strings that I have to display are...

posted @ Saturday, December 26, 2009 12:00 PM | Feedback (14)

NHProf.com downtime, and using windows as a server system

Yesterday nhprof.com was down, there was a YSOD and when I logged into the server to try to figure out what the problem was, I got this: The server has been running with no issues for over a year, so it is not an issue with not activating after installation. This is a Windows 2008 Server, and I find it incovievable that a server would go down because of activation. To spread more salt on the wound, it wasn’t a problem that could be fixed remotely, I had to call my host and ask them to...

posted @ Monday, November 30, 2009 3:47 PM | Feedback (25)

Debugging Win32 crash in NH Prof

One of the things that happened when I pushed the UberProf build of NH Prof out is that people started complaining that trying to load a saved snapshot would crash the application. It took me a while to reproduce that, but I finally manage to get this: When I tried to debug it, all I got was this, and native stack trace that I had no way of actually resolving. Trying to reproduce the problem in the debugger resulted in the same experience. I tried playing around with WinDbg for a while,...

posted @ Friday, November 13, 2009 12:00 PM | Feedback (3)

Select N+1 is also applicable for user interface

I just opened Messenger for the first time in maybe a year, here is what it end up looking like (and this is the truncated list): And it doesn’t seems to end…

posted @ Tuesday, November 10, 2009 12:00 PM | Feedback (10)

An epic bug story

This is a fictitious  example of such a bug, but this would probably sound familiar. Jane was soundly sleeping around 3AM when the phone started ringing off the hook. Dazed and not quite in full possession of her faculties, she picked up the phone and heard Tom from Operations screaming that the Northwind System was gone. It wasn’t just one application that died, it was all of them, and Operations had no idea what is going on, any CxO in the company was pissed and they were bleeding money and reputation by the second. While driving to work, Jane took part in...

posted @ Wednesday, October 28, 2009 12:00 PM | Feedback (20)

How to mis-configure your production to dead crawl

One of the things that I avidly subscribe to is that when you are building server applications, visibility into what the application is doing is key. If you don’t have visibility into the application, you are left in the dark, stumbling and alone. NH Prof is a good example of how you make things much more visible to developers, but I am doing this in many other places, Rhino Service Bus is another example of how important it is to have visibility into what your servers are doing. Being able to see what is actually going on in your apps is...

posted @ Saturday, October 24, 2009 12:00 PM | Feedback (9)

MSMQ: Insufficient resources to perform operation.

I run into an annoyingly persistent error on a production server: System.Messaging.MessageQueueException: Insufficient resources to perform operation. at System.Messaging.MessageQueue.SendInternal(Object obj, MessageQueueTransaction internalTransaction, MessageQueueTransactionType transactionType) at System.Messaging.MessageQueue.Send(Object obj) at ConsoleApplication1.Program.Main(String[] args) This was generated from the following code: class Program{ static void Main(string[] args) { try { var queue = new MessageQueue(@".\private$\MyQueue"); queue.Send("test msg"); ...

posted @ Friday, October 23, 2009 12:00 PM | Feedback (4)

Emergency fixes & the state of your code base

One of the most horrible things that can happen to a code base is a production bug that needs to be fixed right now. At that stage, developers usually throw aside all attempts of creating well written code and just try to fix the problem using brute force. Add to that the fact that very often we don’t have the exact cause of the production bug, and you get an interesting experiment in the scientific method. The devs form a hypothesis, try to build a fix, and “test” that on production. Repeat until something make the problem go away,...

posted @ Thursday, October 22, 2009 2:48 PM | Feedback (12)

What am I missing? MSMQ Perf Issue

I am getting some strange perf numbers from MSMQ, and I can’t quite figure out what is going on here. The scenario is simple, I have a process reading from queue 1 and writing to queue 2. But performance isn’t anywhere near where I think it should be. In my test scenario, I have queue 1 filled with 10,000 messages, each about 1.5 Kb in size. My test code does a no op move between the queues. Both queues are transactional. Here is the code: private static void...

posted @ Sunday, October 18, 2009 11:24 AM | Feedback (37)

Sometimes it looks like select IS broken: A WPF memory leak

One of the most annoying bug reports that we got for NH Prof is that it crash with out of memory exception after long use. We did the usual checkups, and the reason for the memory leak was obvious, something kept a lot of objects internal to WPF in memory. In fact, here are the heavy hitters, as extracted from the dump: Count Size (kliobytes) Type ...

posted @ Thursday, October 01, 2009 1:25 AM | Feedback (34)

I knew there were reasons for those multi threading warning lists

One of the warning signs for bad multi threaded code is calling code that you don’t own while holding a lock. I just discovered a bug in NH Prof that is related to just that issue. But I wasn’t really stupid, and the story of this bug is a pretty interesting one. Let us look at what happened. I have a deadlock in the application, where two threads are waiting for one another. In the UI thread, I have: And on a background thread, I have: This is actually code...

posted @ Saturday, September 19, 2009 3:10 AM | Feedback (4)

Two strikes, and you are out

I don’t have a lot of patience for repeated bugs. I just got a bug report that turn out to be in the result of the same feature as a previous bug I fixed. I could have fixed the bug. But I didn’t bother. A repeated bug in the same area for the same reason usually indicate a fragile design. In this particular case, the feature wasn’t important, so I just ripped it all out, root & branch. If it was important, I would have still ripped the whole thing apart, and then I would rebuild it from...

posted @ Friday, September 18, 2009 6:55 PM | Feedback (6)

Safe by default is also annoying by default

This was the cause of a NH Prof not being able to report some errors home. I follow the logic, I agree with the logic, but I still goes ARGH!!!

posted @ Thursday, September 17, 2009 2:53 AM | Feedback (13)

Hello!!! Is this ON?! [Connect Bugs sucks, again]

I want to point you to this bug: Do you see the Won’t Fix there? Let us take a look at what ExecutionEngineException is all about, okay? Now, the real problem here is that along with this issue there is a failing sample, so it is not a case of not being able to reproduce the error. Granted, the customer has managed to find a workaround for their problem, but the bug in the framework is still there, and was not fixed. I would assume that CLR crashing...

posted @ Saturday, September 12, 2009 7:50 PM | Feedback (15)

Challenge: Why isn’t select broken?

Here is a crash report that I got. System.ArgumentException: Destination array was not long enough. Check destIndex and length, and the array's lower bounds.   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)   at System.Collections.Generic.List`1.CopyTo(T[] array, Int32 arrayIndex)   at System.Collections.ObjectModel.Collection`1.CopyTo(T[] array, Int32 index)   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) Now, it is tempting to blame Microsoft for this, but it...

posted @ Tuesday, September 01, 2009 4:47 PM | Feedback (16)

That is not the way to inspire confidence

I am trying to install SQL Server 2008 SP1 on my Win 7 machine, it doesn’t like it:

posted @ Tuesday, September 01, 2009 12:48 PM | Feedback (13)

Let them submit a bug report for that

This is a story from a recent planning meeting that we had. One of the developers was explaining how he is implementing a certain feature, and he went over a potential problem that we would have. That problem is a potential one, because it would only show up if we extend the project in a certain direction, which isn’t currently planned. My response for that was: “Let the users submit a bug report for that if it happens”. It is a cruder form of YAGNI.

posted @ Thursday, August 20, 2009 12:10 PM | Feedback (15)

Git horror

I am trying to do something that I think is very simple, clone an SVN repository to a local Git repository. Unfortunately, just about anything that I do end up in one error or another. E:\rt\rt>git --version git version 1.6.4.msysgit.0 E:\rt\rt>cd.. E:\rt>git svn clone https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools rt.git Initialized empty Git repository in e:/rt/rt.git/.git/ RA layer request failed: PROPFIND request failed on '/svnroot/rhino-tools': PROP FIND of '/svnroot/rhino-tools': could not...

posted @ Thursday, August 20, 2009 9:53 AM | Feedback (15)

Error handling from the middle ages

Well, it is no wonder that my attempts to debug the system where futile. I am using a 3rd party library to handle SQL parsing, and it fails on big SQL statements (admittedly, big here is defined in megabytes, but still). The part that utterly kills me is that I decided to track down the problem. Here is what I found: So if it is failing to parse the text it is going to kill the entire application!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Oh yeah, you can bet that I am angry now!

posted @ Monday, August 10, 2009 2:58 AM | Feedback (17)

Undebuggable – who is killing my app?

Here is an interesting problem that I have no solution for so far. class Program { static void Main(string[] args) { var foo = new Important(); try { AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) => { Console.WriteLine(eventArgs.ExceptionObject); }; using (var backend = new BackendBridge()) { backend.Start(23321); string filePath = @"E:\Samples\blob.nhprof"; using (var stream = File.OpenRead(filePath)) { backend.LoadFromFile(stream, new CancellationToken()); } } Console.WriteLine(foo); } catch (Exception e) { Console.WriteLine(e); } finally { Console.WriteLine("Done!"); } } private class Important : CriticalFinalizerObject { ~Important() { Console.WriteLine("finalized"); } } } The problem is quite simple, reading the file will kill the application. The problem? I don’t know why. The only output from the program is “finalized”, which suggest that there is something really nasty going on there. I am open for suggestions, because I have no idea how to deal with this...

posted @ Monday, August 10, 2009 2:23 AM | Feedback (7)

Oh what a tangled web we weave, a bug story

I recent got a report about NH Prof performance issue. I am used to combating them by now, but this one was on a class all on its own. While trying to capture profile from integration tests one has to select only a few tests to run. NHProf seem to choke on more than 10 sessions with ~15 traceable queries each on an adequate laptop... Now, I know this can’t be right, I tested NH Prof performance on NHibernate’s integration testing. Over 3,000 sessions with tens of thousands of queries. So I asked for...

posted @ Sunday, August 09, 2009 4:33 PM | Feedback (5)

System rollout nightmares

The Finance Department in Tel Aviv Municipality has decided to go on a (probably illegal) strike (Hebrew link). Since I don’t live in Tel Aviv nor am I a local blogger, there is actually a reason for me pointing it out. The reason for them being on a strike, especially since it is looks like it is not a legal one? The rollout of a new system is currently going on, and it is painful enough for them to refuse to do any work. I wonder how bad it is for them to get to that point…

posted @ Tuesday, July 21, 2009 8:17 PM | Feedback (9)

If stupidity was money, I would be rich

Here is a crash report that I got from NH Prof error reporting: System.NullReferenceException: Object reference not set to an instance of an object. at HibernatingRhinos.NHibernate.Profiler.Client.Model.Sessions.RecentStatements.set_SelectedStatement(IStatementModel value) at HibernatingRhinos.NHibernate.Profiler.Client.Model.Sessions.RecentStatements.Clear() at HibernatingRhinos.NHibernate.Profiler.Client.Model.SessionPresenter.Clear() at HibernatingRhinos.NHibernate.Profiler.Client.Model.ApplicationModel.Clear() at HibernatingRhinos.NHibernate.Profiler.Client.Commands.Clear.Execute(Object parameter) This seems to be pretty standard, isn’t it? Let us look at SelectedStatement: There isn’t a possibility of a null reference exception, even the RaisePropertyChanged is safe from NRE. So, what was going on? I started dismissing this as a ghost story, but I got several issues of those. Then...

posted @ Sunday, June 07, 2009 2:11 PM | Feedback (8)

WCF works in mysterious ways

Here is the result of about two hours of trying to figure out what WCF is doing: class Program { static private readonly Binding binding = new NetTcpBinding { OpenTimeout = TimeSpan.FromMilliseconds(500), CloseTimeout = TimeSpan.FromMilliseconds(250), ReaderQuotas = ...

posted @ Thursday, June 04, 2009 8:18 PM | Feedback (34)

A case of massive stupidity

This is a story about a bug that frustrated, annoyed, and nearly drove me mad. It also cost me ridiculous amount of time. The problem? The communication from the profiled application to the profiler with NH Prof is done using a Protocol Buffers network stream. The problem? It kept failing. Now, networks are unreliable, but they are not that unreliable, especially since all my tests are focused on local machines scenario. I tried quite hard to create a very reliable system, but I was growing extremely frustrated, it failed, sometimes, in a very unpredictable manner, and in ways that...

posted @ Saturday, May 23, 2009 6:32 PM | Feedback (9)

Challenge: multi threaded test failure

On one of my machines, I can consistently get the following test failure, because of an exception throw here: As you can see, we get an ObjectDisposedException here, which cause the test to fail. There is only one problem with that: We only dispose the queue manager on the dispose method, and that can only be called if the test itself was completed. On the face of it, it looks like I am doing things correctly, but there is a bug here. The CLR’s threading semantics are not broken, even though...

posted @ Thursday, May 14, 2009 1:55 PM | Feedback (21)

Relying on hash code implementation is BAD – part II

To be truthful, I never thought that I would have a following for this post 4 years later, but I run into that today. The following is a part of an integration test for NH Prof: Assert.AreEqual(47, alerts[new StatementAlert(new NHProfDispatcher()) { Title = "SELECT N+1" }]); I am reviewing all our tests now, and I nearly choked on that one. I mean, who was stupid enough to write code like this?  I mean, yes, I can understand what it is doing, sort of, but only because I have a dawning sense of horror when looking at it. I immediately decided...

posted @ Monday, April 27, 2009 5:43 PM | Feedback (7)

Find the bug

Can you find the bug in here? public void Receiver(object ignored) { while (keepRunning) { using (var tx = new TransactionScope()) { Message msg; try { msg = receiver.Receive("uno", null, new TimeSpan(0, 0, 10)); } catch (TimeoutException) { continue; } catch(ObjectDisposedException) { continue; } lock (msgs) { msgs.Add(Encoding.ASCII.GetString(msg.Data)); Console.WriteLine(msgs.Count); } tx.Complete(); } } } And: [Fact] public void ShouldOnlyGetTwoItems() { ThreadPool.QueueUserWorkItem(Receiver); Sender(4); Sender(5); while(true) { lock (msgs) { if (msgs.Count>1) break; } Thread.Sleep(100); } Thread.Sleep(2000);//let it try to do something in addition to that receiver.Dispose(); keepRunning = false; Assert.Equal(2, msgs.Count); Assert.Equal("Message 4", msgs[0]); Assert.Equal("Message 5", msgs[1]); } I will hint that you cannot make any part of the receiver after it was disposed.

posted @ Friday, April 24, 2009 11:39 AM | Feedback (18)

Esent, identity and the case of the duplicate key

Following up on a bug report that I got from a user of Rhino Queues, I figured out something very annoying about the way Esent handles auto increment columns. Let us take the following bit of code: using (var instance = new Instance("test.esent")) { instance.Init(); using (var session = new Session(instance)) { JET_DBID dbid; Api.JetCreateDatabase(session, "test.esent", "", out dbid, CreateDatabaseGrbit.OverwriteExisting); JET_TABLEID tableid; Api.JetCreateTable(session, dbid, "outgoing", 16, 100, out tableid); JET_COLUMNID columnid; Api.JetAddColumn(session, tableid, "msg_id", new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.ColumnNotNULL | ColumndefGrbit.ColumnAutoincrement | ColumndefGrbit.ColumnFixed }, null, 0, out columnid); Api.JetCloseDatabase(session, dbid, CloseDatabaseGrbit.None); } } for (int i = 0; i < 3; i++) { using (var instance = new Instance("test.esent")) { instance.Init(); using (var session = new...

posted @ Friday, April 24, 2009 12:18 AM | Feedback (6)

Microsoft Connect - FAIL (yet again)

I really think that Microsoft should close Connect. Because it is pretty obvious that they aren't managing that properly. Let us take a look at yet another interesting bug report. This is related to a bug in System.Data that makes using System.Transactions even trickier than you would initially believe. It was acknowledged as a bug by Miguel Gasca (from Microsoft), and a connect was reported. That was in 2007(!), it was resolved, a month later, by "Microsoft", because it is "External" issue. That bug is till here today, two years later, and still impacting customers. That is after a full release and SP1. The...

posted @ Tuesday, March 24, 2009 12:18 PM | Feedback (11)

Resolving graphics problems with NH Prof

Christopher has good coverage on how we solved and isolated a problem that we  run into using NH Prof. In essence, the issue was messed up text being reported by some of the users. To be frank, it was a very frustrating issue, because none of us could come up with a repro, and the only thing that sometimes seemed to help is updating the graphic drivers. Having to update your graphic drivers to use NH Prof isn’t something that I consider appropriate. It reminded me of the time that to deploy a system that I built, we had...

posted @ Tuesday, February 17, 2009 7:42 AM | Feedback (6)

Find the bug

Can you tell me what is the bug in this piece of code? Note, this is not a configuration or deployment error. This is a bug.

posted @ Tuesday, February 10, 2009 8:53 PM | Feedback (24)

And now what?

It looks like the entire MSMQ .NET stack is riddled with threading bugs. At least if you think about using the async methods such as BeginPeek. Nasty!

posted @ Tuesday, January 27, 2009 7:31 PM | Feedback (13)

How to fix a bug

Yesterday I added a bug to Rhino Service Bus. It was a nasty one, and a slippery one. It relates to threading nastiness with MSMQ, and the details aren’t really interesting. What is interesting is how I fixed it. You can see the commit log here:   At some point, it became quite clear that trying to fix the bug isn’t going to work. I reset the repository back to before I introduced that bug (gotta love source control!) and started reintroducing my change in a very controlled manner. I am back with...

posted @ Sunday, January 25, 2009 9:03 AM | Feedback (3)

MessageQueue trouble continues

I mentioned that I got into some problems with MSMQ that I couldn’t reproduce later on. Well, here is the actual code that I am running that is causing a hung. As you can see, this is really strange.

posted @ Sunday, January 25, 2009 1:19 AM | Feedback (6)

More disposal subtleties and framework bugs that stalks me

This one was a real pain to figure out. Can you imagine what would be the result of this code? 1: var queue = new MessageQueue(queuePath); 2: queue.Dispose(); 3: var peekAsyncResult = queue.BeginPeek(); 4: peekAsyncResult.AsyncWaitHandle.WaitOne(); If you guessed that we would get ObjectDisposedException, you are sadly mistaken. If you guessed that this...

posted @ Saturday, January 24, 2009 1:28 AM | Feedback (14)

More information of GC issue

After a lot more study, it looks like there are two separate issues that are causing the problem here. During AppDomain unload, it is permissible for the GC to collect reachable objects. I am fine with that and I certainly agree that this makes sense. Application_End occurs concurrently with the AppDomain unload. Looking at the docs (and there are surprisingly few about this), it seems like 1 is expected, but 2 is a bug. The docs state: Application_End  - Called once per lifetime of the application...

posted @ Thursday, January 22, 2009 5:27 PM | Feedback (14)

I am being stalked by CLR bugs

I just spent several hours tracking down a crashing but in my current project. The  issue was, quite clearly, a problem with releasing unmanaged resources. So I tightened my control over resources and made absolutely sure that I am releasing everything properly. I simply could not believe what was going on. I knew what they code is doing, and I knew that what I was getting was flat out impossible. Yes, I know that we keep saying that, but this bug really is not possible! The situation is quite clear,...

posted @ Wednesday, January 21, 2009 7:31 PM | Feedback (8)

Avoid object initializers & the using statement

This piece of code has a huge bug in it. Can you see it? I’ll give you a hint, what is going to happen if Key, IV or Mode are going to throw an exception? Well, let us check the actual generated code from Reflector. As you can see, we first set the value to a local variable, we set the properties and only then we enter the using clause. If any of the properties will throw out an exception, we will never enter the using block, and the object will never...

posted @ Thursday, January 15, 2009 6:07 AM | Feedback (27)

Msmq and troublesome API experience

There is just one thing in the Msmq API that I hate. If you try to send to a queue using the wrong transaction, it will silently not send you message, but give absolutely no error. This is incredibly error prone, and has caused me quite a number of bugs. If at all possible, API should never silently fail. In this case, the API should throw an explicit argument exception, saying that this transaction is not valid for this queue. That would make things much simpler all around.

posted @ Saturday, January 03, 2009 11:51 AM | Feedback (5)

Required: Debugging / Crash recovery assistance in NJ / NY

A client of mine has run into a production problem, and we need to dig into the application to understand what is going on. Unfortunately, I am not on site, so the level of help that I can contribute currently is not that great. We are looking for someone that can come onboard and help us figure out what the exact problem is. I don't have all the details about the production issue yet, but the symptom is very high connection count to the database, and the OS refusing connections with TIME_WAIT. We are pretty sure that there is a...

posted @ Tuesday, December 30, 2008 4:48 PM | Feedback (4)

Do not put presentation concerns in the controllers!

I thought it would be obvious, but I am currently cleaning up an application that has mixed them in a very annoying way. I decided to track the reason for this coupling and I found this on the sample controller in ASP.Net MVC: I am pretty sure that setting the page title is a presentation concern, as such, I don't want to see this in the controller, and I certainly don't want to see it in the base sample from which everyone is going to start.

posted @ Monday, December 29, 2008 7:20 PM | Feedback (67)

The bug that I am glad that I have not filed

One of the tickets for NH Prof is styled menu items. I was testing that, and I noticed something very strange and worrying. I'll show it to you: Clearly, I thought, this is some left over from some tests being done that wasn't cleared. Then I had a "slap my forehead" moment. I can't really do it well on the blog, but imagine me zooming out to show a bigger picture.   Um, yeah, there is a bug, but it is between the chair and the keyboard.

posted @ Monday, December 22, 2008 1:07 AM | Feedback (5)

KB957541 available for direct download

This is the fix for the ExecutionEngineException that appeared in .Net 3.5 SP1, and was found by Rhino Mocks. You can get it here: http://support.microsoft.com/?id=957541

posted @ Wednesday, December 17, 2008 3:54 AM | Feedback (2)

Consenting Adults

David Kean has an interesting post here: "I can't believe Microsoft didn't make [Enter API Name Here] public" In particular, he mentions this aging argument: Developing good APIs is extremely difficult, especially the first time around. When we get things wrong (and we do get things wrong), trying to maintain backwards compatibility often stifles innovation as we try to correct these scenarios. Unfortunately, unlike others, we don't have the luxury to make only 95% of our new versions backwards compatible with our previous versions. I have a lot of problems with this statement. Chief among them is the treating the users...

posted @ Wednesday, December 10, 2008 12:32 AM | Feedback (22)

Windows Activation SUCKS: How to give someone a heart attack

On a day that I have to give 3 presentations, I open up windows and I refuse to log me in, instead, I get this thing: And then it refuse to activate! Turning the window installation to a brick! I solved that eventually, but that was a really scary time.

posted @ Thursday, December 04, 2008 2:12 PM | Feedback (18)

Correct event handling

This code has a very subtle bug: What is the problem with this code? It is an obvious try at bridging an annoying design issue in C#, the fact that invoking an event with no subscribers throws a null reference exception. It should have been a no op, but that is another issue. The copying to a separate variable is also common, because this allow you to avoid subtle mutli threading bug. The problem is this code it that it contains a bug. The nullability check should have been made on the handler local variable, like this: As the code stands, it has a...

posted @ Sunday, November 16, 2008 12:03 AM | Feedback (20)

And yet ANOTHER ASP.Net MVC Bug

This is getting annoying, to tell you the truth. I am trying to develop an application here, not do QA. Let us take the following class: public class IdAndName { public long Id { get; set; } public string Name { get; set; } } And the following code: var idAndNames = new[] { new IdAndName {Id = 1, Name = "one"}, new IdAndName {Id = 2, Name = "two"} }; var list2 = new SelectList(idAndNames, "Id", "Name", idAndNames[1]); var result2 = Html.DropDownList("test",list2); What would you expect the value of result2 to be? I would expect it...

posted @ Tuesday, November 11, 2008 10:31 PM | Feedback (36)

Another ASP.Net MVC bug: Rendering views to different output source

Take a look at the following code. What would you expect the result of this code to be? Leaving aside the question of exactly what I am doing here, or why. What I thought this should do was to render the partial view into the string writer. The method signature of Render most strongly suggest that this is what it would do. What it actually does is to render the partial view directly into the response. Following the code a bit more, it looks like you literally cannot do this. ASP.Net MVC views are hard coded to use...

posted @ Tuesday, November 11, 2008 10:29 PM | Feedback (13)

A first time error

Never seen an error like that before:

posted @ Friday, November 07, 2008 10:23 PM | Feedback (8)

Reproducing a bug

Create new ASP.Net MVC application: Create an action that take non nullable argument called 'id': [HandleError] public class HomeController : Controller { public ActionResult Index() { ViewData["Title"] = "Home Page"; ViewData["Message"] = "Welcome to ASP.NET MVC!"; return View(); } public ActionResult Test(int id) { return Content(id.ToString()); } public ActionResult About() ...

posted @ Friday, November 07, 2008 6:29 PM | Feedback (13)

Title left blank since I can't think of non inflammatory title for this post

This works: This doesn't: I haven't bothered to find why, but that is surprising to me. (Note that here the enctype is specified as "multipart/form-data", which may or may not be related) Update: It is not related. The real culprit, as best I was able to reconstruct is because of this piece of code: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", "{controller}/{action}/{id}", new {controller = "Home",...

posted @ Friday, November 07, 2008 5:35 PM | Feedback (12)

A case study of bad API design: ASP.Net MVC Routing

I am doing a spike in ASP.Net MVC now (and I'll talk about this at length at another time). I hit the wall when I wanted to do something that is trivially simple in MonoRail, limit a routing parameter to be a valid integer. Luckily, just looking at the API signature told me that this is a supported scenario: Unfortunately, that is all that it told me. This method accept an object. And there is no hint of documentation to explain what I am suppose to do with it. A bit of thinking suggested that I am probably...

posted @ Wednesday, November 05, 2008 9:16 PM | Feedback (23)

A bug story

I run into a bug today with the way NHibernate dealt with order clauses. In particular, it can only happen if you are: Use parameters in the order clause Using SQL Server 2005 Using a limit clause If you met all three conditions, you would run into a whole host of problems (in particular, NH-1527 and NH-1528). They are all fixed now, and I am writing this post as the build run. The underlying issue is that SQL Server 2005 syntax for paging is broken, badly. Let us take the this statement: SELECT THIS_.ID ...

posted @ Wednesday, October 15, 2008 11:45 PM | Feedback (13)

KB957541 is my favorite hotfix

It is not public yet (but you can call and ask for it), but it will be when SP1 goes to Windows Update. This is the fix for the ExecutionEngineException that appeared in .Net 3.5 SP1, and was found by Rhino Mocks. It took a while (but not unreasonably so), and it is here, yeah! This is fixed,  you can get the fix here: http://support.microsoft.com/?id=957541

posted @ Thursday, September 25, 2008 5:58 PM | Feedback (7)

Waiting for the Service Pack? I don't think so

Here are a few interesting things that I found about .Net 3.5 Service Pack 1: Serialization hangs or throws an OutOfMemoryException with static delegate and ISerializable on 3.5 SP1 ExecutionEngineException with ParameterInfo.GetOptionalCustomModifiers and GetRequiredCustomModifiers on 3.5 SP1 .NET 3.5 SP1 breaks use of WPF under IIS .NET 3.5 SP1 seems to break .NET 2.0 applications with assembly loading error. .NET Framework 3.5 SP1 breaks type verification I just googled for "3.5 SP1" on connect.microsoft.com, and took only the verified (by Microsoft) items...

posted @ Friday, August 15, 2008 2:23 PM | Feedback (20)

How .Net 3.5 SP1 broke Rhino Mocks

Okay, now that we are over the sensationalist headline, the actual problem is more complex than that. Let us assume that we have the following interface: public interface IComplexGeneric<T>{ void GenericMethod<K>();} Up until .Net 3.5 SP1, Rhino Mocks was perfectly happy to deal with such an interface (well, not happy, exactly, that requires some hard core code). With .Net 3.5 SP1, this generate an Execution Engine Exception. Fabian Schmied was kind enough to prove that select is broken here. This is the connect site issue, and I would appreciate it if you can vote for it. The work around for this would mean that...

posted @ Wednesday, August 13, 2008 5:15 PM | Feedback (22)

What is wrong with SortedList<T>

Today it has arouse my ire. Take a look at the IndexOfKey, IndexOfValue and RemoteAt methods. You would expect a list to have a way to get to item by index, certainly based on methods such as RemoveAt and IndexOfXyz. It doesn't have such a way. You have to violate the Law of Demeter in order to get it to work, list.Values[i], yuck!

posted @ Saturday, August 09, 2008 1:00 AM | Feedback (8)

Some finalizer pitfalls

The use of finalizer to ensure eventual release of resources is recommended, but one thing that is not discussed often is the implications of adding a finalizer. No, I am not talking about the extra wait time before the class memory is released, this is fairly well known. I am talking about two major additional issues that don't get enough attention, in my opinion. Specifically, invalid instances and threading. An object that has a finalizer will may be executed in more than one thread. Luckily, the CLR ensure that our finalizer will not be able to...

posted @ Monday, July 28, 2008 4:26 PM | Feedback (15)

The exception I hate the most

And just for fun, it is reproducable if you run 824 tests, but not if you run a single test! Update: Found the guilty test, and it is one that used to work, damn it!

posted @ Sunday, July 27, 2008 4:38 PM | Feedback (4)

[Unstable code] How a blocking remote call can take down an application

I mentioned that this line has the potential to destabilize an application, because it is a remote blocking call. var cart = customerSrv.GetShoppingCart(customerId); Neil Mosafi left the following comment: I've never experienced other threads being blocked whilst making a sync service call.  Even an Async call is essentially a sync call but done in another thread or using an iocompletion port.  Or are you saying we should be making duplex service calls to avoid possible problems? Let us start by saying that I am talking about pathological scenarios,...

posted @ Monday, July 21, 2008 10:11 PM | Feedback (4)

How to really annoy me...

This is what happens when I try to subscribe to the ALT.Net podcast using iTunes. Surprisingly, using feed burner's iTunes link Just Works!

posted @ Monday, July 21, 2008 3:35 PM | Feedback (4)

Stupid validation

Hm, it looks to me like I did put the value there. Time to disable JavaScript...

posted @ Monday, July 21, 2008 2:57 PM | Feedback (2)

Unstable code

This is part of a presentation that I am currently preparing, can you tell me what is wrong with this code? There is no catch, no configuration mistakes, no implementation semantics that are not shown here.

posted @ Monday, July 21, 2008 1:16 PM | Feedback (52)

Why I don't like FireBird: Part II

Take a look at this code. It is supposed to give me the earliest message, ensuring that I'll get each message once and only once. It doesn't work. I am getting some messages twice. The same code (well, simplified) just works on SQLite. public QueueMessage GetEarliestMessage() { byte[] data = null; bool done = false; while (done == false) { Transaction(cmd => { /* SELECT FIRST 1 Id, Data FROM IncomingMessages ORDER BY InsertedAt ASC */ cmd.CommandText = Queries.GetEarliestMessageFromIncomingQueue; string id; using (var reader = cmd.ExecuteReader()) { if (reader.Read() == false) { done = true; return; } id = reader.GetString(0); data = (byte[])reader[1]; } /* DELETE FROM IncomingMessages WHERE Id = @Id */ cmd.CommandText = Queries.DeleteMessageFromIncomingQueue; cmd.Parameters.Add("@Id", id); try { var rowAffected = cmd.ExecuteNonQuery(); //...

posted @ Monday, July 07, 2008 12:37 AM | Feedback (12)

Why I don't like Firebird: Part I

I mentioned before that my main objection to this DB is its utter lack of tooling. I mean, even SQLite has some tools. For Firebird, there seem to be nothing that works on my machine. I needed to debug something there, and this was the easiest solution.

posted @ Monday, July 07, 2008 12:32 AM | Feedback (11)

Things you should never do

That should be pretty high in the list, I think:

posted @ Sunday, July 06, 2008 3:05 AM | Feedback (14)

Challenge: Find the deadlock

Okay, there isn't much of a challenge here, but it is worth point out nevertheless:

posted @ Saturday, July 05, 2008 9:36 AM | Feedback (2)

Bug magnet

If you ever need to understand why I tend to be involved so many projects, it is for a simple reason. I am apparently a bug magnet. I mentioned that I managed to cause FireBird to corrupt itself, which is why I am not intending to use it. Now I have another contender to the list. Berkeley DB is a well known, widely used, and in general though to be very stable. I decided to use it, mainly because it is cool and I really need to learn something new. (It is running a lot of interesting things, and...

posted @ Friday, July 04, 2008 6:42 AM | Feedback (8)

Challenge: Find the bug

Here is another subtle bug: public class Log { string path; public Log(string path) { if(Directory.Exists(path)==false) Directory.CreateDirectory(path); this.path=path; } public TextWriter GetLogger(string name) { string fileName = Path.Combine(path, name); if(File.Exists(fileName)) return File.AppendText(fileName); return File.CreateText(fileName); } } Assume that the name that we pass to GetLogger() is always valid. Assume that there are no permission errors. Assume that no one is going to delete the log directory behind our back. Assume no file system level errors (like file system full, etc). Update: A few readers pointed out a few more problems with the code, so let us constrain it even further... Assume single threaded access. Assume proper...

posted @ Thursday, July 03, 2008 11:25 PM | Feedback (28)

Bug of the day...

Using MbUnit 2.4, this test pass: Guid g = Guid.Empty; Assert.AreEqual(Guid.Empty, g); Assert.AreNotEqual(Guid.Empty, g);

posted @ Tuesday, July 01, 2008 10:32 PM | Feedback (8)

You can checkout, but you can not commit

Well, here is how my last few days were spent. Trying to get SvnBridge to work on Mono 1.9.1. (Note that we are talking about working locally, when the hosted version will go live, it will obviously be accessible from everything and anything that can talk to an SVN server). After getting it to compile and run (not a trivial process, I must say, I used a surprisingly high number of MS CLR stuff, but we will leave that to another post), I had managed to get some basic functionality working, and I was able to successfully checkout the...

posted @ Tuesday, July 01, 2008 8:06 AM | Feedback (10)

Guess how I found that out...

Arrgh!

posted @ Tuesday, July 01, 2008 6:53 AM | Feedback (15)

I, too, broke the compiler

And here you thought I was writing code that was hard for mere humans to understand! I write code so complex even the compiler breaks down and cries!

posted @ Tuesday, July 01, 2008 4:47 AM | Feedback (5)

Bug of the day

This has caused some hair pulling, this piece of code fails if I don't pass a webcast variable, even though it is properly guarded. Once I convinced myself that yes, I was stupid enough not to cover this scenario, reproducing this in a test was very easy. The solution is so simple I am posting the changeset here:

posted @ Monday, June 16, 2008 12:36 AM | Feedback (6)

I hate IIS today

I am trying to execute the following piece of code: Microsoft.Web.Administration.WebConfigurationManager.GetSection("system.webServer/httpHandlers"); Of course, this fails with a completely bizarre exception. For some reason, I have the feeling it is not supposed to do that. Trying to explicitly pass the path where web.config lies also fails. When I finally made it use the correct path, it still gave the same error. Urgh!

posted @ Tuesday, June 10, 2008 7:29 PM | Feedback (9)

Let us make the UI complex, just because we feel like it

Let us take a look at this dialog, shall we? What I see is that we have two text fields and two checkboxes, in a fairly big dialog, to express the following bit of information: I honestly have no idea what the purpose of this is. To make it harder to input the information, presumably. Given a URL, I now need to split it apart manually, I need to know that https is usually on 443, etc. It also mean that when I am talking to a user, I need to...

posted @ Wednesday, June 04, 2008 2:40 AM | Feedback (17)

Bug Hunting Story

The bug: SvnBridge will not accept a change to a filename using multi byte format. Let us start figuring out what is going on, shall we? Hm... looks like when TortoiseSVN is PUT-ing the file, it uses the directory name instead of the actual file name. Obviously, this is a client bug, and I can close this bug and move on to doing other things. Except that I am pretty sure that SVN can handle non ASCII characters... Let us compare the network trace from SVN and SvnBridge and see what is going on... Oh, I...

posted @ Tuesday, June 03, 2008 2:38 AM | Feedback (2)

Reviewing the Entity Framework Source Control Support

Frankly, I am quite amazed that I even need to write this post. Source Control is such a basic part of the development process that I didn't want to believe there could be anything to say about it. In the previous release of Entity Framework, there were deal breaker issues in the source control story. In short, it didn't work. I installed Visual Studio 2008 SP1 Beta to check how the new bits behave. Let us start from the simplest scenario, defining a model with two classes, and commit to source control: Now, let...

posted @ Monday, May 19, 2008 8:34 PM | Feedback (8)

Visual Studio 2008 SP1 Beta: AVOID

After the pain of VS 2005 SP1 (which killed my machine, as a matter of fact), I decided to install the SP1 beta for VS2008 on a clean VM. That VM is a simple install of the OS + VS 2008, that is all. Here is the result of installing VS 2008 SP1 Beta. I have no idea what happened, at one point it was installing, now it is rolling back. I suppose I could try to figure out what is going on, by hunting in the logs and trying the cargo cult approaches. ...

posted @ Monday, May 19, 2008 10:00 AM | Feedback (14)

How do you track that?

I have an interesting problem with SvnBridge. After around 5000 full revision request (a set of requests that can occur), the application get hung making a web service call to TFS. This comes after making quite a few calls to TFS, and is generally fairly easily reproducible. The actual call being made is not an expensive one (nor is it the same call). TFS is responsive during that time, so it is not its fault. It looks very much like I am hitting the 2 concurrent HTTP requests, except that all requests are serialized, and there is no multi threaded work involved. I...

posted @ Monday, May 05, 2008 11:09 AM | Feedback (9)

Source control is not a feature you can postpone to vNext

I was taking part in a session in the MVP Summit today, and I came out of it absolutely shocked and bitterly disappointed with the product that was under discussion. I am not sure if I can talk about that or not, so we will skip the name and the purpose. I have several issues with the product itself and its vision, but that is beside the point that I am trying to make now. What really bothered me is utter ignorance of a critical requirement from Microsoft, who is supposed to know what they are doing with software development. That...

posted @ Thursday, April 17, 2008 11:57 AM | Feedback (48)

The illustrated guide to confused concurrency

This has me very confused. The answer, however, turned out to be that I am an idiot:

posted @ Thursday, April 10, 2008 2:15 AM | Feedback (4)

Brute force concurrency testing

Testing concurrency is hard, just ask anyone who had tried. And tracking down concurrent bugs is even harder. I just run into concurrency issue with SvnBridge, and I decided that I have better have a smoke test around to prove that there are no obvious concurrency issues with the code. Since I already have over a hundred integration tests, I thought that this would make a great concurrency test. We know that all the tests are passing. Now let us see if they are all passing together. This is quick & dirty, but it expose at least two...

posted @ Wednesday, April 09, 2008 5:07 PM | Feedback (4)

SQL CE Issues, Part 2

Hopefully I'll get the same quick "you are an idiot, this is how it is done" that I got the first time I posted about it. Here is my current issue. Attempting to open SQL CE from multiple threads has locked it out. This has been the state of the system for ~6 hours. I don't mind the locks, I do mind the fact that there seems to be no way to specify a timeout for that, so the app just sit there, waiting, waiting, waiting.

posted @ Tuesday, April 08, 2008 6:03 PM | Feedback (21)

Internals are Evil

A while ago I talked about Internal Stripping, not surprisingly, I run into another "WTF is this internal?" class just now. And I think it would be a good sample to see what can cause me to pull the pliers and start messing with things. The scenario was simple, I was talking with Rob Conery about a webcast he is doing, and we started talking about TDD and repositories in a Linq enabled world. What we ended up with was the requirement to turn an List<T> to IQueryable<T>, and there isn't easy way to do that. The framework...

posted @ Thursday, April 03, 2008 4:45 AM | Feedback (17)

Why I hate internals, yet again

So here I am searching for an implementation of a WeakHashtable, and imagine my surprise when I find out that the BCL already has one such implementation. Imagine my lack of surprise to find that System.ComponentModel.WeakHashtable is internal, thus rendering it near useless to me.So annoying, frustrating and irritating.        Update: Oh, and as if it is not enough, it appears that there are two implementation of WeakHashtable in the BCL. In two different assemblies (System and System.Windows.Forms). From browsing the code, it looks like they just copy/paste the code, instead, you know, recognizing that this is an actual...

posted @ Sunday, March 09, 2008 3:26 AM | Feedback (13)

TFS, SOAP and XMLish

Today I discovered some really interesting issue with TFS. I was sending it the following message, and no, you are not seeing double, it was doubled. That was the XML payload that I was sending to a web service. Now, the crazy thing about this, it worked. And that really scares me. You could argue that SVN's behavior is correct, but there is not way that this can be considered a valid XML document. <?xml version="1.0" encoding="utf-8"?> <soap:Envelope ...

posted @ Thursday, March 06, 2008 5:53 AM | Feedback (2)

TCP Errors: Tracking it down

I get to the office this morning, determined to figure out what the hell was going on with my TCP stack. And I can reproduce the error in about 1/3 of the cases. I know that this is my problem, so I decide to move to a known good version and try to figure out where the error happens. I am doing that, and eventually I get to the head of the repository, without being able to reproduce the error. After calling for a check of the tooth fairy and requesting immediate assistance from an experienced exorcist, I was unable to reproduce...

posted @ Thursday, March 06, 2008 4:41 AM | Feedback (5)

How I broke the TCP Stack

Today I spend a large part of the day tracking down various strange errors. Those errors would be of the following variety: The connection could not be made because the target machine actively refused it. A connect request was made on an already connected socket. The underlying connection was closed: A connection that was expected to be kept alive was closed by a server. Now, I am not doing anything strange with TCP/IP, I am just making plain old web service calls (and no, not using my...

posted @ Wednesday, March 05, 2008 9:45 AM | Feedback (26)

Is Google Groups suffering outages as well?

For the last day or so I am having problem accessing files, registering to lists, etc. Anyone knows something about it?

posted @ Sunday, February 17, 2008 3:36 AM | Feedback (0)

Hosting AddIns - The problem with untrusted code

Let us assume that we need to load some code, potentially un-trusted / hostile into our application. The runtime has a lot of functionality to offer us in this regard, we can segregate the strange code pretty well in a low privilege AppDomain, but we can't protect ourselves from the AddIn killing us. There are two simple ways an AddIn can kill the host application, without the host being able to do something about it. Both are very easy to do by mistake, unfortunately. The first is to simply throw an unhandled exception from a thread and the second is...

posted @ Wednesday, February 13, 2008 1:54 PM | Feedback (22)

SSIS vs. CSV

Another team have run into this bug, what this basically means is that SSIS is not capable of importing CSV files. The "spec" for CSV files is about three lines long, including the special cases ( of which there are two ) and it hasn't changed in a decade. It boggles the mind that not only isn't SSIS capable of doing this, but they are not going to fix it for SSIS 2008. Looks like you would need to wait to SSIS 201x for a version that can handle CSV files.

posted @ Tuesday, January 15, 2008 10:14 AM | Feedback (4)

ASP.Net Ajax, Error Handling and WTF

I am facing some really unpleasant choices at the moment. And I thought it would be so easy. I wanted to add global error handling to all the web services that we expose as [ScriptService]. For some reason, they didn't show up in the Application_Error event, and that caused the exception details to be sent to the client. It looks like for some strange reasons, web services exceptions don't go through the Application_Error, so I implemented a SoapExtension to handle that, but ScriptService doesn't go through the Soap layers, so it obviously doesn't work. Then I went and looked at the code. The whole thing...

posted @ Sunday, January 06, 2008 4:47 PM | Feedback (11)

Don't use MS CRM! It is not worth the ulcer you will get!

Yesterday I reached the breaking point with regards to MS CRM. We needed to push a build to staging, so the customer can start acceptance testing. The way we built it, we have a central CRM development server, and each developer is working mostly locally, but against the same server. I don't like it, but the CRM doesn't really give me much choice. At any rate, we started the move by trying to move the customizations from the development server to the production server. Naturally, there is no way to diff things, so I have no idea what changed since we...

posted @ Friday, November 16, 2007 7:06 PM | Feedback (14)

Reproducible Errors

For some reason, I am talking a lot about errors recently, didja notice? Today I had our QA inform me that if we fill some form completely (without leaving any optional stuff out), it will not execute the correct post processing. (I am cutting the conversation here, mind you). That particular form is critical in the application. It also have about 100 fields, 95 of them are optional. We could consistently reproduce the error on the QA machine, but I couldn't figure out how something like that could happen. What it worse, I couldn't isolate the problem. When we entered the...

posted @ Wednesday, November 07, 2007 1:37 AM | Feedback (10)

The dark side of errors

I just run into this one, and it completes very nicely my previous post about good errors. Can you figure out what the problem is? I know what the Western Regional Power Committee is doing in my application, but that exception is the epithom of bad error messages, the only thing that tops it is code that calls System.Environment.FailFast("bye!"), which cause an ExecutionEngineException. The root cause of this error message? A missing referrer header. But you really don't want to know how I got to that explanation.

posted @ Tuesday, November 06, 2007 3:54 PM | Feedback (5)

Rhino Mocks killed Visual Basic

Yes, this is invalid code, but still... And then... 

posted @ Friday, October 26, 2007 10:36 PM | Feedback (8)

Microsoft Connect: Redefining bugs as features as a standard operation procedure

This and this bugs are really pissing me off. Both those bugs are related to the same source, and one of them was originally a Rhino Mocks issue. They both  stems from the CLR runtime bugs.  Basically, trying to inherit from a generic interface with generic method parameters that has constraints causes the runtime to puke with a TypeLoadException. I am not one to cry that select() is broken, but in this case, it most certainly is. It is verified using both the C# compiler and Reflection.Emit, so it is definitely a runtime bug. The really annoying parts that they were...

posted @ Tuesday, September 18, 2007 8:48 PM | Feedback (10)

Microsoft Connect: Without Words

I am going to print a response I just got from Microsoft Connect here, and let you do the judgement yourself: Very sorry for not getting back to you on your last comment till now.  Unfortauntely the Connect system just tracks fixes for our next product releases.  To get fixes for shipped products you'll need to contact Microsoft Support at http://support.microsoft.com/oas/default.aspx?ln=en-us&prid=9511&gprid=344272. This probably explains this better.

posted @ Friday, September 14, 2007 3:52 PM | Feedback (3)

From my mail box, Rhino Mocks bugs

I need about 3 hours to sit on those, and I can't seem to find the time. I take comfort that at least they are interesting bugs (my keyword for "I don't have a clue what to do here").

posted @ Monday, August 27, 2007 11:19 PM | Feedback (0)

Microsoft CRM: Error reporting from the stone age

I have said, more than once, that the #1 reason that I like .NET is that I get good error handling. Here is the current error that I have to deal with from the CRM. I had to dig into the three separate log files, the event log, restart services and howl at the moon to figure out what is wrong.       BLAH!

posted @ Monday, August 27, 2007 5:26 PM | Feedback (2)

Update Panel hates me

Okay, here is an error that I manage to get occasionally, no real pattern that I can notice.I don't have any filters, Response.Write(), HttpModules or trace enabled. (At least, none that writes to the outgoing string). The issue is that sometimes, the return result of an Update Panel postback would return the whole page, instead of just the parts inside an update panel. It is as if it decides to simply ignore the update panel, and just go its merry way onward. Anyone has run into this before?

posted @ Wednesday, August 08, 2007 8:26 PM | Feedback (9)

Something is terribly wrong here...

And the problem is with me. I kept going over this code, not seeing what was wrong with it, up until I actually read the code. Argh!

posted @ Monday, August 06, 2007 9:14 AM | Feedback (4)

Bug magnet

I only wanted to learn the train schedule, I went to the Israeli Railways site and got this:   Now it looks like the site is down. Damn!

posted @ Saturday, August 04, 2007 9:01 PM | Feedback (4)

You would think that I would learn: Anonymous delegate variable capturing gotcha

Can you think of anything wrong with this code: foreach (DataSource value in EtlConfigurationContext.Current.Sources.Values) { ExecutionPackage.Current.RegisterForExecution( delegate { value.Start(this); } ); } I stared that this thing for a while before it hit me. Anonymous delegates lexical capture rules inside a loop means that it will take the loop variable, which has the gotcha of keeping the last value of the variable. This keep tripping me, and I really wish the spec would have made an exception for a loop, because this really is a gotcha and not something that I really need to be concerned with. In keeping with "code should be self documenting" the...

posted @ Saturday, August 04, 2007 8:43 PM | Feedback (5)

How to kill the community feedback, or, the uselessness of Microsoft Connect

I just got this in an email: Did you go to Microsoft Connect and supply feedback about the things you don't like about the product? That may be received better than a rant. I feel like I should explain better what I think about this. Broadly, I see it as a dead end path, since there is no real way for me as the reporter, to do anything about it except to report it. The main issue here is that a lot of those bugs are being closed for what looks like ridiculous reasons. Eventually, it lead to the belief that...

posted @ Sunday, July 29, 2007 11:13 PM | Feedback (10)

Total Frustration: Ambiguous Match Exception with WebForms

A colleague has called me over to see why a page was failing with Ambiguous Match Exception yellow screen of death. There was a simple change made to the page, that broke it, I tried the usual trouble shooting methods* (restarting VS & ISS, cursing, etc) but that failed to fix it. I moved to code to my machine and verified that it was completely reproducible across machines. Then we started to pick apart the changes, literally line by line. The problem turned out to be this line: IList<string> products = new List<string>(); Only then we remembered that the page also had...

posted @ Monday, July 09, 2007 11:45 PM | Feedback (9)

Bug hunting, looking around the box

I just spent way too long trying to figure out what is wrong with this code: <script type="text4/javascript">         function customerUpdated()         { ...

posted @ Tuesday, June 12, 2007 5:31 PM | Feedback (7)

I left my psychic hat at home today

Person: There is an error!Me: That is nice.Person: But there is an error!Me: And I already congratulated you on your observational prowess.Person: But there is an error!!!Me (getting tired of having the same conversation the 4th time today): I left my psychic hat at home today, if you won't tell me what the error is, I won't help you.Person: But there is an error!!! There are very few cases where I can actually help someone without seeing at least the error. I am pretty good at doing mental model, but I draw the line at mental debugging over a phone...

posted @ Wednesday, June 06, 2007 11:17 PM | Feedback (0)

Obscuring HTTP

Jeff Perrin do a really great job is sumrising what the biggest issue with WebForm is:Now the first problem with Webforms is not that it’s an abstraction, or even that it’s a leaky one (they all are). The problem is that what Webforms attempts to abstract away is actually simpler than the abstraction!

posted @ Tuesday, June 05, 2007 2:20 PM | Feedback (15)

Debugging NHibernate

Today we had a problem with an NHibernate query that was failing which had quite stumped. Pulling the usual tricks didn't work, debugging NHibernate was problematic, since the failing query was damn complex, and I had no clear idea why this was failing. After a while, I decided that trying the top down approach will not work, and that I need more structure in finding out the issue. Did I mentioned that the query was complex? The object model is big as well, and the query managed to touch just about all of...

posted @ Monday, June 04, 2007 4:48 PM | Feedback (3)

ASP.Net Ajax vs. Unit Tests

By definition, unit tests should be fast. Integration tests should be as fast as possible as well. Almost by definition, Javascript is not fast. In the battle between ASP.Net Ajax and my Unit/Integration tests, so far the only loser it me. This is the point when I am going to stop dedicating any more time to making this work.

posted @ Sunday, May 06, 2007 5:13 PM | Feedback (7)

SSIS & WCF - Not on best terms

I wanted to get SSIS to call a service in my application if it has successfully completed an operation. I quickly built the following service using WCF: [ServiceContract] public interface ISsisNotifications {     [OperationContract]     void UpdatedDatabase(); } public class SsisNotifications : ISsisNotifications...

posted @ Thursday, May 03, 2007 11:45 AM | Feedback (3)

ASP.Net Ajax, Performance and Race Conditions, Oh MY!

I have just tracked down the Nthbug in my application that I can blame ASP.Net Ajax for. To be rather exact, I can blame ASP.Net Ajax performance, and to be absolutely clear, I am talking about initialization performance. The main issue is that I keep running into is that it takes human noticable time for the extended behaviors to be set on the page. By human noticable time I means over a second. The immediate result is that users are able to interact with the page in unexpected ways. Leading to all...

posted @ Wednesday, May 02, 2007 4:45 PM | Feedback (9)

It is the WSDL, Stupid!

In my current project, I need to talk to BizTalk, and have BizTalk talk to me. I usually don't like to work with things such as BizTalk and SSIS, because almost invariably, they make simple things more complex than they should be. At any rate, the sceario is simply consuming web services, and having web services that BizTalk can call. I had two options to use here, I could use the usual ASMX web services, or I could use WCF. I did some testing with WCF, and it seemed fairly straight forward to...

posted @ Monday, April 23, 2007 6:57 AM | Feedback (1)

TestDriven.Net + MbUnit Gotcha

That caused some issues. I just run into a hairy issue in using TestDriven.Net and MbUnit. For some reason, none of my [SetUp] methods would run. I have moved machine with a project, and on the desktop, everything was peachy, on my laptop, [SetUp] doesn't work. I am using MbUnit version: 1.0.2614.40165 And here is the test output:MbUnit 1.0.2642.28107 Addin No tests found Starting the MbUnit Test Execution Exploring Tests.Integration, Version=0.1.248.0, Culture=neutral, PublicKeyToken=null ...

posted @ Monday, April 02, 2007 6:31 PM | Feedback (8)

ASP.Net WTF?! (sorry, blog was down)

All of a sudden, I get an email telling me that my blog is down. I go and check it out, and it is indeed down. With the following error message. Server Error in '/Blog' Application. ...

posted @ Saturday, March 31, 2007 5:19 PM | Feedback (3)

The missing Linq: Stateful extentions methods

It seems to me that right now there is a lot of exploring going on with extention methods. People are doing some really cool stuff with them. What I am afraid of is that this exploration is going to hit glass wall the moment people are going to try to do the interesting stuff with them. The reason for this is that beyond the simplest cases, I would really want to have some sort of a state between method calls. Here is a code sample that demonstrate the issue:object myRandomObj = new object(); ...

posted @ Friday, March 30, 2007 5:00 PM | Feedback (7)

Rhino Mocks: Undebuggable

“Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.” – Brian W. Kernighan Apperantly I am not smart enough to debug Rhino Mocks. Here is what I get when I try to debug Rhino Mocks in Visual Studio 2005 SP1. The really sad part is that SharpDevelop can debug the code without an issue. > oleaut32.dll!77d03c34()     [Frames below may be incorrect and/or missing,...

posted @ Friday, March 09, 2007 4:37 PM | Feedback (0)

Brail Update: Fixing AmbigiousMatchException for lazy loaded classes

There is probably a bug in Dynamic Proxy that causes it to output overrides to methods in such a way that when you reflect over the generated types, you get two methods for each overriden methods, instead of a single overriden method. I looked into it in detail a while ago, and I couldn't figure out how to make it work like I expect it to. The code that it generate is verifable, so this is something that the CLR supports, but I am not quite sure that I understand what the semantics for this is....

posted @ Sunday, February 25, 2007 1:20 AM | Feedback (3)

Hack Timeout Error

Related to Hack Bombing, I just got a bunch of failing tests, and then I saw the error. I couldn't stop laughing for a couple of minutes, and then I fixed it.  

posted @ Thursday, February 22, 2007 12:53 PM | Feedback (0)

It is official, the debugger hates me

And I thought that we are friends... For completeness sake, this is 100% repreducable, and happens when I and trying to debug a not hard to follow code, it can't enter this method... /// <summary> /// Close the generic type, using parameters from the invocation ...

posted @ Tuesday, February 20, 2007 1:18 AM | Feedback (0)

The Slim Reader/Writer Lock in Orcas

Joe Duffy has posted about the new ReaderWriterLockSlim class in oracs, everything is cool, and I am very happy to see a replacement for the ReaderWriterLock. The Dynamic Proxy library had (twice!) bugs related to the way ReaderWriterLock was used (vs. the way it ought to work), which cause it to fail under high load. So, I was very happy, until I get to the end of the post, and I saw this: Lastly, I mentioned there are some caveats around where...

posted @ Thursday, February 08, 2007 12:01 AM | Feedback (8)

Here is a fun bug...

Can you spot the bug in here? HttpRuntime.Cache.Add(key, dic,             null,             DateTime.Today.AddHours(1),             Cache.NoSlidingExpiration,             CacheItemPriority.AboveNormal, null); Debug.Assert( HttpRuntime.Cache[key] != null ); It is a very nefarious one...

posted @ Monday, January 22, 2007 2:36 PM | Feedback (3)

And it only took 3 days!

In the meantime, I had to make do with a really shitty technology presentation* to a customer, I lost about a day of work trying to make it work, etc. In a word, yuck! The solution for my trouble was here. Now excuse me, I got a lot of torn hair to gather back.

posted @ Monday, January 01, 2007 2:58 PM | Feedback (2)

Visual Studio SP1: Hosed My Machine

I started to get this types of errors all over the place after the SP install rolled back. Googling the results, is looks that I am not the only one with the problem, and there doesn't seem to be a solution in sight. WTF! Just to remind you, this is the RTM version of the SP1 that I tried to install

posted @ Monday, January 01, 2007 12:31 PM | Feedback (2)

Visual Studio 2005 SP1 Troubles: 2908 error

After testing the SP1 RTM on my home machine (which I consider OKAY to scratch), I tried to install it on my work machine, where it is not okay for things to fail. I let it run all night, and it produced this error. Now attempting to re-install Web Application Projects (which I had to remove before) fails, VS without Web Applications is hosed. Here is the last part of the logs: MSI (s) (94:20) [08:43:57:479]: Executing op: ComponentRegister(ComponentId={544FDEE8-F34D-4EC0-A970-ABBF31A0BD9A},KeyPath=<\Microsoft.VisualStudio.TeamSystem.PerformanceWizard,Version="8.0.0.0",FileVersion="8.0.50727.42",PublicKeyToken="b03f5f7f11d50a3a",Culture="neutral",ProcessorArchitecture="MSIL",State=3,,Disk=1,SharedDllRefCount=0,BinaryType=0)MSI (s) (94:20) [08:43:57:479]: MSCOREE not loaded loading copy from system32MSI (s) (94:20) [08:43:57:599]: Assembly Error:Function not defined in specified DLL.MSI (s) (94:20) [08:43:57:599]:...

posted @ Monday, January 01, 2007 7:33 AM | Feedback (0)

And now I am feeling stupid

There is a running joke in the office about one shady guy that digs really deep into an issue. It goes like this; Dev: I just got a NullReferenceException! Shady Guy: Give me a second tol install the kernel debugger and we will fix it in no time. The problem is that at the moment, I feel like I am the butt of the joke right now. For the last [undisclosed...

posted @ Friday, December 29, 2006 7:39 AM | Feedback (3)

EntLib's Object Builder Issues: What am I doing wrong?

First, let me describe the scenario, I am using Object Builder in a web application to manage the services of the application. Under load, we started to get exceptions from deep within Object Builder. I should also preface this by saying that I have very little knowledge of Object Builder and it is entirely possible that I am commiting some grave error in using it. Anyway, here is a simple wrapper for Object Builder: public class

posted @ Wednesday, December 27, 2006 11:54 PM | Feedback (2)

The thread in the haystack...

I was urgently called today to solve a problem in one of my applications. The problem was that for some reason, the application would stop process incoming files, a restart would fix this issue for a short while, after which the problem would re-appear. The application is heavily multi threaded, and has a lot of logging built in to help diagnose issues that may crop up. The problem is that the problem never even showed up in the logs. It was as if the application stopped watching the directory, but it should never do...

posted @ Tuesday, December 26, 2006 7:47 PM | Feedback (0)

VS SP1: What the HELL is it doing?

You know you are in a bad shape when installing a patch takes longer than installing an OS. The SP1 Setup has been running for over two hours now, and it is not done yet. About 30 minutes ago it prompt me to close SQL Management Studio, so I assume it is still alive. Microsoft, this has better be worth it...

posted @ Friday, December 15, 2006 3:12 PM | Feedback (3)

Visual Studio 2005 Service Pack 1

Yes, it RTMed, six months late, but that it not what I am talking about here. Whatever bugs it fixes are classified, apperantely, since the knowledge base link points to a dead end. Nevermind, at 432Mb, it is sure to fix a lot of issues, I am certain...

posted @ Friday, December 15, 2006 11:28 AM | Feedback (3)

Resiliant Outlook

Outlook manages to survive Windows restarts without shutting down, wow...

posted @ Thursday, December 07, 2006 10:07 PM | Feedback (0)

Not My Business... most of the time

I am so happy that I don't have to worry about Buffer Overruns anymore. If I did, though, this would be a good place to start looking for examples. I had to do a code review on a C++ code, and it was basically something like: // memory management // memory management // memory management // memory management // memory management ...

posted @ Tuesday, December 05, 2006 8:30 PM | Feedback (0)

Now THAT is integration

Vista doesn't like PowerShell, so I removed it. This is what I got midway through it.   I must say that I was surprised to know that the XML Parser is based on PowerShell :-)

posted @ Saturday, November 25, 2006 10:24 AM | Feedback (1)

Presenting Trac UI

So, after praising Trac so much, I decided that I need another this from it, and that was a windows client. Specifically, what I wanted is for QA to be able to enter bug reports that included screen shots without a lot of hassle. There is nothing that explains most bugs better than a screen shot with some marking. The result is this: The easiest part of this application was capturing...

posted @ Saturday, November 25, 2006 7:05 AM | Feedback (5)

I love Trac

After searching high & low for a bug tracker to use, I have finally settled into Trac, but only recently I have had the time to really take a deep look at it. The #1 issue with Trac is that it is hard to setup for the first time. I am used to web applications that are either drop in (ScrewTurn Wiki) or Drop In, mess with config, done (just about anything else). Trac has a very different approach, in which most of the management of the project is done via a command line tool. It...

posted @ Saturday, November 25, 2006 6:22 AM | Feedback (4)

Open Patches For Visual Studio

In a step in the right direction, you can now download a few patches for Visual Studio and .Net without calling PSS first. Details and patches are here. Sadly, there is not yet a patch for "Visual Studio is too slow". :-)

posted @ Thursday, November 02, 2006 4:46 PM | Feedback (0)

Fixed lecture download from Firefox

Apperantly FireFox is not able to download files with spaces in them from my servers. I remove the spaces from the downloaded file name, so it should be fine now. Sorry for the trouble.

posted @ Wednesday, November 01, 2006 7:47 PM | Feedback (5)

Bug Tracking, Round II

I got a ton of suggestion to my Bug Tracking? question. As I mentioned, I don't want to use BugZilla, and JIRA is out of the immediate price range that I have in mind - I really want it to be free :-) And although anything without per-user cost is good, JIRA is expensive, although it certainly worth the price. I tried Gemini, but I managed to hit two seperate bugs in the space of an hour, one of them a show stopper, and it didn't have an integration with Active Directory, which means...

posted @ Saturday, October 28, 2006 11:05 PM | Feedback (5)

Bug Tracking?

Any recommendation about a good bug tracking system?  I really don't want to pay per user, that is for sure. So FogBugz is out, and JIRA is expensive to start with (although it is pretty amazing bug tracker). Trac looks really interesting, but I get too many errors that I am not sure how to solve when I try to use it (entirely my fault, I know), and it looks to me like it is a tool that really requires some learning. I would rather that it would open source...

posted @ Friday, October 27, 2006 12:04 AM | Feedback (17)

Visual Studio and Non Administrator User

As an administrator, I get an error: As a mere user, I barely warrant a warning: Sorry if you thought that you would find any content here :-)

posted @ Saturday, October 21, 2006 11:23 AM | Feedback (1)

What is wrong with the builtin help is Visual Studio

I just needed to findout what the exact parameters to #pragma warning were, so I hit F1, and at the same time, moved to Google and searched. By the time that I choose the site, found the information that I wanted and already copied it back to VS, the builtin help opened. This making it useless. I probably should just map F1 to something else, since the Help is certainly isn't helping...  

posted @ Saturday, October 14, 2006 10:45 AM | Feedback (1)

How to fight race conditions with a single thread

All of a sudden, AMBUSH! A piece of code that we have been using successfully for the last 4 - 5 months started throwing Null Reference Exception. This exception was one of the impossible ones. That same piece of code would work flawlessly as long as it wasn't doing much, but the moment you tried to do something very heavy (CPU && Memory wise), it started crashing. The crash was always in the same place, but with wildly different (and all correct) inputs. Running the code in the debugger wasn't...

posted @ Monday, October 09, 2006 2:35 PM | Feedback (2)

Reflection WTF

This is a major WTF, in my opinon, consider the following code: using System; public class Program {  static void Main()  {   Console.WriteLine( "Is Public: {0}", typeof(Inner).IsPublic );   Console.WriteLine( "Is Not Public: {0}", typeof(Inner).IsNotPublic );  }    public class Inner {}...

posted @ Sunday, October 01, 2006 9:56 PM | Feedback (0)

Visual Studio 2005 SP1 Beta1: You just came, and now you are leaving...

It took amazingly short while for me to decide that SP1 Beta1 is not going to work for me. Here is what I get when I try to create a new WebForm in my application: I'm going to try reinstalling, but if it isn't working, then it is going away.

posted @ Thursday, September 28, 2006 10:16 AM | Feedback (2)

You log too much

I got this page when I looked at the logs of an application that was running for about four hours... Somehow I don't think that the logs will be very useful in this form...

posted @ Sunday, September 10, 2006 7:43 PM | Feedback (0)

Solving the HttpModule mess

Okay, I think that I managed to dechiper most of the strange behavior in ASP.Net's Http Modules.An AppDomain may hold zero or more instances of HttpApplicationA new instance of HttpApplication may be created (for reasons that I have not been able to figure out) - a set of all the http modules will be created as well.An instnace of HttpApplication may be disposed (with its associted http modules) at any time.A request will always be served by a fully initialized HttpApplication.The result of this is that you cannot set/unset static variables from an HttpModule or HttpApplication.Or, more correctly, you can't...

posted @ Sunday, September 10, 2006 7:29 PM | Feedback (0)

More HttpModules Strangeness

My web.config file defines the following Http Module: <httpModules>     <add name="UnitOfWorkModule"            type="Rhino.Commons.HttpModules.UnitOfWorkModule, Rhino.Commons"/></httpModules> Yet, for some reason, I get two instances of the UnitOfWorkModule, and I can't quite figure out why. It looks like it is proccessed okay, when I look into the Http Application Initialization, I get the following registered modules:But, if I put a break point on the Init() method in the Http Module, it is called twice! I run it many times, and the "secret" seems to be multiply requests in the application's start. It looks likes several HttpApplication instances are created, and this is what is causing the issue.This...

posted @ Sunday, September 10, 2006 11:52 AM | Feedback (10)

HttpModules Bug?! Dispose() called more than Init()

I run into some very strange issues latelt with regard to Http Modules. I am using Http Modules to setup the environment for my application. In particular, I am using Unit Of Work Module to mange my Unit Of Work and the life time of application wide resources (like the Inversion Of Control container instnace). The problem that I run into was that I began to get errors from the application, saying that the container was missing. That, of course, was not possible, since I registered the HttpModule correctly, and it certainly did it job, for a time. The issue was mainly that...

posted @ Sunday, September 10, 2006 11:02 AM | Feedback (0)

Joel & Leaky Abstractions

The recent posts by Joel caused quite a bit of noise lately, but are several things in Joel's Wasabi post caught my eye that I haven't seen blogged elsewhere:Another neat thing is that when you want to do something on the client (the web browser) you can write the code once, in Wasabi, and compile it to JavaScript for the browser and get identically functioning VBScript or PHP code for the server Can anyone say leaky abstractions? VBScript & JScript are very similar, I will grant him that, but client side vs. server side...

posted @ Sunday, September 03, 2006 11:43 AM | Feedback (4)

Taking the measure of a developer

Continuing on the interview stuff, here is something that can tell you quite a bit about a developer. Given the following error, what do they do? Here are a couple of options: They tell you: "I can't get it to work, it keeps failing and I don't know why." Look into the inner exception. Googles the...

posted @ Monday, August 28, 2006 10:20 PM | Feedback (6)

DateTime SNAFU

Could someone expalain to me why the following is throwing an exception (between 00:00 - 09:59, that is).DateTime.ParseExact(  DateTime.Now.ToString('hmmss',    DateTimeFormatInfo.InvariantInfo),  'hmmss',DateTimeFormatInfo.InvariantInfo ) This is so stupid!

posted @ Monday, August 21, 2006 12:36 PM | Feedback (2)

Define: USB Debugging

USB Debugging takes its name from the way you usually deploy to staging servers. The act of finding bugs on staging servers where you cannot install any tools and have no network that you have access to, but you are allowed to copy files via USB key (which is first screened by security {each time you copy}). In those situations, the cycle of deploying usually goes like this: Copy files to USB key Hand to security ...

posted @ Sunday, August 13, 2006 8:06 PM | Feedback (0)

And there was much rejoicing, for the Exception was raised

A lot of programmers seems to be afraid of exceptions. The moment they get one they throw their hands up in dispair and exclaim "This piece of shit doesn't work." And then they come to me to help. They usually start with "It threw an error", "It doesn't work", etc. At first I try to hone my clairvoyant skills, and give them an answer anyway, but after being accused for using KGB interrogation technique* I decided to stop that. Nowadays, I refuse to help them unless they tell me what the exception is. And...

posted @ Sunday, August 13, 2006 6:27 AM | Feedback (3)

Someone here doesn't get Test Driven Development

Trying to get a report of a test run, a shady guy around here has wrote the following code, included in full: private DataSet ExtractResult(TestSuiteResult result) {     DataSet res = new DataSet("AllResult");     res.Tables.Add ( "Diagnostics" );     res.Tables["Diagnostics"].Columns.Add(new DataColumn("Description", typeof(string)));     res.Tables["Diagnostics"].Columns.Add(new DataColumn("Passed", typeof(bool)));     res.Tables["Diagnostics"].Columns.Add(new DataColumn("Message", typeof(string)));     foreach (TestSuiteResult o in result.Results) ...

posted @ Thursday, August 10, 2006 7:14 PM | Feedback (1)

Arabic is not safe for ASP.Net

This actually has nothing whatsoever with the current state of affaris in Israel. I was trying to input some Arabic text into ASP.Net controls, and I got the Potentially Dangerous Request Detected exception, interesting.

posted @ Tuesday, August 08, 2006 8:17 PM | Feedback (1)

MsBuild Annoyances: Take 2

I have put this in my project file: < ConfigFile Include="$(MSBuildProjectDirectory)\Bin\$(Configuration)\**\*.config"/> After loading the project into VS.Net, it turned it into this: < ConfigFile Include="D:\Work\Tester\..\Configuration\FileStructure.config" /> <ConfigFile Include="D:\Work\Tester\..\Configuration\Tasks.config" /> Even ignoring the fact that this is not recursive (and I have need of recursiveness there), this is annoying in...

posted @ Monday, August 07, 2006 9:37 PM | Feedback (7)

I am very glad that this is a debugger error

Otherwise, I would really hate to debug this script.

posted @ Tuesday, August 01, 2006 6:14 PM | Feedback (0)

C# Compiler Generating Invalid IL When Dealing With Generics

I just had to find out the reason for a strange bug in Rhino Mocks. The issue turned out to be the C# Compiler producing invalid IL, which cause the following error:failed: System.BadImageFormatException : An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B) Let us start from the beginning, here is an interface and a class: public interface MyInterface ...

posted @ Friday, July 21, 2006 2:57 PM | Feedback (2)

The case of the disappearing IDE

Has it happened to anyone? One moment I am working on the IDE, the second moment it is gone? Happened to me twice today already.

posted @ Saturday, July 01, 2006 7:57 PM | Feedback (7)

Microsoft Productfeedback & Service Packs for .Net

I have to agree with Frans in this matter, Microsoft Product Feedback sucks. I reported several crashing bugs there (compiler, IDE), among other things. I never even got "we are checking" message. In th same vein, and from the same source, Frans also talks about the due date for .Net 2.0 SP1. Apperantly it has been set to Orcas' release. I'm not overly concerned about this, since I have far more problems with VS than the framework itself. The due date for this SP is Q3 of this year, which has already started, and...

posted @ Thursday, June 15, 2006 6:59 PM | Feedback (1)

Going after VS, This time with numbers

I had enough of waiting for VS. I keep saying that it is slow and that it is hunging my system. So I decided to run a test. Tomorrow I am going to use this little program to know how much time I am wasting because of VS. class Program { ...

posted @ Tuesday, June 13, 2006 12:15 AM | Feedback (3)

Stupid Password Policies

I am starting to get annoyed about all those sites that limit the length or complexity of my passwords. If I want to use a 234 characters passwords filled with spaces % ! *(~ and ', I should be able to. They are not storing the password itself anyway, so why do they force me to use a weaker password?  

posted @ Monday, June 12, 2006 10:07 PM | Feedback (3)

List is broken

It is broken because it is a basic framework class that doesn't have a single virtual method. I want to have a list where a delegate is called when an item is added or removed, but I can't do that, since this means that I need to override the Add()/Remove() methods. I need to create a completely new class, implement the entire IList<T> functionality, to get such a basic behavior. Yes, I know about Collection<T>, but this isn't acceptable. Why have two seperate classes? If I want a custom collection with ForEach() method on it,...

posted @ Saturday, June 10, 2006 11:27 PM | Feedback (3)

The relief of closing VS.Net

After issuing the “pskill devenv” command,  memory consumption went from 0.99Gb(!) to 345Mb. And it is not like I’m doing anything special, for crying out loud. There are additional problems beyond the outrageous memory requirements, for some reason I have time sensitive debugging now, if I wait more than a minute before moving to the next line, I get this error: The CLR has been unable to transition from COM context 0x196730 to COM context 0x1968a0 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running...

posted @ Thursday, June 08, 2006 12:58 PM | Feedback (4)

Yet Another Way To Crash VS.Net

This one is in the common path, incredibly easy to trigger, and will cause you to lose your work. In Vs.Net, create a C# console application project Right click the project and click View Class Diagram Ctrl+A, Delete to get rid of everything Now change the ClassDiagram1.cd name to Foo.cs (the extention...

posted @ Monday, May 22, 2006 11:47 PM | Feedback (0)

Word 2007 Blogging Feature

I've tried Word's Blogging feature, and while it looks very cool, there is one big problem with it. It refused to publish new posts to my blog. It got no problem with reading or updating existing posts, but it just refuse to post new things, claiming that it can't connect or the password is wrong. I tried both MetaWebLog and as Community Server (my blog is DasBlog) Argh!  

posted @ Monday, May 22, 2006 10:04 PM | Feedback (0)

AccessViolationException in Windows Services

I wrote a Windows Service and I couldn't get the service to start properly. After trying too long to debug it in a service mode, I gave up and tried running it as a console application, I immediately got the following error:Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. I so thought that I left those kind of bugs when I left C++. Just to be clear, there isn't a hint of unsafe / unmanaged code in the application. It turned out...

posted @ Thursday, April 27, 2006 11:07 PM | Feedback (0)

I Inerit from ValueType, But I am a Reference Type, who am I?

Apperantly, the winner for this question is Enum. Check out the 1.1 documentation for it. I can't make heads or tails of this statement:Class Enum is derived from class ValueType; that is, Enum is itself a reference type, not a value type. Anyone knows what this is?

posted @ Thursday, April 20, 2006 8:46 PM | Feedback (4)

VS.Net resolving references of referenced assemblies

I have a problem with VS.Net 2005, it seems like it stopped copying the assemblies that are referenced by the assemblies that my project is referencing. For instance, I am using Castle.ActiveRecord, which is using Castle.Model. I have a reference to Castle.ActiveRecord, and when I run the project, I get an error because it can't find the Castle.Model assembly. This is the first time that I got this issue, and googling doesn't seem to find anything about it.

posted @ Thursday, April 20, 2006 2:31 AM | Feedback (5)

Don't touch that exception!

It is evil to swallow exceptions. I am working with a library that is choked full with stuff like: try { //do stuff }catch (Exception e){ Trace.WriteLine(e.Message, "Name of the method");} This is a UI component, and it is driving me mad. Stuff stops working all of a sudden, and I need to run the app under the debugger with "catch all exception" to find out what is going on. The exception message itself (when I manage to find it) is often not very helpful, and I don't get the stack.My rules for exceptions are:- Always throw exceptions if conditions are not valid.- Throw exception...

posted @ Thursday, April 06, 2006 2:06 PM | Feedback (3)

String.IsNullOrEmpty()

Can somebody explains to me why this is happening? I looked at the generated IL, and it looks fine, but it consistently generate a Null Reference exception if I compile it with: csc /debug+ /optimize+ test.cs The stack trace points to for loop line, but I have no idea what is happening there.

posted @ Tuesday, April 04, 2006 9:23 PM | Feedback (2)

After talking about the EntitySet so long...

I just run into a bug that happened because I used EntitySets.I was relying that the order I'll get the items from the set will be identical to the order I inserted them.It even pass a couple of tests when I wrote this, but it started to break today until I figured out what was wrong. A quick change to EntityList (which does have this guarantee) solved the problem. 

posted @ Wednesday, March 29, 2006 1:35 PM | Feedback (0)

Curious bug of the day

If you throw an exception on the finalizer thread, expect bad things to happen. I just run into this issue where both TestDriven.Net and ReSharper Test Runner doesn't handle this issue. I would get a nasty error message from Windows telling me that this is a rouge application and none of my tests will continue to run. The issue was that several of the tests were creating chain of objects, and the lower most object was a Component, which mean that it is disposable and finalizable. In the dispose method it called a dipose...

posted @ Saturday, March 25, 2006 12:48 AM | Feedback (1)

What happened to VS.NET 2005 Service Pack?

We were promised soon after the VS.Net launch that there will be a service pack for it in the first half of 2006, which is not so far away. Considerring that the promise for VS.Net 2003 SP in April is not likely to happen with the first beta just arriving, I'm concerned about this. I get annoyed daily that my 1.3 Pention M + 1Gb RAM isn't fast enough to run VS.Net (code editing only, I hardly ever use a wizard) in a mode that will not leave me waiting at least every couple of minutes....

posted @ Thursday, March 23, 2006 9:36 PM | Feedback (0)

Embarrassing Moments

Sometimes I make mistakes that has no reason whatsoever. It's like I developed a sudden blank spot in a particular area for a while. I had a piece of code similar to this one (PL/SQL, nonesense code): for rec0 in sql_data          if rec0.Status == 3 then      ...

posted @ Thursday, March 02, 2006 8:09 PM | Feedback (0)

What is wrong with JavaScript?

Stefan asks What Is Wrong With Javascript, I think that I've at least a partial answer to that. Here are my reasons: Until very recently, Javascript was just too slow by far to consider writing applications with it. Lack of a rich class library. Until recently, lack of good debugging tools. ...

posted @ Monday, February 27, 2006 11:24 PM | Feedback (2)

Messing with DasBlog, the bad point

I would like to apologize to anything who suddenly got a boat load of my old posts, I played with dasBlog's settings, and I forgot to set the settings back to normal.

posted @ Thursday, February 23, 2006 9:41 PM | Feedback (0)

Why So Many Snippets

So Microsoft has posted a lot more snippets, a Jeff has made them more accessible. I downloaded them and took a look. I'm pretty sure that you could hear my cries of horror all the way to Remond. Why? That is the question I have. Snippets are useful for things like generating a foreach (although the Microsoft implementation sucks, try the way ReSharper does it.) or maybe generating a method skeleton. I see them doing things there like Hashing A Password, Encrypting Files, etc. Why? This is just a recipe...

posted @ Wednesday, February 22, 2006 6:56 AM | Feedback (0)

Found VS.Net & FileSystemWatcher problem

Like I said, I had a problem with the FileSystemWatcher not picking up the changes that VS.Net was doing. Justin suggested playing with the NotifyFilter property, and it worked! The issue turned out to be that VS.Net doesn't write to the file, but rather copy a temporary file that it keeps on the side over the file. All I had to do was to add the NotifyFilters.CreationTime and it worked. I noticed the problem while working with Brail, and I'll commit the stuff tonight. It does mean that to be able to really play with my Castle Demo App, you'll need to use...

posted @ Monday, February 20, 2006 3:36 PM | Feedback (0)

FileSystemWatcher & Visual Studio 2005

Okay, I've this very strange bug. I got an application that watch over a folder for changes in the files. When I edit the files in Visual Studio 2005, the application doesn't do anything. But when I edit the file in notepad, the change event is fired and everything is fine. Anyone knows what is going on there? Here is sample code the shows the problem: import System import System.IO   class Bug:         watch as FileSystemWatcher                 def StartWatching():                 watcher = FileSystemWatcher("""C:\Test""", Filter: "*.*")            ...

posted @ Monday, February 20, 2006 12:11 PM | Feedback (4)

Piping, Primary Keys and Three Hours I'll not get back

Okay, so I mentioned that I'd a query that violated a primary key constraint, and I couldn't figure out why. Well, I finally got a hold of what was going on. It's simple and non-obvious at the same time. Let's start with a code example that shows the problem and then I'll put in a couple of words about the reasons behind it. First, let's create a table with a unique constraint (easier than a primary key): CREATE TABLE Foo (       Bar INT UNIQUE ) Now, let's insert some data into the table: INSERT INTO Foo SELECT 1 UNION...

posted @ Sunday, February 19, 2006 7:17 PM | Feedback (0)

WinFX Installation Error

So I have been wanting to play a bit with the WinFX bits. I head down to Microsoft's Site, download the whole thing (over 1Gb in size!), and then I find out that this just doesn't work everytime that I try to install the "WinFX Runtime Components 3.0 Beta 2", I get an error.This drove me to depesrate measures such as searching the help, where I find that instead of using plain old HTTP download, the setup is using BITS 2.0 (Background Intellegent Transfer Something {possibly System?}).Now, I have BITS on my computer, and it's even enabled and running, so...

posted @ Sunday, February 12, 2006 3:59 PM | Feedback (0)

More reasons to hate Oracle...

There is the straight and narrow, and then there is everything else. For instance, I was passing this command with 'select * from customers;', using OracleClient, and I got the following error 'ORA-00911: invalid character'. The maddening part is that it knows what the invalid character is, but it won't tell me. Trying the exact same command in SQL*Plus worked, of course. In the end, after much hair pulling and nearly a day down the drain, I tried this command 'select * from customers', which worked. Can you spot the difference? It the bloody ';' in the end! It cannot process that so it throws...

posted @ Tuesday, February 07, 2006 2:15 PM | Feedback (1)

Great Debugging Blog

I just found this blog by Tess, it talks about all the ways to track down issues with your applications. There is a lot of great info there, and I'm sure to head that way any time that I need to solve any complex issues with an application.

posted @ Saturday, February 04, 2006 8:46 AM | Feedback (0)

How to kill the C# Compiler

My legendary skills in breaking code have now reached a new level, in which I managed to break the C# Compiler. Check out this code:   public delegate void Proc();   ...

posted @ Thursday, January 26, 2006 10:30 AM | Feedback (2)

Exception Handling - the ugly

If this was an art, I would name it "Without Words"  HelperObj obj; int Foo() {   try   {      return obj.DoWork()   }   catch (NullReferenceException ) ...

posted @ Saturday, January 14, 2006 2:25 AM | Feedback (2)

GetField & Turkish Locale

I've just got an email about an interesting problem with NHibernate. After searching for a little while, I came up with the conclution that the problem is in the framework, and I can't see an easy solution for it. First, let's start by explaining Turkish locale & its unique interpretation of the humble i letter. This MSDN article does it best, so I'll let them do the job: For nearly all Latin alphabets, including U.S. English, the character i (\u0069) is the lowercase version of the character...

posted @ Saturday, December 24, 2005 1:56 PM | Feedback (0)

The Windows Tidbit For the Day

You can usually use double Ctrl+Alt+Delete to get to the old logon screen in Windows XP, but it doesn't work with Fast User Switching, I don't know why. If you log off, it works. Strange.

posted @ Monday, December 19, 2005 8:19 PM | Feedback (0)

I Hate MySQL

An interesting discovery: TEXT columns in MySQL will only hold 65,000 bytes. The problem is that when you hit this limit, MySQL will just silently corrupt your data, instead of throwing an exception, like it should be. I got this problem when I tried to edit Rhino Mocks' documentation, and the size of it was just over 64Kb. I wasted quite a bit of time over this, thinking that maybe the limitation was in ASP.Net, Cuyahoga, NHibernate, etc. Ugly, Ugly, Ugly. I know...

posted @ Saturday, December 17, 2005 9:38 AM | Feedback (6)

Free as a bird? Or not?

This slashdot story made me smile. A software bug set inmates free early and late, some by nearly half a year! I used to be the commander of a high security prison, and I understand how those systems work. What I find interesting is the number of check and balances that most prisons have. I'm familiar with the inner working of most prisons in Israel, both military and civilians, and it's hard to believe that you would get a case of this proprotions. One case might happen, but...

posted @ Sunday, October 23, 2005 10:18 PM | Feedback (0)

Bug Tracking

I need a web application to show for a prospective employer, I don't have any web application that I'm willing to put out for the world to see, so I decided to build a Bug Tracking System. The meeting is tomorrow at 11:00 AM. Current time: 18:40 (06:40 PM) Requirements: Multi project support - with nice URLs Readable bug numbers - Like JIRA's one ...

posted @ Tuesday, August 23, 2005 4:54 PM | Feedback (1)

NHibernate Query Analyzer: Playing with numbers

It out for 18 hours, 33 downloads and 4 bug reports (sigh)

posted @ Tuesday, August 02, 2005 9:55 AM | Feedback (0)

Gmail is Down

Gmail is down, can't find the reason why, but there are quite a few posts on it on the blogshpere. It's a non-essensial service to me, as I'm using it as a secondary email, but that is disturbing to say the least, as far as I can tell, it's down for at least three or four hours.

posted @ Saturday, June 04, 2005 9:30 PM | Feedback (1)

Rss Feed For NHibernate Query Analyzer

It's all the rage* now in Bug Tracking software to add RSS feeds to see the current bugs, improvement etc. A nice addition is usually the ability to create RSS Queries (all the bugs which are assing to me, all the bugs open over 30 days, etc). Well, I can get quite that good, but here is an RSS feed for NHibernate Query Analyzer development, this will keep you updated (if you're even interested :-) ) with what I'm doing with NQA. The secret is very simple, TiddlyWiki supports Rss Feeds,...

posted @ Saturday, June 04, 2005 5:57 PM | Feedback (0)

GDI+ Problem

I'm trying to draw a PNG image whose size is 16x16, using Graphics.DrawImage ( System.Drawing.Image image , System.Int32 x , System.Int32 y ), but for some reason it draws it at ~21x21, which ruins everything. If I convert the image to ICO, then it draws it properly. I changed the code to use the Graphics. DrawImage ( System.Drawing.Image image , System.Int32 x , System.Int32 y , System.Int32 width , System.Int32 height ) overload, and it works, but I can't think of a reason that this would require this. After all, the image already contains...

posted @ Saturday, June 04, 2005 5:04 PM | Feedback (0)

GreaseMonkey's Linkify & TiddlyWiki

Just to note, the script Linkify for GreaseMonkey has bad side effects for TiddlyWiki, causing it to fail to display anything.

posted @ Saturday, June 04, 2005 3:24 PM | Feedback (0)