async Task LoadExceptionList()
 {
     classes.Add("System.Exception");
     try {
         Microsoft.CodeAnalysis.Compilation compilation    = null;
         Microsoft.CodeAnalysis.ProjectId   dummyProjectId = null;
         if (IdeApp.ProjectOperations.CurrentSelectedProject != null)
         {
             compilation = await TypeSystemService.GetCompilationAsync(IdeApp.ProjectOperations.CurrentSelectedProject);
         }
         if (compilation == null)
         {
             //no need to unload this assembly context, it's not cached.
             dummyProjectId = Microsoft.CodeAnalysis.ProjectId.CreateNewId("GetExceptionsProject");
             compilation    = Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create("GetExceptions")
                              .AddReferences(MetadataReferenceCache.LoadReference(dummyProjectId, System.Reflection.Assembly.GetAssembly(typeof(object)).Location))                                                        //corlib
                              .AddReferences(MetadataReferenceCache.LoadReference(dummyProjectId, System.Reflection.Assembly.GetAssembly(typeof(Uri)).Location));                                                          //System.dll
         }
         var exceptionClass = compilation.GetTypeByMetadataName("System.Exception");
         foreach (var t in compilation.GlobalNamespace.GetAllTypes().Where((arg) => arg.IsDerivedFromClass(exceptionClass)))
         {
             classes.Add(t.GetFullMetadataName());
         }
         if (dummyProjectId != null)
         {
             MetadataReferenceCache.RemoveReferences(dummyProjectId);
         }
     } catch (Exception e) {
         LoggingService.LogError("Failed to obtain exceptions list in breakpoint dialog.", e);
     }
     await Runtime.RunInMainThread(() => {
         entryExceptionType.SetCodeCompletionList(classes.ToList());
     });
 }
        void LoadExceptionList()
        {
            classes.Add("System.Exception");
            if (IdeApp.ProjectOperations.CurrentSelectedProject != null)
            {
                var compilation    = TypeSystemService.GetCompilationAsync(IdeApp.ProjectOperations.CurrentSelectedProject).Result;
                var exceptionClass = compilation.GetTypeByMetadataName("System.Exception");
                foreach (var t in compilation.GlobalNamespace.GetAllTypes().Where((arg) => arg.IsDerivedFromClass(exceptionClass)))
                {
                    classes.Add(t.GetFullMetadataName());
                }
            }
            else
            {
                //no need to unload this assembly context, it's not cached.
                var dummyProjectId = Microsoft.CodeAnalysis.ProjectId.CreateNewId("GetExceptionsProject");
                var compilation    = Microsoft.CodeAnalysis.CSharp.CSharpCompilation.Create("GetExceptions")
                                     .AddReferences(MetadataReferenceCache.LoadReference(dummyProjectId, System.Reflection.Assembly.GetAssembly(typeof(object)).Location))                                               //corlib
                                     .AddReferences(MetadataReferenceCache.LoadReference(dummyProjectId, System.Reflection.Assembly.GetAssembly(typeof(Uri)).Location));                                                 //System.dll

                var exceptionClass = compilation.GetTypeByMetadataName("System.Exception");
                foreach (var t in compilation.GlobalNamespace.GetAllTypes().Where((arg) => arg.IsDerivedFromClass(exceptionClass)))
                {
                    classes.Add(t.GetFullMetadataName());
                }
                MetadataReferenceCache.RemoveReferences(dummyProjectId);
            }
            entryExceptionType.SetCodeCompletionList(classes.ToList());
        }
        MetadataReference LoadMetadataReference(string path)
        {
            var projectId = Microsoft.CodeAnalysis.ProjectId.CreateNewId("WebFormsTypeContext");
            var reference = MetadataReferenceCache.LoadReference(projectId, path);

            MetadataReferenceCache.RemoveReferences(projectId);

            return(reference);
        }