Hello,
I have a bunch of BPM code laying around in production that we’ve had there for years. All of the sudden this week from multiple customers we are getting the following error
Error Detail
============
Description: BPM runtime caught an unexpected exception of 'NotSupportedException' type.
See more info in the Inner Exception section of Exception Details.
Program: EntityFramework.dll
Method: Translate
Original Exception Type: NotSupportedException
Framework Method: A001_CustomCodeAction
Framework Line Number: 0
Framework Column Number: 0
Framework Source: A001_CustomCodeAction at offset 1718 in file:line:column <filename unknown>:0:0
Now this particular error is fairly common in LINQ statements if you do something that EF can’t translate to SQL. Chiefly being calling .ToString() inside of a LINQ statement.
However this isn’t the issue any longer. Take for example this piece of code, it has been in production for over a year and this customer has not updated Epicor… (though they do update Windows/Microsoft)
Original Code
//Other stuff here
var orderHed= (from oh in Db.OrderHed
where oh.Company == callContextClient.CurrentCompany &&
oh.OrderNum == ttOrderHed[0].OrderNum select oh).FirstOrDefault();
//More Stuff
The “gripe” is that bit ttOrderHed[0].OrderNum it is claiming this is not supported, however this code has been running in production for over a year. The fix is easy, I just assign the order num to a local var and pass it in to the LINQ query
int orderNum = ttOrderHed[0].OrderNum;
var orderHed= (from oh in Db.OrderHed
where oh.Company == callContextClient.CurrentCompany &&
oh.OrderNum == orderNum select oh).FirstOrDefault();
and this fixes the issue, but there have been no changes to Epicor… this is a Microsoft “break” as far as I can tell. Has anyone else seen this? Another good one is using the string.Equals in LINQ. Again it appears that for some reason they are no longer supporting
string.Equals(x,y,StringComparison.OrdinalIgnoreCase);
However the other overload without the case sensitive check works fine
string.Equals(x,y)
I feel like I’m losing my mind, has anyone else seen this?