Is a new thread in a Visual Studio test project aborted when the test ends?
i have to do some message exchange with a 3rd party (in a website). When the client posts a page, i start the message exchange. When that doesn't succeed for some reason, i report this to the client by rendering the page with a message. On the background, in a separate thread, i start a process to send abort messages to the 3rd party. I can't do this while the user is waiting for the pa开发者_Go百科ge to come back, because it might take a few minutes.
But in a test project, the test ends when the message to the 3rd party is sent, and after the new thread is started. But it seems that the new thread also ends, when the test is done.
Is that normal behaviour?
I do start the thread in a new class with a reference to 2 objects from the class which tries to send the message in the first place, may that be a problem?
EDIT: it keeps running when the whole process is started in IIS
I guess the mstest executable shuts itself down when all tests have finished. Try, in your unit test, to wait for the end of the abort conversation.
精彩评论