private bool EnsureInitialized() { if (_isInitialized.HasValue) { return(_isInitialized.Value); } if (_project == null) { _logger.LogWarning("No project information. No source information will be available."); _isInitialized = false; return(_isInitialized.Value); } try { _diaDataSource = (IDiaDataSource) new DiaDataSource(); _isInitialized = true; } catch (Exception ex) { _logger.LogWarning("Failed to create DIA DataSource. No source information will be available.", ex); _isInitialized = false; return(_isInitialized.Value); } // We have a project, and we successfully loaded DIA, so let's capture the symbols // and create a session. try { var context = new CapturingLoadContext(); var assemblyName = new AssemblyName(_project.Name); _project.Load(assemblyName, context); _assembly = Assembly.Load(assemblyName); _diaDataSource.loadDataFromIStream(new StreamWrapper(context.Symbols)); _diaDataSource.openSession(out _diaSession); } catch (Exception ex) { _logger.LogWarning("Failed to load symbols. No source information will be available.", ex); _isInitialized = false; return(_isInitialized.Value); } try { _assemblyData = FetchSymbolData(_diaSession); } catch (Exception ex) { _logger.LogWarning("Failed to read symbols. No source information will be available.", ex); _isInitialized = false; return(_isInitialized.Value); } _isInitialized = true; return(_isInitialized.Value); }
private bool EnsureInitialized() { if (_isInitialized.HasValue) { return _isInitialized.Value; } if (_project == null) { _logger.LogWarning("No project information. No source information will be available."); _isInitialized = false; return _isInitialized.Value; } try { _diaDataSource = (IDiaDataSource)new DiaDataSource(); _isInitialized = true; } catch (Exception ex) { _logger.LogWarning("Failed to create DIA DataSource. No source information will be available.", ex); _isInitialized = false; return _isInitialized.Value; } // We have a project, and we successfully loaded DIA, so let's capture the symbols // and create a session. try { var context = new CapturingLoadContext(); _project.Load(context); _diaDataSource.loadDataFromIStream(new StreamWrapper(context.Symbols)); _diaDataSource.openSession(out _diaSession); } catch (Exception ex) { _logger.LogWarning("Failed to load symbols. No source information will be available.", ex); _isInitialized = false; return _isInitialized.Value; } try { _assemblyData = FetchSymbolData(_diaSession); } catch (Exception ex) { _logger.LogWarning("Failed to read symbols. No source information will be available.", ex); _isInitialized = false; return _isInitialized.Value; } _isInitialized = true; return _isInitialized.Value; }