Home  /  Questions  /  Question



50   50
Mar 17, 2010


[Return response] gives me an exception

Folks,

I'm stuck with a weird problem, I'm using a pattern from DoFactory's Design Pattern Framework in designing a website connecting to sql server DB,

I have an object called PurchaseOrder, I implemented all PurchaseOrder helping objects throughout all pattern layers, The problem now in the below two lines of code in the service layer:

response.PurchaseOrders = Mapper.ToDataTransferObjects(purchaseOrders);
return response;

While debugging, following the [return response;] statement I get an Exception of type 'System.ExecutionEngineException'. I don't see any other details about the exception, BTW, Exception appears after the return statement and before exiting the function, in other words, before the debugger reaches back to the Controller. .

Here is what I tried: 

1- tried to return new PurchaseOrderResponse from this function and worked without exceptions.

2- tried the below lines of code, after making PurchaseOrder object holding only an ID, but gave me the same exception 


IList<PurchaseOrderDto> poDto = new PurchaseOrderDto[2];
PurchaseOrderDto Dto1 = new PurchaseOrderDto();
PurchaseOrderDto Dto2 = new PurchaseOrderDto();

Dto1.ID = 1; Dto2.ID = 2;
poDto[0] = Dto1;
poDto[1] = Dto2;

response.PurchaseOrders = poDto;
return response;

I have attached two screen shots:
First, for the response object before the exception,
Second, for the exception itself.

Please let me know if anyone has any idea .






Best regards,

Tom.