Hi,
I'm using the following code to determine which layers in my project might have a missing data source, so that my code doesn't crash later and I can present the user with a message to fix the problem. But when I call Layer.ConnectionStatus I get a 'NullReference' exception. Which I guess makes sense, since the layer is missing the data source. Am I just not using the ConnectionStatus properly??
foreach (Layer layer in map.GetLayersAsFlattenedList().OfType<FeatureLayer>())
{
if (layer.ConnectionStatus == ConnectionStatus.Broken)
{
ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("SOME KIND OF ERROR MESSSAGE");
}