title: left join linq is not working
body: <p>i have this linq query</p>
  
  <pre><code>var x = (from d in detalle
  from n in nlj.DefaultIfEmpty()
  join nd in nuevodetalle
  on new { d.ope_idsku ,d.ope_tipo } equals new {nd.ope_idsku ,nd.ope_tipo }into nlj
  from n in nlj.DefaultIfEmpty()
  
  
  select new { d, n } ).ToList();
  </code></pre>
  
  <p>now if i do it</p>
  
  <pre><code>x[0].d==null this return false
  x[0].n==null this return false
  x[1].d==null this return false
  x[1].n==null this fails, why? 
  </code></pre>
  
  <p>my real select is not {d,n } it is</p>
  
  <pre><code>select new ope_detalle_autoventa()
  {
  CreatedOn = d.CreatedOn,
  ModifiedOn = d.ModifiedOn,
  ope_autoventaid = d.ope_autoventaid,
  ope_Codope = d.ope_Codope,
  ope_detalle_autoventaId = (tiene_nuevo_primarykey) ? Guid.NewGuid() : d.ope_detalle_autoventaId,
  ope_entregado = (d.ope_entregado - (n != null ? n.ope_entregado : 0)),
  ope_envase = d.ope_envase,
  ope_estado = d.ope_estado,
  ope_icono = d.ope_icono,
  ope_idsku = d.ope_idsku,
  ope_name = d.ope_name,
  ope_pedido = d.ope_pedido,
  ope_precioV = d.ope_precioV,
  ope_prestamo = d.ope_prestamo,
  ope_promocion = d.ope_promocion,
  ope_skuid = d.ope_skuid,
  ope_tipo = d.ope_tipo,
  ope_autoventaidTarget = d.ope_autoventaidTarget,
  ope_skuidTarget = d.ope_skuidTarget,
  Ope_NumVenta = d.Ope_NumVenta,
  ope_descuento = d.ope_descuento,
  ope_cancelado = d.ope_cancelado,
  ope_folio = d.ope_folio,
  ope_cantcanc = 0,
  ope_estimado = "0"
  }
  </code></pre>
  
  <p>but this get fails same reason <code>x[1].n==null</code> fails, (that i believe),
  i believe this fails at this line</p>
  
  <pre><code>ope_entregado = (d.ope_entregado - (n != null ? n.ope_entregado : 0)),
  </code></pre>
  
  <p>however
  this query doesn't fail</p>
  
  <pre><code>var restaragregados = (from r in resultadoregresar
  group new { r.ope_entregado } by new { r.ope_idsku } into agrupacion
  select new { agrupacion.Key.ope_idsku, entregadototal=(agrupacion.Sum (x=&gt; x.ope_entregado) ) }
  );
  List&lt;ope_detalle_autoventa&gt; nuevodetalle = (from d in detalle
  join c in cargainventario
  on d.ope_idsku equals c.ope_idsku into clj
  from c in clj.DefaultIfEmpty()
  join r in restaragregados on
  d.ope_idsku equals r.ope_idsku into rlj
  from r in rlj.DefaultIfEmpty ()
  where (c!=null?c.ope_carga == cargausada:c==null  )
  &amp;&amp; (d.ope_entregado &gt; ((c==null ?0:c.ope_disponibles ) - (r==null?0:r.entregadototal)))
  &amp;&amp; d.ope_tipo ==tipos[i]
  select new ope_detalle_autoventa()
  {
  ModifiedOn = DateTime.Now,
  ope_autoventaid = ope_autoventaid,
  ope_detalle_autoventaId = d.ope_detalle_autoventaId,
  ope_entregado = (d.ope_entregado - ((c== null ? 0 : c.ope_disponibles) - (r == null ? 0 : r.entregadototal))),
  ope_envase = d.ope_envase,
  ope_estado = d.ope_estado,
  ope_icono = d.ope_icono,
  ope_idsku = d.ope_idsku,
  ope_name = d.ope_name,
  ope_pedido = 0,//0 por que no pidio de esta carga sino de la que ya se gastó
  ope_precioV = d.ope_precioV,
  ope_prestamo = d.ope_prestamo,
  ope_promocion = d.ope_promocion,
  ope_skuid = d.ope_skuid,
  ope_tipo = d.ope_tipo,
  ope_autoventaidTarget = d.ope_autoventaidTarget,
  ope_skuidTarget = d.ope_skuidTarget,
  Ope_NumVenta = d.Ope_NumVenta,
  ope_descuento = d.ope_descuento,
  ope_cancelado =d.ope_cancelado ,
  CreatedOn =DateTime.Now ,
  ope_Codope =d.ope_Codope ,
  ope_folio =d.ope_folio,
  ope_cantcanc =0,
  ope_estimado="0"
  }
  ).ToList();
  </code></pre>
  
  <p>i rename n by c  and i change </p>
  
  <pre><code>on new { d.ope_idsku ,d.ope_tipo } equals new {nd.ope_idsku ,nd.ope_tipo }into nlj
  by d.ope_idsku equals nd.ope_idsku into nlj
  </code></pre>
  
  <p>but i get the same error.</p>
  
  <p><img src="https://i.stack.imgur.com/wxYw2.png" alt="enter image description here"></p>