Hi everyone, need help here, im having trouble with my program, what my system do is, it compares two datafiles, first it matches datafile1 to datafile2, then datafile2 to datafile1, when there in unmatched in the datafile i writes in notepad, i used streamread in reading the datafiles, actually its working very fine when im testing it to a small size datafile (10 KB), it gives the output i want, but when i tested it to the actual data(50MB) it hungs and shows this message:

"The CLR has been unable to transition from COM context 0x205570 to COM context 0x2056e0 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 operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations."

id been doing some searching on the web, and i found one saying that i should uncheck the ContextSwitchDeadlock from Thrown column in Debug/Exceptions/ManageDebuggingAssistant, after doing so, the message no longer appears but a new warning show saying "virtual memory low" and on my form its say "Not Responding". everyone is welcome to help and thank you very much in advance...

I think you have issue on reading 2 files, your threads are running against each other and causing them to wait for each other causing your app to hang up.

Clean up your code and re-code it properly.

For your virtual memory problem, you have too many objects that are not properly disposed. That is memory leak, check if your reader is being close or if you buffer in read is disposed properly. One problem also is that your buffer is increasing after each comparison.