Search code examples
.netvb.netcryptostream

cryptStream.FlushFinalBlock() kills my program on 64bit OS


I have a program that is deployed on multiple Windows7 32bit machines. It runs flawlessly on all of them.

I just installed it on a Windows7 64bit machine and it's now crashing immediately after executing cryptStream.FlushFinalBlock() with the following error:

The program '[2972] Billing.vshost.exe: Managed (v2.0.50727)' has exited with code -1073740940 (0xc0000374).

I also tried running it on the only other OS I currently have installed, Vista 64bit, but I get the exact same issue. This is within a try block but nothing gets caught. It just fails immediately. Is there a known compatibility issue with CryptoStream and 64bit OSes or is this probably something else? Any ideas on how to troubleshoot it?


Solution

  • I hate answering my own question, but perhaps it will help someone else out in the future.

    If the bit array you're decrypting is null, it will crash on a 64-bit OS when running FlushFinalBlock().

    Source: http://connect.microsoft.com/VisualStudio/feedback/details/330926/cryptostream-flushfinalblock-fatal-on-64-bit-os-if-bytearray-is-null

    They say it has been closed and updated in a future release of the framework, but I'm on VS2010 and still getting it.