Note that there are some explanatory texts on larger screens.

plurals
  1. POLeft outer join with null LINQ exception with Guids
    text
    copied!<p>I am trying to do a left outer join with null in linq over a List, so if I have one list with {1,2,3,4} and other with {1,2,3,5}, I want the {4}.</p> <p><img src="https://i.stack.imgur.com/qWeD6.png" alt="enter image description here"></p> <pre><code>IEnumerable&lt;AlertChangeSet&gt; listToClear = from a in AlertsCached join b in loadedAlerts on a.AlertId equals b.AlertId into c from b in c.DefaultIfEmpty() select new AlertChangeSet() { AlertId = b.AlertId == Guid.Empty ? a.AlertId : Guid.Empty }; if (listToClear.Any()) { foreach (AlertChangeSet alertChangeSet in listToClear) { Guid a = alertChangeSet.AlertId; //SystemMonitoringService.ClearAlertAsync(alertChangeSet.AlertId.ToString(), null); } } </code></pre> <p>When I run this code, I get this exception:</p> <blockquote> <p>Test method Tgw.Systems.Alerting.Server.Test.ConfigurationTests.UpdateCacheWith2recordsSameIdWorking threw exception: System.NullReferenceException: Object reference not set to an instance of an object. at Tgw.Wcs.Alerting.MonitoringAddIn.Oms.Wcf.OmsWcfSystemMonitor.b__c(&lt;>f__AnonymousType0<code>2 &lt;&gt;h__TransparentIdentifier2, AlertChangeSet b) in OmsWcfSystemMonitor.cs: line 255 at System.Linq.Enumerable.&lt;SelectManyIterator&gt;d__31</code>3.MoveNext() at Tgw.Wcs.Alerting.MonitoringAddIn.Oms.Wcf.OmsWcfSystemMonitor.UpdateAlertsFromCache(IList`1 loadedAlerts) in OmsWcfSystemMonitor.cs: line 275 at Tgw.Systems.Alerting.Server.Test.ConfigurationTests.UpdateCacheWith2recordsSameIdWorking() in ConfigurationTests.ServerCoreTests.cs: line 243</p> </blockquote> <p>I think the problem is the Guid!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload