dotnet / dotnet/aspnetcore

AddAzureWebAppDiagnostics throws an exception if used in combination with azure webapp zip deploy

Open
#53,901 4 comments 0 reactions 0 assignees View on GitHub
area-networking
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 10h
Merged PRs (30d)
281

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues
- This is to reopen an existing issue that was closed prematurely: https://github.com/dotnet/aspnetcore/issues/32964

### Describe the bug

We're still seeing exceptions, even with a newer version of the logging dependency

```
System.IO.FileNotFoundException: Error reading the C:\home\site\diagnostics\ directory.
?, in void FileSystemWatcher.StartRaisingEvents()
?, in void FileSystemWatcher.StartRaisingEventsIfNotDisposed()
?, in void FileSystemWatcher.set_EnableRaisingEvents(bool value)
?, in void PhysicalFilesWatcher.TryEnableFileSystemWatcher()
?, in IChangeToken PhysicalFilesWatcher.CreateFileChangeToken(string filter)
...
(4 additional frame(s) were not displayed)

System.AggregateException: One or more errors occurred.
?, in void CancellationTokenSource.ExecuteCallbackHandlers(bool throwOnFirstException)
?, in void PhysicalFilesWatcher._cancelTokenSource(object state)
?, in void Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)

System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
```

### Expected Behavior

We don't expect exceptions to be raised in accessing this directory

### Steps To Reproduce

* Run a dotnet 6 app service with deployment slots
* Deploy an artifact to Azure App Service with:

```
az webapp deployment source config-zip --resource-group {{rg}} --name {{appname}} --src artifact.zip --slot {{slotname}}
```

### Exceptions (if any)

```
System.IO.FileNotFoundException: Error reading the C:\home\site\diagnostics\ directory.
?, in void FileSystemWatcher.StartRaisingEvents()
?, in void FileSystemWatcher.StartRaisingEventsIfNotDisposed()
?, in void FileSystemWatcher.set_EnableRaisingEvents(bool value)
?, in void PhysicalFilesWatcher.TryEnableFileSystemWatcher()
?, in IChangeToken PhysicalFilesWatcher.CreateFileChangeToken(string filter)
...
(4 additional frame(s) were not displayed)

System.AggregateException: One or more errors occurred.
?, in void CancellationTokenSource.ExecuteCallbackHandlers(bool throwOnFirstException)
?, in void PhysicalFilesWatcher._cancelTokenSource(object state)
?, in void Task.ExecuteWithThreadLocal(ref Task currentTaskSlot, Thread threadPoolThread)

System.AggregateException: A Task's exception(s) were not observed either by Waiting on the Task or accessing its Exception property. As a result, the unobserved exception was rethrown by the finalizer thread.
```

### .NET Version

6.0.418

### Anything else?

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the failure with AddAzureWebAppDiagnostics, a deployment slot, and the documented az webapp deployment source config-zip command. Trace the diagnostics directory access associated with the reported PhysicalFilesWatcher exception; done means zip deployment no longer raises the FileNotFoundException or unobserved aggregate exception.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
cloud, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.