Batch Jobs example not working

sql-server
Tags: #<Tag:0x00007f69fcab9740>

#1

I tried a quick exmaple of a catch with ContinueWith. When I run the following code, I get an error:
The name 'ContinueWith' does not exist in the current context.|

string batchId = BatchJob.StartNew(x =>
{
x.Enqueue(() => Console.WriteLine(“Job 1”));
x.Enqueue(() => Console.WriteLine(“Job 2”));

    });
    
    BatchJob.ContinueWith(batchId, x =>
    {
        x.Enqueue(() => Console.WriteLine("4..."));
    });

What am I missing

Update:

I see that method is obsolete. I changed it to AwaitBatch but still not working.

Now it is
``The name 'AwaitBatch ’ does not exist in the current context.|`


#2

Could you try restarting your Visual Studio and running the Build/Clean? Who reports that error, compiler or just Visual Studio? If you are using ReSharper, try clearing its cache. That method is defined in the Hangfire namespace, so should be already available, since you have no any errors caused by using the BatchJob class.


#3

No luck.


#4

The same behavior sometimes caused by VS or ReSharper’s cache, in this case builds are completed successfullly, i.e. the error is “illusory”. Could you post here the output of the build log to realize what happens during the build?


#5

Sorry, It does work. I did something stupid which I am embarrassed to say


#6

No worries, @John_Giblin! Several days ago I’ve spent 1.5 days trying to solve a problem that was already solved :flushed: