New to site?


Lost password? (X)

Already have an account?


(X)

Presents

#CSHARPCON20

The C# Corner Annual Conference 2020 is a three-day annual event for software professionals and developers.

3
DAYS
72
SPEAKERS
65
SESSIONS

Magnus Mårtensson
Microsoft Regional Director, Azure MVP, CEO Loftysoft

Avirag Jain
Director & CTO R Systems

Mahesh Chand
Founder C# Corner, CEO Mindcracker

Chris Gali
CEO & Co-Founder Graphite

Subinder Khurana
Chief Architect StoryProcess, Founder NASSCOM DeepTech Club

Bryan Rishforth
Investor, Chairman Graphite

Bryn Everson
Director Biz Dev Graphite

Raj Tiwari
Digital Transformation Leader, Futurist and Visionary

Joseph Guadagno
Microsoft MVP, Lead Quicken Loans

Nikita Sachdev
Entrepreneur, Blockchain Enthusiast & Advisor, Social Media Influencer

Doug Wagner
COO & Founder Adapt Technical Group

Ritesh Modi
Architect, Senior Evangelist, Cloud Architect

Crystal Wenrick
Director Communications Mindcracker

Allen O’Neill
Microsoft MVP, Consulting Engineer/Architect

Praveen Kumar
CEO MCN Solutions

Chris Love
Founder Love2Dev, Microsoft MVP, Author

Sanjay Vyas
Microsoft Regional Director, Microsoft MVP, Founder & CEO SkillLabs Technologies

Veena Sarda
Deep Learning Consultant, Author

Sekhar Srinivasan
C# Corner MVP, Microsoft Certified Trainer, Pluralsight Author

Lalit Bansal
Founder & CEO - EIY SYS

Navdeep Garg
CEO Revinfotech

Prakash Tripathi
Tech Manager/Leader, Microsoft MVP, Blogger

Bhavna Jain
Breakthrough Consultant

Naveen Sharma
Enterprise Architect, Leadership Coach, Author

Vidya Vrat Agarwal
Principal Architect, Microsoft MVP, Author

Sheetal Agarwal
Founder Clownselors, Medical Clown, Trainer

Abhishek Kant
Founder GTM Catalyst

Vishnu Saran
Founder & CEO VoiceQube

Sandeep Soni
Founder & CEO Deccansoft, Microsoft Certified Trainer

Parveen Malik
AVP InfoSec & Vulnerability Management, Information Security Expert

Nitin Pandit
Microsoft MVP, Developer Evangelist, Author

Niloshima Srivastava
C# Corner MVP, Tech Architect, Trainer, Blogger

Bala Chirtsabesan
Senior Software Engineer at Microsoft, Author

Manoj Mittal
Sr. Technical Architect, C# Corner MVP, Author

Chandni Di
Co-Founder Voice of Slum

Vithal Wadje
Technical Lead, Microsoft MVP, Author

Shivam Ahuja
Founder SkillCircle, Business Mentor

Chervine Bhiwoo
Solution Architect, Microsoft MVP, Author

Saurabh Jain
Vice President Paytm, Founder Fun2Do Labs, Author

Vinay Solanki
Head IoT at Lenovo, Founder IoT-NCR

Anshu kumari
Founder Blockchainkids, Inventor, Trainer

Amit Singal
CEO Startup Buddy

Dev Pratap
Co-Founder & CEO Voice of Slum

Amey Vartak
Technology Consultant, Full Stack Developer, C# Corner MVP, Author

Viswanatha Swamy
Principal Software Engineer, C# Corner MVP, Author

Sanket Verma
Research Engineer @ Ballistics (Forensics) and Chair, PyData Delhi

Sourabh Somani
Lead Developer, Microsoft MVP, Author

Abhishek Mishra
Software Architect, C# Corner MVP, Author

Siddharth Vaghasia
Technical Consultant, C# Corner MVP, Blogger

Bassam Alugili
Senior Software Specialist, Database Expert

S Ravi Kumar
Solution Architect, C# Corner MVP, Author

Sundaram Subramanian
Full Stack Developer, C# Corner MVP, Speaker

Deepesh Somani
Solution Architect, Microsoft MVP, Author

Debasis Saha
Technical Project Manager, C# Corner MVP, Blogger, Author

Vipul Jain
Software Architect, C# Corner MVP, Author

Akshay Patel
Technical Architect, Microsoft Certified Trainer, C# Corner MVP, Author

Stephen Simon
RPA Developer, Evangelist, Author

Vivek Sharma
Founder Kingster636, AR/VR Specialist

