~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to external/mono-tools/gendarme/rules/Gendarme.Rules.Interoperability/GetLastErrorMustBeCalledRightAfterPInvokeRule.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
135
135
 
136
136
                                        //check if a method is called
137
137
                                        if (ins.OpCode.FlowControl == FlowControl.Call) {
138
 
 
139
 
                                                MethodDefinition mDef = (ins.Operand as MethodReference).Resolve ();
 
138
                                            MethodReference mRef = ins.Operand as MethodReference;
 
139
 
 
140
                        if (mRef == null) {
 
141
                            continue;
 
142
                        }
 
143
 
 
144
                                            MethodDefinition mDef = mRef.Resolve();
140
145
                                                if (mDef != null && mDef.IsPInvokeImpl) { //check if another pinvoke method is called, this counts as "GetLastError not called"
141
146
                                                        break;
142
147
                                                }
143
 
 
 
148
                        
144
149
                                                string s = (mDef == null) ? String.Empty : mDef.DeclaringType.GetFullName ();
145
150
                                                switch (s) {
146
151
                                                case "System.Runtime.InteropServices.Marshal":