You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that the GlobalSettings is designed in a way where it doesn't clean up properly. The tests for it fail intermittently:
Unhandled exception. System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GlobalSettings'.
at Microsoft.TemplateEngine.Edge.BuiltInManagedProvider.GlobalSettings.GetInstalledTemplatePackagesAsync(CancellationToken cancellationToken) in /_/src/Microsoft.TemplateEngine.Edge/BuiltInManagedProvider/GlobalSettings.cs:line 70
at Microsoft.TemplateEngine.Edge.UnitTests.GlobalSettingsTests.<>c__DisplayClass3_0.<<TestFileWatcher>b__0>d.MoveNext() in /_/test/Microsoft.TemplateEngine.Edge.UnitTests/GlobalSettingsTests.cs:line 54
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
at System.Threading.QueueUserWorkItemCallback.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
Creates 2 instances of GlobalSettings that point to the same settings file.
Sets a SettingsChanged event for the second instance using a TaskCompletionSource that retrieves an installed template package
The first instance creates template package data and sets it
The test waits until the TaskCompletionSource finishes, asserts that it didn't time out, and checks to see that the template package data from the task is correct
Now, somehow, the error above seems to indicate that the second instance of GlobalSettings no longer exists when the SettingsChanged event is fired. This instance is scoped to the lifetime of the test method. Maybe the event is fired a second time? Maybe there is something else going on with Dispose that I'm unaware of?
This happened on 2 different PRs that I've observed so far. It happened (in both) on the Linux Debug job for the PR.
Unhandled exception. System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'GlobalSettings'.
at Microsoft.TemplateEngine.Edge.BuiltInManagedProvider.GlobalSettings.GetInstalledTemplatePackagesAsync(CancellationToken cancellationToken) in /_/src/Microsoft.TemplateEngine.Edge/BuiltInManagedProvider/GlobalSettings.cs:line 70
at Microsoft.TemplateEngine.Edge.UnitTests.GlobalSettingsTests.<>c__DisplayClass3_0.<<TestFileWatcher>b__0>d.MoveNext() in /_/test/Microsoft.TemplateEngine.Edge.UnitTests/GlobalSettingsTests.cs:line 54
--- End of stack trace from previous location ---
at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__128_1(Object state)
at System.Threading.QueueUserWorkItemCallback.Execute()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
at System.Threading.Thread.StartCallback()
Summary
It seems that the
GlobalSettings
is designed in a way where it doesn't clean up properly. The tests for it fail intermittently:If you look at the TestFileWatcher test, to explain what it does in English:
SettingsChanged
event for the second instance using a TaskCompletionSource that retrieves an installed template packageNow, somehow, the error above seems to indicate that the second instance of GlobalSettings no longer exists when the
SettingsChanged
event is fired. This instance is scoped to the lifetime of the test method. Maybe the event is fired a second time? Maybe there is something else going on with Dispose that I'm unaware of?This happened on 2 different PRs that I've observed so far. It happened (in both) on the Linux Debug job for the PR.
Logs
The text was updated successfully, but these errors were encountered: