Skip to content

Fix race in event subscription in file watcher#82289

Merged
dibarbet merged 1 commit into
dotnet:mainfrom
dibarbet:fix_null_ref_file_watcher
Feb 5, 2026
Merged

Fix race in event subscription in file watcher#82289
dibarbet merged 1 commit into
dotnet:mainfrom
dibarbet:fix_null_ref_file_watcher

Conversation

@dibarbet

@dibarbet dibarbet commented Feb 4, 2026

Copy link
Copy Markdown
Member
2026-02-04T23:22:30.633Z [DEBUG] LSP csharp server for C:\Users\dabarbet\source\repos\aspire: [stderr] Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching.DefaultFileChangeWatcher.FileChangeContext.Microsoft.CodeAnalysis.LanguageServer.HostWorkspace.FileWatching.DefaultFileChangeWatcher.IEventRaiser.RaiseEvent(Object sender, FileSystemEventArgs e) in /_/src/LanguageServer/Microsoft.CodeAnalysis.LanguageServer/HostWorkspace/FileWatching/DefaultFileChangeWatcher.FileChangeContext.cs:line 60
   at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(WatcherChangeTypes changeType, ReadOnlySpan`1 name)
   at System.IO.FileSystemWatcher.ParseEventBufferAndNotifyForEach(ReadOnlySpan`1 buffer)
   at System.IO.FileSystemWatcher.ReadDirectoryChangesCallback(UInt32 errorCode, UInt32 numBytes, AsyncReadState state)
   at System.IO.FileSystemWatcher.<>c.<StartRaisingEvents>b__84_0(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadPoolTypedWorkItemQueue.System.Threading.IThreadPoolWorkItem.Execute()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading.PortableThreadPool.WorkerThread.WorkerThreadStart()
   at System.Threading.Thread.StartCallback()

@dibarbet dibarbet requested a review from a team as a code owner February 4, 2026 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants