dispose project diagnostics subscription
This commit is contained in:
@@ -983,7 +983,7 @@ public class RoslynAnalysis(ILogger<RoslynAnalysis> logger, BuildService buildSe
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// This may not be perfect, as None Include="" seems to be returned here as one of the globs as Include, with no distinction of Compile vs None etc
|
||||
// TODO: Investigate getting the glob type (Compile, None, etc)
|
||||
var matchers = projectFileInfo.FileGlobs.Select(glob =>
|
||||
|
||||
@@ -51,6 +51,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
private bool _fileChangingSuppressBreakpointToggleEvent;
|
||||
private bool _settingWholeDocumentTextSuppressLineEditsEvent; // A dodgy workaround - setting the whole document doesn't guarantee that the line count stayed the same etc. We are still going to have broken highlighting. TODO: Investigate getting minimal text change ranges, and change those ranges only
|
||||
private bool _fileDeleted;
|
||||
private IDisposable? _projectDiagnosticsObserveDisposable;
|
||||
|
||||
[Inject] private readonly IdeOpenTabsFileManager _openTabsFileManager = null!;
|
||||
[Inject] private readonly RunService _runService = null!;
|
||||
@@ -151,6 +152,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
{
|
||||
_currentFile?.FileContentsChangedExternally.Unsubscribe(OnFileChangedExternally);
|
||||
_currentFile?.FileDeleted.Unsubscribe(OnFileDeleted);
|
||||
_projectDiagnosticsObserveDisposable?.Dispose();
|
||||
GlobalEvents.Instance.SolutionAltered.Unsubscribe(OnSolutionAltered);
|
||||
if (_currentFile is not null) _openTabsFileManager.CloseFile(_currentFile);
|
||||
}
|
||||
@@ -259,7 +261,7 @@ public partial class SharpIdeCodeEdit : CodeEdit
|
||||
var project = ((IChildSharpIdeNode)_currentFile).GetNearestProjectNode();
|
||||
if (project is not null)
|
||||
{
|
||||
project.Diagnostics.ObserveChanged()
|
||||
_projectDiagnosticsObserveDisposable = project.Diagnostics.ObserveChanged()
|
||||
.SubscribeAwait(async (innerEvent, ct) =>
|
||||
{
|
||||
var projectDiagnosticsForFile = project.Diagnostics.Where(s => s.FilePath == _currentFile.Path).ToImmutableArray();
|
||||
|
||||
Reference in New Issue
Block a user