• J
    Defer the initialization of a VisualStudioWorkspace until necessary · 5e1831af
    Jason Malinowski 提交于
    Previously, when a VisualStudioWorkspace was constructed we were
    doing a bunch of work in the constructor talking to the UI thread. This
    was dangerous because we might get composed on a background thread.
    This moves the dangerous initialization until we're creating a project
    when we know we have a UI thread available.
    
    In this refactoring I moved the project tracker and a few other fields
    into a private class so it's more obvious what's dangerous to touch.
    I also do a pass through all consumers of the property and either
    update it to use the deferred state directly (because we're only
    consuming projects, so it's fine if we don't have anything) or to the
    factory method if we actually are creating projects.
    
    This does temporarily regress the ability to create projects on
    background threads, but it was unclear if that was generally safe to
    start with.
    5e1831af
AnalyzerItemSource.cs 8.7 KB