views:

14

answers:

0

I'm writing a program which uses a MessageQueue to receive data from another program. It works perfectly on my computer, but bombs on another. Both computers are running XP. I have installed .Net 4.0 Client Profile, and turned MSMQ on, and restarted the computer since then. Via a series of message boxes, I narrowed the error down to this line:

messageQueue.ReceiveCompleted += (o, e) =>
{
    _monitor.DecodeData(e.Message.Label);
    _receiveResult = messageQueue.BeginReceive();
};

When it get's to this line, it bombs, saying that the program closed unexpectedly, and that I may have lost work. It doesn't give me any error codes or anything. The most confusing part is that this line doesn't even do anything - it just sets the delegate. (Program control never passes this line - it's not coming back into the delegate.)

What could be causing my program to bomb, and how can I get more information about the error?


Edit:

Commenting out the expression body

comQueue.ReceiveCompleted += (o, e) =>
{
    //_scaleMonitor.DecodeCom(e.Message.Label);
    //_receiveResult = comQueue.BeginReceive();
};

bombs as well. I attach lambda expressions to events other places in my program, and they work great. What's wrong with this one?