I am using share point 2010, and using LINQ which is generated by SPMETAL.EXE. I am facing a weird issue which is mentioned below by sequence:
1: Inserted a new item (XX) in list (Listname) 2: On insertion a Workflow get starts and the item (XX) status becomes "In Progress" in ALL Items window. 3: If I access this row with LINQ, it threw an exception "Specified cast not valid" [NullReferenceException: Object reference not set to an instance of an object.] Microsoft.Office.Server.WebControls.MetaDataNavTree.OnUnload(EventArgs e) +40 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +153 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +306 System.Web.UI.Page.UnloadRecursive(Boolean dispose) +23 System.Web.UI.Page.ProcessRequestCleanup() +54 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11045194 System.Web.UI.Page.ProcessRequest() +91 System.Web.UI.Page.ProcessRequest(HttpContext context) +240 ASP.FORM_ASPX__331913002.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\ccd70a06\451bebbc\App_Web_form.aspx_-331913002.nurxfpml.0.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171
4: While If I access items on which their is no entry for work flow (i.e. when I didnt start my work flow from work flow settings) It works fine.
THE ABOVE MENTIONED ISSUE IS NOT WITH OBJECT MODEL APPROACH. THAT WORKS FINE. I THINK ISSUE IS WITH LINQ
PLEASE HELP TO GET RID OF THIS ISSUE. AS I CANT SWITCH FROM LINQ.