This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hey all - I'm getting a strange exception from some code that has been working for months. Using Lightspeed 5, nightly build from 10/21/2013 (yeah I know I should get the latest but this project seems to be getting far fewer updates than it used to). VS2013 and SQL Server 2008R2. Here's the code where the exception is thrown:
When I step through this piece of code in debug mode I see the current line of execution start at the top and move through in a predictable manner - if (_eplantId == 0), then if (UnitOfWork...Count()), then it jumps back up to if (eplantId == 0), back to if (UnitOfWork...), then throws the exception. This started after a particularly hairy merge (TortoiseHg) that required a bit of manual intervention. However, the merge was in a separate module from this one. Same project, different file. I moved some code around in an unrelated module and the behavior changed. Now it steps past the the first .Count statement and lands on the .FirstOrDefault statement, then back to the top and repeats the sequence before throwing the exception. I am completely stumped by this one. I don't even know how to go about finding what or where the problem might be. Do you have any ideas, tips or suggestions for me? What might cause this exception to be thrown? The exception is thrown from Mindscape, I have attached the exception text and stack trace in case that tells you anything new. Thanks, Dave |
|
|
Is .IsDefault an entity property or a custom property you have implemented?
|
|
|
That is a full-fledged Entity property, a field on the database record. Also, just to reiterate, the code itself works fine in other builds. Something happened in the merge that caused this oddness to start happening, and I'm looking for clues as to where to start looking for my error(s). Also, what in the world is going on with the connection to your web server? I get delays of anywhere from 1 second to 3 seconds for any action I do for the past few days. Type a character, wait. Click the mouse, wait. Almost like it was on the same machine as your nightly build server? Just a guess... |
|
|
Based on the stack trace the exception looks to be being raised because of a failure to find the IsDefault member, or IsDefault contains an internal implementation which references something else which is not being found or cannot be translated (e.g. a method call inside the property getter). Has anything changed in the implementation of that class? In terms of the website, can you give an example of where this is occurring? We are not seeing any other reports of issues but Id be keen to find out whats going on! If you are able to give me a time and page where you were seeing problems I can check if there were any JavaScript errors being reported at the time. Our nightly builds are built on a small cluster of servers in our office each evening and then uploaded to S3 so this process is unrelated to anything happening on this server :)
|
|
|
Hi Jeremy - I got sidetracked putting out a couple fires and won't have a chance to look at this again until tomorrow. However, I did try adding some extra bogus code just to move the stack around a bit and got more information that confirms what you are thinking. I didn't migrate the database to match the model when I bounced from one branch of development to another and there were missing fields. The original exception was extremely unhelpful, but I managed to squeeze out a little more that created that 'aha' moment I was looking for. IsDefault hasn't changed but I did add a field to that table called IsDeleted that wasn't reflected in the model. I'll let you know how it goes tomorrow. As for the website being slow, it's all the time lately. I have also noticed that when I have the forum web page open it also interferes with other applications I have running on my desktop. Very weird. Thanks for the help, your guesses helped me get to the next step anyway. Dave |
|
|
Well that was a bust. I fixed the situation where it was using the wrong database version and I still get the same exception thrown and the same odd sequencing. What would make the execution jump from line 57 (assignment from a call to UnitOfWork.Factories.FirstOrDefault()) to line 45 (if statement and outside of loop)? That makes no sense to me unless the code was corrupted somehow. There have been no changes to the implementation of this property, but I did add another bit field to the Factories table. That is the only change made to this area of the code as far as I know. It also works perfectly on the default branch of code for this project. I'm just looking for a little insight, as I don't believe this is a bug in your product at all. Thanks for any and all assistance you can provide... Dave |
|
|
First thought would be, is this running on multiple threads concurrently? If you enable to Debug Location toolbar you will see a drop down containing the list of active threads and this will change value if there are multiple threads active during debugging. A couple of other causes I can think of for this would be running in release mode or if your PDB files are out of sync with the source so the debugger is a bit confused and just picks up again at the next valid location. I would check you are in a debug build and then forcibly clean the solution and rebuild to check if that might be the problem.
|
|