﻿<?xml version="1.0" encoding="utf-8"?><Type Name="ProtectCallToEventDelegatesRule" FullName="Gendarme.Rules.Concurrency.ProtectCallToEventDelegatesRule"><TypeSignature Language="C#" Value="public class ProtectCallToEventDelegatesRule : Gendarme.Framework.Rule, Gendarme.Framework.IMethodRule" /><TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ProtectCallToEventDelegatesRule extends Gendarme.Framework.Rule implements class Gendarme.Framework.IMethodRule, class Gendarme.Framework.IRule" /><AssemblyInfo><AssemblyName>Gendarme.Rules.Concurrency</AssemblyName><AssemblyVersion>4.2.0.0</AssemblyVersion></AssemblyInfo><Base><BaseTypeName>Gendarme.Framework.Rule</BaseTypeName></Base><Interfaces><Interface><InterfaceName>Gendarme.Framework.IMethodRule</InterfaceName></Interface></Interfaces><Attributes><Attribute><AttributeName>Gendarme.Framework.EngineDependency(typeof(Gendarme.Framework.Engines.OpCodeEngine))</AttributeName></Attribute><Attribute><AttributeName>Gendarme.Framework.Problem("The use of the event does not seems protected properly against NullReferenceException and/or race conditions.")</AttributeName></Attribute><Attribute><AttributeName>Gendarme.Framework.Solution("Fix the event use to make sure it won't be null or susceptible to a race condition.")</AttributeName></Attribute></Attributes><Docs><summary>
             This rule checks that event invocations are safely implemented. In particular,
             the event must be copied into a local to avoid race conditions and it must be
             checked for null before it is used (events will normally be null until a delegate is added
             to them).
             </summary><remarks>To be added.</remarks><example>
             Bad example (no check):
             <code>
             public event EventHandler Loading;
             
             protected void OnLoading (EventArgs e)
             {
            	// Loading field could be null, throwing a NullReferenceException
             	Loading (this, e);
             }
             </code></example><example>
             Bad example (race condition):
             <code>
             public event EventHandler Loading;
             
             protected void OnLoading (EventArgs e)
             {
             	// Loading could be non-null here
             	if (Loading != null) {
             		// but be null once we get here :(
             		Loading (this, e);
             	}
             }
             </code></example><example>
             Good example:
             <code>
             public event EventHandler Loading;
             protected void OnLoading (EventArgs e)
             {
             	EventHandler handler = Loading;
             	// handler is either null or non-null
             	if (handler != null) {
             		// and won't change (i.e. safe from a NullReferenceException)
             		handler (this, e);
            		// however it is still possible, like the original code, that
            		// the Loading method will be removed before, or during its
            		// execution. Your code should be safe against such occurance.
             	}
             }
             </code></example></Docs><Members><Member MemberName=".ctor"><MemberSignature Language="C#" Value="public ProtectCallToEventDelegatesRule ();" /><MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" /><MemberType>Constructor</MemberType><AssemblyInfo><AssemblyVersion>4.2.0.0</AssemblyVersion></AssemblyInfo><Parameters /><Docs><summary>To be added.</summary><remarks>To be added.</remarks></Docs></Member><Member MemberName="CheckMethod"><MemberSignature Language="C#" Value="public Gendarme.Framework.RuleResult CheckMethod (Mono.Cecil.MethodDefinition method);" /><MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance valuetype Gendarme.Framework.RuleResult CheckMethod(class Mono.Cecil.MethodDefinition method) cil managed" /><MemberType>Method</MemberType><AssemblyInfo><AssemblyVersion>4.2.0.0</AssemblyVersion></AssemblyInfo><ReturnValue><ReturnType>Gendarme.Framework.RuleResult</ReturnType></ReturnValue><Parameters><Parameter Name="method" Type="Mono.Cecil.MethodDefinition" /></Parameters><Docs><param name="method">To be added.</param><summary>To be added.</summary><returns>To be added.</returns><remarks>To be added.</remarks></Docs></Member></Members></Type>