Page 1 of 1

Property accessor, randomly, not found

Posted: Tue 29 Nov 2011 09:31
by crazypit
Hello,

Using the latest 2.50.X version of LinqConnect and in a heavy duty environment, i occasionally get a weird exception during a call to a LINQ to SQL statement:

System.ArgumentException: The method 'Exis.eXray.Domain.ExrayDataContext.get_UdfsValues' is not a property accessor
at System.Linq.Expressions.Expression.GetProperty(MethodInfo mi)
at System.Linq.Expressions.Expression.Property(Expression expression, MethodInfo propertyAccessor)

Of course, the property is right over there and used in the same system in 1000's of places! It is rather unusual and rare. So, is there maybe an internal cache of MethodInfos that you keep for performance reasons, that maybe for some reason is cleared or not properly synchronized, that results to a small time window where this property is requested but not present? Could there be something in my code that invalidates this cache?

Posted: Wed 30 Nov 2011 17:41
by StanislavK
Could you please specify a longer stack trace of such an exception? If possible, please also describe the scenario(s) in which this error occurred.

Posted: Thu 01 Dec 2011 08:05
by crazypit
Next line on stack trace is my LINQ to SQL query that uses this table. Same line is executed successfully in 1000 times and in 1 of them, i get this error.

Query is the following:

var invoices = from objInvoice in context.Invoices
where objInvoice.CuId == anonmeter.CustomerId
&& objInvoice.AffBal == "1"
&& (from objUdfValue in context.UdfsValues
where objUdfValue.UdfId == InvoiceSupplyNoUDFId
&& objUdfValue.Value.Substring(0, 4000) == anonmeter.Meter
select objUdfValue.RefId).Contains(
objInvoice.Id)
select new
{
TransactionValue = objInvoice.TotalCharge,
TransactionDate = objInvoice.Date,
TransactionType = TransactionTypeEnum.Invoice,
TransactionDueDate = objInvoice.DueDate.Value
};

This is enclosed in a function and in a foreach statement and therefore called hundreds of times. In maybe 100 calls of this function that calls 1000 times this LINQ to SQL, i get 1 that gives the error.

Posted: Mon 05 Dec 2011 16:14
by StanislavK
According to the stack trace, the issue occurs when .NET Framework creates an expression based on your LINQ query. This is a step not controlled by LinqConnect (the latter only processes the expressions prepared by .NET Framework). Thus, the issue you are observing apparently is related to .NET Framework itself.