NullReference exception when running a Console App (with WebJob SDK 2.0.0-alpha-10349 bits) locally and disconnected from Azure Storage
See original GitHub issueHi Guys,
I get a NullReferenceException when running a Console App (with WebJob SDK 2.0.0-alpha-10349 bits) locally and disconnected from Azure Storage.
JobHostConfiguration config = new JobHostConfiguration();
config.HostId = Guid.NewGuid().ToString("n");
config.DashboardConnectionString = null;
config.StorageConnectionString = null;
config.UseTimers();
JobHost host = new JobHost(config);
host.RunAndBlock();
I have a Functions.cs with the following:
public static void TimerJob([TimerTrigger("00:00:05")] TimerInfo timerInfo,
TextWriter log)
{
log.WriteLine("Scheduled job fired!");
}
From some of the comments I read in this pull request (PR) here (https://github.com/Azure/azure-webjobs-sdk/pull/639), I guess you saw it comming.
Any thoughts on how to deal with this? I have some ideas and I would be glad to contribute with a proper fix + PR.
Cheers, Carlos Sardo
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Console App running as Web Job not able to access Azure ...
I have a simple part of a .NET console application running as a Web Job under an App Service. It checks if a...
Read more >Why am I getting exception Azure WebJobs SDK ...
The problem is that when I run this locally, I get the exception below. System. InvalidOperationException was unhandled HResult=-2146233079 ...
Read more >Turning a console app into a long-running Azure WebJob
It uses the resources of the machine the WebApp is running on. WebJobs can be triggered (eg. when a Blob is created in...
Read more >Converting Azure WebJobs to .NET Core
Cumbersome, but this works! Converting Program.cs. WebJob is just ordinary console application that is running in Azure WebJobs host. Looking at ...
Read more >Logging to Application Insights from Azure App Service ...
When updating a few Azure WebJobs to a new version of the WebJobs SDK, I had to rewrite the way they logged data....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
TimerTrigger requires a storage account to operate (it stores schedule information and singleton lock info in blob storage). While the null ref exception you mention might not be proper error handling (we can fix), I don’t expect what you’re trying to do above to work.
While certain triggers like timer could be made to work conditionally in some cases w/o storage, there would be caveats (e.g. the singleton lock is how we ensure only a single instance of the schedule is running across scaled out instances) it hasn’t been a priority because most users of the SDK are using storage.
This is a really old issue against the 2.0.0-alpha prerelease. SDK is now at 2.3.0. I don’t think this is an issue anymore for 2.3.0. For v3 (3.0.3) the startup model has completely changed (.NET Core) and again, I don’t think we have this issue anymore.
If it turns out this is still an issue we can reopen.