I have a LINQ query with 3 joins and a grouping operation that is throwing a null reference error. In the below query (I'm sorry for the length) if you skip to the 'eDTK_PDP_Description' field, it's that one that it causing the problem. I realize that I have the DefaultIfEmpty specification for the last join but I thought if I assign a value to the field from that join if it's null that should solve the problem. What am I doing wrong here? Thanks!
Dim UpdateSiebelPDP1 = From j In ( _
From PDP In SiebelMultPDPDescNoNull _
Group Join Siebel In ProdBase _
On PDP.Siebel_PDP_Code Equals Siebel.Siebel_PDP_Code _
Into g = Group _
From Result In g _
Group Join EDTK In eDTKBase _
On PDP.Siebel_PDP_Code Equals EDTK.eDTK_PDP_Code _
Into h = Group _
From Result2 In h _
Group Join EDTK2 In EDTKPDPOneDescDet _
On PDP.Siebel_PDP_Code Equals EDTK2.PDP_Description _
Into i = Group _
From Result3 In i.DefaultIfEmpty _
Select Result.Siebel_PLI, _
Result.Siebel_PDP_Code, _
Update_DAD_Flag = If(Result.Siebel_DAD_Flag Is Nothing, "Yes", "No"), _
System = "Siebel", _
PDD_PDP_Description = If(Result2.PDD_PDP_Description Is Nothing, _
"", Result2.PDD_PDP_Description), _
Siebel_PDP_Description = "Multiple", _
eDTK_PDP_Description = If(Result3.PDP_Description Is Nothing, _
"Multiple", Result3.PDP_Description)) _
Group j By j.Siebel_PLI, _
j.Siebel_PDP_Code, _
j.Update_DAD_Flag, _
j.System, _
j.PDD_PDP_Description, _
j.Siebel_PDP_Description, _
j.eDTK_PDP_Description _
Into k = Group _
Select New With { _
Siebel_PLI, _
Siebel_PDP_Code, _
Update_DAD_Flag, _
System, _
PDD_PDP_Description, _
Siebel_PDP_Description, _
eDTK_PDP_Description}