-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Description
Problem
The FileSystemScheduleMonitor
c'tor will throw an ArgumentOutOfRangeException
when the following conditions are met:
- The current working directory contains the string "jobs".
- The
HOME
environment variable exists
Steps to reproduce
- Create a WebJobs application
- Add a package reference to
Microsoft.Azure.WebJobs.Extensions
v5.0. - Call
AddTimers()
on the WebJobs Host Builder. - Build and run the Host to make sure it works without error.
- Rename the directory containing our app assembly to "WebJobs" (or "xxxxjobsxxxx").
- If on Windows, create a non-empty environment variable named "HOME".
cd
into the "WebJobs" folder from step 4 and launch the app (e.g.dotnet testapp.dll
).
The app should throw an ArgumentOutOfRangeException
on startup.
Workarounds
- Change the application's working directory to somewhere else, such as the Temp folder.
- Replace the registered
ScheduleMonitor
with one which uses a different working folder.
After calling.AddTimers()
, register a replacementScheduleMonitor
usingusing Microsoft.Azure.WebJobs.Extensions.Timers; ... services.AddSingleton<ScheduleMonitor>(_ => new FileSystemScheduleMonitor(Path.GetTempFolder()));
Discussion
I found this when using a linux container based on mcr.microsoft.com/dotnet/aspnet:9.0
.
An easy solution to the crash is to change line 51 to if (start > 0 && end > start)
, but I'm not sure that addresses the larger issue of assuming that the app is running out of TEMP directory.
Version Info
- .NET SDK 9.0.102
- Microsoft.Azure.WebJobs 3.0.41
- Microsoft.Azure.WebJobs.Extensions 5.0
- TargetFramework: net9.0
Metadata
Metadata
Assignees
Labels
No labels