Jeetendra Gund
Technical Lead, C# Corner MVP, Author

Sujal Beniwal
AI Enthusiast, Student

M Viknaraj
Microsoft MVP, Azure Architect, Author

Prasham Sabadra
Software Architect, C# Corner MVP, Trainer, Author

Aakash Maurya
Senior Developer, C# Corner MVP, Speaker

Ankit Sharma
Senior Software Engineer, C# Corner MVP, Author

Mangesh Gaherwar
Team Lead, C# Corner MVP, Author

Viral Jain
Technical Consultant, C# Corner MVP, Author

Bhasker Das
Solution Architect, Evangelist

Manish Dwivedi
Associate Project Manager

Ck Nitin
Programmer, Author

Rohit Gupta
Technical Trainer, Author

Manish Tewatia
Full-stack Marketer, UX Designer

Bhavya Gaur
Technical Illustrator

Rohit Tomar
SEO/SMO Expert

Web Track

Cloud & Data Track

Dev Track

8am-9am

Registration & Breakfast

9am-10am

Future of Desktop Apps with JS (ElectronJs)

Nitin Pandit

Building Serverless Microservices Using Microsoft Azure

Vithal Wadje

Innovating RPA: A Robot for Every Person

Stephen Simon

10am-11am

Managing Cloud Storage Accounts using Logic Apps

Viknaraj Manogararajah

Data visualization using Python

Sekhar Srinivasan

Going Cross platform with AR Foundation

Vivek Sharma

11am-12pm

Keynote

12pm-1pm

Managing your Azure dependencies in ASP.NET Core apps using VS

Bala Chirtsabesan

Securing Applications on Intelligent Azure

Abhishek Mishra

Getting started with Blazor the Framework of Future

S Ravi Kumar

1pm-2pm

Lunch

2pm-2:45pm

Build Progressive Web Apps using Angular 9

Debasis Saha

Build and deploy to any platform using Azure DevOps

Chervine Bhiwoo

Deep Dive in Azure Service Bus

Akshay Patel

2:45pm-3:45pm

Build a Native Mobile Application using React Native and JavaScript

Joseph Guadagno

Making sense of Web Job, Web Job SDK and Functions in Azure

Prakash Tripathi

CloudFront Distribution in AWS

Viral Jain

3:45pm-4pm

Tea Break

4pm-4:30pm

Introduction to PowerBI

Aakash Maurya

Build Advanced SPFx solutions with React and Graph API

Siddharth Vaghasia

Build Business Intelligence Analyst (BIA) Skills

Sundaram Subramanian

4:30pm-5pm

Deep dive of Power Platform – AI BUILDER

Prasham Sabadra

Panel 1

What's new in SharePoint development

Vipul Jain

5pm-5:30pm

Build a SSO (Single Sign On) based Native JavaScript application with Microsoft Identity within 10 minutes

Manoj Mittal

Panel 2

Applications and working of AI

Veena Sarda

5:30pm-6pm

Deploying serverless API's with .Net core 3.0 on AWS & Azure

Amey Vartak

Panel 3

Blockchain with .NET Core (Ark)

Anshu Kumari

6pm-6:30pm

Closing Note & Prize Distribution

Dev Track

Cloud Track

Architecture Track

Emerging Tech Track

8am-9am

Registration & Breakfast

9am-10am

Creating Full-Stack Web Apps Using Server-Side Blazor

Ankit Sharma

Real time face recognition with MS Cognitive Services

Niloshima Srivastava

Building Scalable APIs with GraphQL

Jeetendra Gund

Future of development with AI and Blockchain

Navdeep Garg

10am-11am

Debugging Tips and Tricks with Visual Studio 2019

Joseph Guadagno

Azure Containers

Abhishek Kant

Enterprise Architecture

Naveen Sharma

Bot Framework - learn it fast and look like a boss!

Allen O’Neill

11am-12:30pm

Keynote

12:30pm-1:30pm

.Net Core & C# 8 Performance

David McCarter

Working with Azure kubernetes services

Ritesh Modi

Becoming an Architect

Vidyavrat Agarwal

Why Techies Need to Learn Product Management

Saurabh Jain

1:30pm-2:30pm

Lunch

2:30pm-3:30pm

Build a rules engine in .Net Core

Sanjay Vyas

Building CI and CD Pipeline using Azure DevOps

Sandeep Soni

Entity Framework Core - Tips and Tricks, Performance Optimization, and Tuning

Bassam Alugili

Hacking your way into Data Science

Sanket Verma

3:30-4:15pm

Speed up your .Net Core Website

Sourabh Somani

Azure

Magnus Mårtensson

Demystifying Open Distro for Elasticsearch

Suman Debnath

Future of Data

Shivam Ahuja

4:15pm-4:30pm

Tea Break

4:30pm-5:15pm

gRPC with C# and .Net Core

Mangesh Gaherwar

Panel 1

Essentials of Cloud security

Parveen Malik

Power platform and Dynamics 365

Deepesh Somani

5:15pm-6pm

Microservices - the gRPC Way

Viswanatha Swamy

Panel 2

Reserved

Reserved

6pm-6:30pm

Closing Note & Prize Distribution

Cooperative cancellation in TPL with CancellationTokenSource

When a long-running compute job, a slow database call, or a multi-stage data pipeline needs to stop, the .NET Task Parallel Library offers a clean way to ask politely rather than forcefully abort. Cooperative cancellation is built around a small set of types — most importantly CancellationTokenSource and CancellationToken — and once you understand the pattern, it slots naturally into everything from console utilities to cloud-hosted microservices. For developers shipping production code in Sydney, Melbourne, or anywhere else across Australia, mastering this pattern means writing software that responds gracefully to user input, timeouts, and shutdown signals without leaking threads or corrupting state.

At C# Corner Annual Conference 2020, sessions on asynchronous programming routinely highlight cancellation as one of the three pillars of robust async code, alongside configuration and exception handling. The pattern is easy to learn in five minutes and rewarding for years. The rest of this article walks through the mechanics, the practical patterns, and a few pitfalls that show up in real codebases serving Australian customers.

The vocabulary of cancellation in the .NET runtime

The .NET BCL exposes three types that work together. CancellationTokenSource is the trigger: it owns an internal state flag and produces tokens. CancellationToken is the lightweight value type handed out to consumers — task bodies, async methods, loops, HttpClient requests — that need to know whether to keep going. When IsCancellationRequested flips to true, every token sourced from that instance observes the change. CancellationTokenRegistration is the third player, returned when a token subscribes to a callback, allowing you to detach the hook later.

A token is a value type but the source it points to is a reference type, so tokens can be passed by value into methods, stored in fields, or returned from properties without ceremony. The source implements IDisposable, and disposing it cancels any outstanding operations and frees internal handles. In practice, almost every cooperative cancellation scenario looks the same: create a source, plumb a token into the work, check IsCancellationRequested or call ThrowIfCancellationRequested, and cancel from the owning context.

Long-running loops and the polite polling pattern

The simplest use of CancellationTokenSource for cooperative cancellation in TPL appears inside a long-running task. Imagine a worker that processes records from a queue in a loop. The loop body calls cts.Token.ThrowIfCancellationRequested() at the top of each iteration, and the surrounding method returns a Task that completes — or faults with OperationCanceledException — when the source is signalled.

public static async Task ProcessQueueAsync(ChannelReader<Job> reader, CancellationToken token)
{
    await foreach (var job in reader.ReadAllAsync(token))
    {
        token.ThrowIfCancellationRequested();
        await HandleAsync(job, token);
    }
}

The pattern works because every awaitable that accepts a CancellationToken honours it. Channel readers, HttpClient, Entity Framework Core queries, and most third-party libraries that target modern .NET will short-circuit themselves when a token is cancelled. This is what cooperative cancellation means: nothing is force-killed, the code itself chooses to stop.

Composing tokens with CreateLinkedTokenSource

Real systems often have more than one reason to cancel. A request might have its own token, the host shutdown might bring another, and a per-iteration timeout might bring a third. CancellationTokenSource.CreateLinkedTokenSource lets you combine several tokens into one. The composite token cancels when any of its parents cancels, and an optional filter delegate lets you decide whether a specific parent's signal should propagate or be ignored.

using var timeout = new CancellationTokenSource(TimeSpan.FromSeconds(30));
using var linked = CancellationTokenSource.CreateLinkedTokenSource(
    httpContext.RequestAborted, timeout.Token, appStopping.Token);

await longRunningOperation(linked.Token);

In an ASP.NET Core application hosted in a container in an AWS Sydney region, this is the canonical shape. The request token drops if the user navigates away, the application stopping token drops on graceful shutdown, and the timeout caps runaway work. The composite source is itself disposable, and disposing it does not affect the parents — only the link.

Threading, callbacks, and OperationCanceledException

