tags:

views:

302

answers:

1

Here's the problem. The code below works fine on my development PC, but when I deployed the app, it crashes.

Here is the lines of code that are relvant

Private TdsTypesList As List(Of TDS_Type)

...

TdsTypesList = (From tt In db.TDS_Types Select tt).ToList

This is the error I get

Exception Source: Anonymously Hosted DynamicMethods Assembly Exception Type: System.Security.VerificationException Exception Message: Operation could destabilize the runtime. Exception Target Site: Read_TDS_Type Object reference not set to >an instance of an object.

I have many queries that are using linq, and none of them throw any errors. The set of data is not very large either, less that 100 rows. I dont know if I have any other queries that do not have where statements in them that work.

Running .net 3.5 without sp1 on the client machine, although I am running sp1 on my development PC. looking for a solution that doesn't require sp1 to be installed.

Edit Code breaks on the second line when remote debugging.

I looked over http://stackoverflow.com/questions/378895/operation-could-destabilize-the-runtime and tried the following, with the same error.

  TdsTypesList = tl.OfType(Of TDS_Type)().ToList

I finally found a dirty workaround. Instead of pulling all of columns from that table, I was able to re-write the query to omit 1 column. This returns an object of anonymous type, and I can use that object. I still would like to know what causes this though.

A: 

I'm not sure it would help, but you could change all the referenced DLLs to be copied locally, so it would use the local versions instead of the client ones, which may or may not be causing the exception.

Paulo Santos
No effect here. Still crashes
Aaron M