Property accessor, randomly, not found

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Property accessor, randomly, not found

Post by crazypit » Tue 29 Nov 2011 09:31

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?

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 30 Nov 2011 17:41

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.

crazypit
Posts: 163
Joined: Wed 15 Apr 2009 08:43

Post by crazypit » Thu 01 Dec 2011 08:05

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.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Mon 05 Dec 2011 16:14

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.

Post Reply