Tom Hanson
Tom Hanson

Reputation: 945

Unit Test Passes, Project Crashes, the Unit Test Fails

I have a silverlight project that connects to MS CRM. This project calls a workflow which does some steps, one of which is a custom step. This process throws a Timeout Exception when the service.Create(Entity) is called.

I have a unit test which calls the workflow with the same data as the silverlight project. If I run the unit test before trying the silverlight project, the test passes. I then run the silverlight project and the timeout exception is thrown. If I then run the unit test after this, it also fails.

No real error is throw. The Workflow step just hangs.

The same code is in two environments. Our DEV environment works like a dream. Our Test Environment is where all the problem begin.

Does anyone have ANY thoughts as to why this could be happening.

EDIT: Turns out the error was happening before the unit test code. I have narrowed it down to a ExecuteMultipleRequest. However, this code, once again works in a different context. Two workflows, both do the same thing. One async and the other sync. The async passes and the async doesn't...

Upvotes: 1

Views: 57

Answers (1)

Daryl
Daryl

Reputation: 18895

By default, you're limited on the number of ExeucteMultipleRequests you are running to 2, so the first step is to ensure that you aren't doing more than that.

Another thing to try is to make sure that you're not multi-threading your connections to CRM. By default, .Net only allows 2 http Requests per app. This is controlled by a configuration setting.

And finally, I'd execute a WhoAmIRequest as soon as you create your connection to CRM, just to make sure it's valid (assuming you aren't doing any other requests prior to the one that is failing).

Upvotes: 1

Related Questions