Skip to content

Instantly share code, notes, and snippets.

Created January 5, 2013 00:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4458752 to your computer and use it in GitHub Desktop.
Save anonymous/4458752 to your computer and use it in GitHub Desktop.
PostSharp NullCheck Generated code
public void SomeMethod(string nonNullArg, [AllowNull] string nullArg)
{
Arguments<string, string> CS$0$0__args = new Arguments<string, string> {
Arg0 = nonNullArg,
Arg1 = nullArg
};
MethodExecutionArgs CS$0$1__aspectArgs = new MethodExecutionArgs(this, CS$0$0__args) {
Method = <>z__Aspects.m7
};
<>z__Aspects.a3.OnEntry(CS$0$1__aspectArgs);
if (CS$0$1__aspectArgs.FlowBehavior != FlowBehavior.Return)
{
try
{
Console.WriteLine(nonNullArg);
<>z__Aspects.a3.OnSuccess(CS$0$1__aspectArgs);
}
catch (Exception CS$0$3__exception)
{
CS$0$1__aspectArgs.Exception = CS$0$3__exception;
<>z__Aspects.a3.OnException(CS$0$1__aspectArgs);
switch (CS$0$1__aspectArgs.FlowBehavior)
{
case FlowBehavior.Continue:
CS$0$1__aspectArgs.Exception = null;
return;
case FlowBehavior.Return:
CS$0$1__aspectArgs.Exception = null;
return;
case FlowBehavior.ThrowException:
throw CS$0$1__aspectArgs.Exception;
}
throw;
}
finally
{
<>z__Aspects.a3.OnExit(CS$0$1__aspectArgs);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment