Skip to content
This repository has been archived by the owner on Oct 12, 2023. It is now read-only.

BulkExecutor in .net Core console application exits without error #64

Open
Joehannus opened this issue Sep 2, 2019 · 3 comments
Open

Comments

@Joehannus
Copy link

I'm using the bulk executor in a .net Core console application to perform updates and for some reason it just exits unexpectedly after the call of BulkUpdateAsync, without any error information. I've used the examples for the .net framework version, presuming that it's basically the same logically, when using .net Core.

Are there any examples out there using .net standard, or core. Including how to configure logging for the bulkexecutor class? Currently I've implemented a .net core console application, using serilog for logging.

@Joehannus
Copy link
Author

Joehannus commented Sep 3, 2019

To be more precise - regarding the fact that the console application just exits unexpectedly - I had put a try catch statement around the BulkUpdateAsync statment with two catch blocks, just as in the example (with a DocumentClientException and a Exception respectively),. After the BulkUpdateAsync statment a log statement follows - this is never reached however. Neither is either of the catch blocks reached. The console application just stops.

I've noticed in the output window the following statements b.t.w.:
Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : Sorting 100 update items into 1 partition buckets
Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : Creating mini batches within each partition bucket
Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : partitionRangeId = 0 currentMiniBatchSize = 18252 maxMiniBatchSize = 220201 currentMiniBatchItemCount = 100
Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : Beginning bulk update within each partition bucket

Is there a minimum that you can have for a batch. I wanted to test with 100 records first, to see if everything works correctly. But that doesn't explain why the console application would just exit, without reaching one of the catch blocks.

I've also tried to force a break by using the Exception Settings tab to force breaks on all Common Language Runtime Exceptions (and later on all exceptions. But nothing happens then either.

@Joehannus
Copy link
Author

Joehannus commented Sep 4, 2019

I solved this myself - I replaced the await statement with a synchrounous call by getting the Result value from the BulkUpdateAsync statement. By doing this the console application doesn't just exit but after having performed the BulkUpdateStatement the next statement (being the logger statement) is executed.

This is of course just a work around, but it seems the .net core version has an error in the asynchronous execution of the method somewhere. Which should be looked into and fixed imo.

@Joehannus
Copy link
Author

I've managed to solve the issue with the getting the tracing statements in the BulkExecutor b.t.w.

As I've mentioned - I've used SeriLog as an extra logging framework. It also has a TraceListener - I just had to attach the Serilog Logger to the interface of the BulkExecutor and attached the logger to the seriloglistener like thus:

        var listener = new SerilogTraceListener.SerilogTraceListener(Log.Logger.ForContext<IBulkExecutor>());
        Trace.Listeners.Add(listener);

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant