From ed02c722003bc9c950adf77e40057daff5852a30 Mon Sep 17 00:00:00 2001 From: Raymond Chen Date: Wed, 26 Jul 2017 17:00:00 -0700 Subject: [PATCH] Windows 10 Version 1507 - July 2017 Update --- .../cs/RandomNumberService/RandomNumberGeneratorTask.cs | 6 ++++++ .../vb/RandomNumberService/RandomNumberGeneratorTask.vb | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/Samples/AppServices/cs/RandomNumberService/RandomNumberGeneratorTask.cs b/Samples/AppServices/cs/RandomNumberService/RandomNumberGeneratorTask.cs index b40f577e3e..ea75985ec3 100644 --- a/Samples/AppServices/cs/RandomNumberService/RandomNumberGeneratorTask.cs +++ b/Samples/AppServices/cs/RandomNumberService/RandomNumberGeneratorTask.cs @@ -36,6 +36,12 @@ private void OnTaskCanceled(IBackgroundTaskInstance sender, BackgroundTaskCancel serviceDeferral.Complete(); serviceDeferral = null; } + + if (connection != null) + { + connection.Dispose(); + connection = null; + } } async void OnRequestReceived(AppServiceConnection sender, AppServiceRequestReceivedEventArgs args) diff --git a/Samples/AppServices/vb/RandomNumberService/RandomNumberGeneratorTask.vb b/Samples/AppServices/vb/RandomNumberService/RandomNumberGeneratorTask.vb index 62f34362a5..68eb340236 100644 --- a/Samples/AppServices/vb/RandomNumberService/RandomNumberGeneratorTask.vb +++ b/Samples/AppServices/vb/RandomNumberService/RandomNumberGeneratorTask.vb @@ -28,6 +28,10 @@ Namespace Global.RandomNumberService serviceDeferral.Complete() serviceDeferral = Nothing End If + If connection IsNot Nothing Then + connection.Dispose() + connection = Nothing + End If End Sub Async Sub OnRequestReceived(sender As AppServiceConnection, args As AppServiceRequestReceivedEventArgs)