LinqMetaData throwing object reference not set

Posts   
 
    
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 08-Jul-2016 06:03:11   

In dev, works fine. On a production machine on the line where I

var metadata=new LinqMetaData(adapter);

it throws exception "object reference is not set".

'adapter' is not null, I added logging to check if adapter was null, and it was not. I've copied the llbl pdb files to the server but I don't get any extra call stack info. It just complains about that line, and then the timer event that triggered it.

Now here's the real crazy part. Another part of the app (compiled into same exe) uses LinqMetaData, the code is the exact same and it works!! Why is this one task failing on that line?

I do have multiple tasks running triggered from System.Timers.Timer. Is linq thread safe? I don't have any issues in dev machine (with release build) when all the tasks are running.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Jul-2016 10:36:51   

Do you have a stacktrace with the exception as well? As it's generated code, what's the code where it breaks exactly?

Frans Bouma | Lead developer LLBLGen Pro
happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 08-Jul-2016 14:12:45   
7/8/2016 7:08 AM: ERROR: Object reference not set to an instance of an object.
7/8/2016 7:08 AM: ERROR:    at WindowsServices.BackupManager.DoTimerWork() in D:\Source\Applications\WindowsServiceAgent\BackupManager.cs:line 37
   at WindowsServices.BaseTimerManager.OnTimedEvent(Object source, ElapsedEventArgs e) in D:\Source\Applications\WindowsServiceAgent\BaseTimerManager.cs:line 54

Line 36: var adapter = new DataAccessAdapter(); Line 37: var metaData = new LinqMetaData(adapter);

The same two lines above work just fine in another task that is kicked off at the same time from another timer. I even added a line 36a 'if (adapter!=null){' but then the exception occurs on the new line where 'new LinqMetaData(adapter);' so adapter is not null.

happyfirst
User
Posts: 215
Joined: 28-Nov-2008
# Posted on: 08-Jul-2016 19:52:29   

Consider this issue closed, although I have no explanation. I made other changes to the app in other places for other reasons, and now that line of code is happy and no longer throwing an exception.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 08-Jul-2016 22:09:25   

Ok simple_smile if it happens again, just post a new message in the thread, it automatically reopens simple_smile

Frans Bouma | Lead developer LLBLGen Pro