views:

100

answers:

4

I have a .Net program that, as one of its functions, takes a file from a user-specified directory and puts it in another, special, directory, specified via UNC (which may or may not be local). I don't open any of these files in this part of the code.

There's this bizarre bug I'm having where, on a Windows Server 2003 SP2 VM, this program randomly does a hard abort while doing the move to a local folder. It just terminates. No exception, no logging, and it doesn't appear to happen at any particular moment. I can't reproduce this problem on my development machine, and it only appears to happen during the copy of a particular kind of file that's about a megabyte or so. There are other formats copied to different directories using very similar code, all smaller, and they work fine.

Why would a Windows .Net program do a hard abort like this? What can I do to fix it?

A: 

I would guess a network failure since you mentioned "specified via UNC (which may or may not be local)".

I would alter the program to add logging for the file copy operation, if this is an option.

Have you tried doing a "netstat" while it is attempting to copy? This could tell you if perhaps a firewall port is blocked.

Chris Ballance
Network failure is a possibility, although the folder's supposed to be local. Would it be folder permissions if it works 99% of the time, though?
Merus
Correct, if it works 99% of the time I would not guess folder permissions to be the cause. Add some logging to help diagnose network issues.
Chris Ballance
A: 

The .NET runtime wil fail fast and shut down the application without further notice on stack overflows. However, this should generate an entry in the event log of the server. Are you using any kind of recursion or allocation large arrays etc. in your code that might cause a stack overflow?

Jakob Christensen
A: 

I would change one line. What happens if it just saves the file locally? Does it still fail in this image? Can you copy and paste that portion of code into your question?

tyndall
A: 

have you checked the event logs? Is there an anti-virus program messing with it? is it getting DAP'd?

Ry