Skip to main content

Boston

Go Search
Infusion Blogs - Beta
  

Categories
Social
Tech
Business
Other Blogs
There are no items in this list.
Links
There are no items in this list.
Infusion Blogs - Beta > Boston
A blog about the experiences of the Infusion Boston Office
IIS uses old .dlls, makes developer doubt his sanity
Here's the situation: an application crashing on a staging server with an index out of bounds exception.

An INDEX OUT OF BOUNDS exception!

I was excited to look at this code because I thought it was going to make me feel really smart, because seriously, what kind of programmer pushes something all the way to staging that still gets index out of bounds exceptions?

Of course, most of this code had been working in production for several months, which should have been a warning sign, but I was too excited to let that slow me down.

I pulled up the source file looking for the blatantly obvious failure to do a bounds check. But (I'm sure you've guessed where this is going) it wasn't there. There were tons of ArrayLists being indexed, and every single one was being checked perfectly.

Uh oh. I added some logging information and pushed a new .dll out to staging, and reran the app to get some data in my logs.

Except the error didn't happen.

What did I change? Nothing, really. But the darn thing seemed fixed, so I reported it as fixed...

*an hour passes*

It's broken again. What the heck? Ok, the logs are slightly useful, lets narrow it down a bit more with some extra logging, publish it to staging ...wait a minute, now it works again??

Am I insane?

An hour later it breaks again. This time, we're on the phone with MS support, and he's got a copy of the source code from the crash dump. He looks at it, and it's pretty obvious to him that I must be the worst programmer in the world, because on the tenth line of the offending method call there's an array indexing operation that will fail 100% of the time that a variable is 0.

At this point he starts to explain that subtracting 1 from 0 and then using it as an array index won't work, and I have to say I don't blame him. The problem is, when I look at the method, it only HAS 4 lines, so it's pretty hard to have a problem with the tenth line.

Uh oh. He emails me the code dumped from the crash... and it looks like a primitive version of the code I've been maintaining, an ape-man to my code's neanderthal. Clearly it had evolved into the beautiful source code I was looking at, which is all well and good, except it doesn't explain how this fossil of a class was still living deep in the jungle of IIS, occasionally making contact with civilization just long enough to INDEX OUT OF BOUNDS!

So I'll update this when I finish figuring out where the heck IIS gets .dlls from, and why it decides that sometimes my shiny new classes just aren't good enough for it.
WebDAV:  Exchange 2000 vs Exchange 2003

Today I learned that Exchange 2000 is a lot pickier than Exchange 2003. Specifically, you need to set the content type of a WebDAV request before filling the request stream, or else Exchange 2000 flips out and sends you a 400: Bad Request response. Exchange 2003 doesn't mind that order of operations... so that's where the trouble begins. There's a nice msdn overview here on how to use WebDav to manage contacts, but it uses the latter order... which only works on Exchange 2003. Let's look at some code from their example, slighty edited for brevity:

 

request.Method = "SEARCH";

// Get a reference to the request stream. Stream requestStream = request.GetRequestStream();

// Write the message body to the request stream.

requestStream.Write(bytes, 0, bytes.Length);

// Close the Stream object to release the connection for further use. requestStream.Close();

// Set the content type header. request.ContentType = "text/xml";

Works great on Exchange 2003. Blows up inexplicably on Exchange 2000. Here's the (maddeningly simple) fix for Exchange 2000:

 

request.Method = "SEARCH";

// Set the content type header.

request.ContentType = "text/xml";

// Get a reference to the request stream.

Stream requestStream = request.GetRequestStream();

// Write the message body to the request stream.

requestStream.Write(bytes, 0, bytes.Length);

// Close the Stream object to release the connection
// for further use.

requestStream.Close();

Hard to even see the difference, right? I'm not entirely sure why this fixes it. Apparently the "content-type: text/xml" header needs to be early in the request for things to work right. And setting the property early puts it there.

(re) Announcing Infusion Boston

On Friday, Infusion Boston made its glorious return back to the Cambridge Innovation Center @ 1 Broadway in Cambridge. As indicated in our previous posts, there was a fire a number of weeks back, forcing evacuation and repairs to the building. Fortunately for Infusion Boston, we only had one employee in the office at the time (who safely evacuated) and our office suffered no damage.

We'll shortly have pictures up of the "New Again" office.

"Homeless" coders
We have a blog before we have an office! 
 
How about that.
 
Our real office had a little fire, so we're working out of temporary space for now.
 
Edit (KG): For now we working out of the swank 10 Post Office Square, which is literally right across from one of our clients in downtown Boston.
 
Just how close are we?  The other day we literally waved out the window to our client, who waved back from his office on the 16th floor of the adjacent building.
 
I can't wait to be back in the CIC in Cambridge.

 The Blogger in Question

Boston

 ‭(Hidden)‬ Admin Links