Cancellation crosses thread boundaries safely. Cancelling a token from one thread signals all of its observers on whatever thread they happen to be running. If you register a callback via token.Register, that callback runs on the thread that called Cancel, which means it must be fast and non-blocking. Long work belongs in a separate task that you await separately.

When work stops because of cancellation, the right exception is OperationCanceledException (or its derived TaskCanceledException). Async methods that throw this exception automatically become cancelled tasks rather than faulted ones, and awaiting them does not surface the exception to the caller the way a fault would. For that reason, you usually want to rethrow or propagate the cancellation rather than swallow it, so the call chain can honour it consistently.

The standard idiom inside an async method is token.ThrowIfCancellationRequested() because it both checks the flag and throws the right exception type. Inside a synchronous helper or hot loop, you may prefer if (token.IsCancellationRequested) return; for performance, but only when the caller is prepared to translate that into a cancelled task itself.

Applying the pattern in Australian production services

Teams running .NET workloads on Azure Australia East or in on-prem data centres in Brisbane and Perth lean on cancellation heavily. A common pattern in fintech shops around the Sydney CBD is to wrap every outbound HttpClient call in a composite token that includes both the request context and a ten-second ceiling. This keeps p99 latencies predictable and lets the front-end cancel stale work the moment a user clicks again.

Logging and observability matter here too. Under the Notifiable Data Breaches scheme and the Privacy Act 1988, an Australian financial-services company that leaks a thread dump containing half-completed customer work is in for a rough Monday. Cancelling cleanly, releasing connections, and rolling back transactions is the difference between a minor incident and a reportable one. Cancellation tokens make this defensible: they give you a single, traceable signal that propagates through every layer and lets you shut every resource down in order.

A few mistakes come up repeatedly in code reviews. The first is passing the same source into two unrelated components and expecting one to cancel the other — tokens are one-way signalling, so each owner should hold its own source unless linking is intentional. The second is catching OperationCanceledException in a method that should let it propagate, which silently swallows the signal and leaves the work hanging. The third is calling Cancel() without checking IsCancellationRequested, which can race with the work and cause re-entrancy bugs.

Developers also need to remember the Dispose contract. A CancellationTokenSource holds an internal ManualResetEvent in some configurations and registers itself with the runtime's cancellation registry. Forgetting to dispose one in a hot path is a slow leak; in a long-lived worker hosted on a Linux container in an AKS cluster in Australia East, it will eventually exhaust handles. Wrapping sources in using declarations is the simplest fix.

Comparing the cancellation tools at your disposal

Mechanism What it cancels Best for Caveats
CancellationTokenSource + Token Any cooperative code path Async pipelines, loops, I/O Code must check or honour the token
Task.WhenAny with delay task The whole await operation Adding a deadline to a single call Does not interrupt running work, only the await
Thread.Interrupt or Abort Thread execution (legacy) Almost nothing in modern code Obsolete, unsafe, unavailable on .NET Core+
HostApplicationLifetime tokens App shutdown ASP.NET Core hosted services Fires late in shutdown sequence
ChannelReader complete reading Producer/consumer flow Closing a queue gracefully Not a generic cancellation tool

The table makes the point clearly: cooperative cancellation is the only safe, modern, and supported approach in TPL, and CancellationTokenSource is the spine of that approach. Time-based completion via Task.WhenAny is a useful complement, not a substitute.

Patterns where cancellation tokens earn their keep

A handful of scenarios justify the extra plumbing every time:

  • Outbound HTTP or gRPC calls inside a request-scoped pipeline where users can navigate away mid-call.
  • Long-running background services hosted in Kubernetes on Azure Australia East, where pod rotation needs to drain work quickly.
  • Data import jobs from a third-party supplier whose API occasionally hangs for ninety seconds and must be cut off.
  • Unit tests that need to verify a method stops on demand, replacing ad-hoc Thread.Sleep calls with deterministic signalling.

There are also situations where reaching for a token is overkill:

  • Tight CPU loops that finish in microseconds and have no I/O to interrupt.
  • Single-call wrappers around already-cancellable APIs where the upstream token is enough.
  • Fire-and-forget console utilities that run once and exit on their own.

For anything that crosses a network, a queue, or a database, cooperative cancellation is the difference between a service that behaves and a service that limps. The TPL gives you the tools; the rest is habit.

The Leela Ambience Convention Hotel

1, CBD, Maharaj Surajmal Road, Near Yamuna Sports Complex, Delhi, 110032

KNOW MORE

GENERAL QUERIES


Manish Tewatia

+91-9718-431-042

TICKET QUERIES


Atul Gupta

+91-9910-125-804