Jo Shields 3c1f479b9d Imported Upstream version 4.0.0~alpha1
Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
2015-04-07 09:35:12 +01:00

34 lines
1.5 KiB
C#

//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.Activities.Runtime
{
using System;
using System.Runtime;
using System.Runtime.Serialization;
using System.Security;
[DataContract]
class ActivityCompletionCallbackWrapper : CompletionCallbackWrapper
{
static readonly Type completionCallbackType = typeof(CompletionCallback);
static readonly Type[] completionCallbackParameters = new Type[] { typeof(NativeActivityContext), typeof(ActivityInstance) };
public ActivityCompletionCallbackWrapper(CompletionCallback callback, ActivityInstance owningInstance)
: base(callback, owningInstance)
{
}
[Fx.Tag.SecurityNote(Critical = "Because we are calling EnsureCallback",
Safe = "Safe because the method needs to be part of an Activity and we are casting to the callback type and it has a very specific signature. The author of the callback is buying into being invoked from PT.")]
[SecuritySafeCritical]
protected internal override void Invoke(NativeActivityContext context, ActivityInstance completedInstance)
{
EnsureCallback(completionCallbackType, completionCallbackParameters);
CompletionCallback completionCallback = (CompletionCallback)this.Callback;
completionCallback(context, completedInstance);
}
}
}