While editing and changing Razor partials/views and applying changes in Rider, I notice that my changes are not being applied only to find that the watcher had crashed with this exception:
Project file changes detected at 19:04:40.668
⏵ Updated .\Views\Partials\_PlatformHeader.cshtml at 19:04:40.668
Project file changes detected at 19:04:40.669
⏵ Updated .\Views\Partials\_PlatformHeader.cshtml at 19:04:40.669
Project file changes detected at 19:04:40.669
⏵ Updated .\Views\Partials\_PlatformHeader.cshtml at 19:04:40.669
Project file changes detected at 19:04:40.669
⏵ Updated .\Views\Partials\_PlatformHeader.cshtml at 19:04:40.669
⏵ Generated .\wwwroot\stylesheets\application.css (28.3kb, +base, +120 utilities) in 0.060s
Completed build of 1 CSS file (28.3kb) in 0.061s
Watching; Press ESC to Exit
Unhandled exception. System.ArgumentException: The index is equal to or greater than the length of the array, or the number of elements in the dictionary is greater than the available space from index to the end of the destination array.
at System.Collections.Concurrent.ConcurrentDictionary`2.System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<TKey,TValue>>.CopyTo(KeyValuePair`2[] array, Int32 index)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source, Int32& length)
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.OrderedEnumerable`1.GetEnumerator()+MoveNext()
at Argentini.Sfumato.Program.Main(String[] args) in /Users/magic/Developer/Argentini.Sfumato/Argentini.Sfumato/Program.cs:line 195
at Argentini.Sfumato.Program.<Main>(String[] args)
I am still not able to pinpoint exactly what causes this issue or how to reliably reproduce the issue. I would imagine it is caused when the .NET process is using the file on save.