Trigger GC after disposing ViewModel

This commit is contained in:
qhy040404
2024-04-29 18:47:49 +08:00
parent 04c3498b54
commit 71ac87539f
2 changed files with 1 additions and 1 deletions

View File

@@ -104,6 +104,7 @@ internal class ScopedPage : Page
// Dispose the scope
pageScope.Dispose();
GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, true);
}
}
}

View File

@@ -22,7 +22,6 @@ internal sealed partial class ScopedPageScopeReferenceTracker : IScopedPageScope
public IServiceScope CreateScope()
{
GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, true);
IServiceScope currentScope = serviceProvider.CreateScope();
// In case previous one is not disposed.