public void MethodBodyGetterCall() { var methodDescription = new MethodDescription( "myMethod", new List <ModifierDescription> { ModifierDescription.PUBLIC }, new List <ParameterDescription>(), "void" ); var classDescription = new ClassDescription( "MyClass", "packageName", new List <ModifierDescription>(), new List <FieldDescription>(), new List <MethodDescription> { methodDescription }, new List <string>(), new List <ClassDescription>(), isNested: false); var methodBodyGetter = new MockMethodBodyGetter(); var classProxyGenerator = new ClassProxyGenerator(methodBodyGetter); classProxyGenerator.Generate(classDescription); Assert.AreEqual(1, methodBodyGetter.CallsCount); Assert.AreEqual("myMethod", methodBodyGetter.CallArgumentName); }
/// <summary> /// Determines whether the specified <see cref="System.Object" />, is equal to this instance. /// </summary> /// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param> /// <returns> /// <c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>. /// </returns> public override bool Equals(object obj) { if (obj == null) { return(false); } MethodDescription method = (MethodDescription)obj; if (((this.ComponentObject == null && method.ComponentObject == null) || object.Equals(this.ComponentObject, method.ComponentObject)) && ((this.Method == null && method.Method == null) || this.Method.Equals(method.Method)) && ((this.StepType == null && method.StepType == null) || this.StepType.Equals(method.StepType)) && ((this.Text == null && method.Text == null) || this.Text.Equals(method.Text)) && this.ExecutionOrder.Equals(method.ExecutionOrder) && ((this.ParametersIndex == null && method.ParametersIndex == null) || this.ParametersIndex.Equals(method.ParametersIndex)) && ((this.Parameters == null && method.Parameters == null) || this.Parameters.Equals(method.Parameters))) { return(true); } return(false); }
/// <summary> /// Get list of receiver's devices like Tuner, USB, AirPlay, and e.t.c and its status. /// </summary> /// <returns>List of status</returns> public List <DeviceStatus> CheckDeviceStatus() { List <DeviceStatus> result = new List <DeviceStatus>(); //get list of nodes having Func Attribute = Source_Device List <XElement> devices = Atomics.UnitDescription.Elements().Where(x => x.Attribute("Func") != null && x.Attribute("Func").Value == "Source_Device").ToList(); //iterate through devices foreach (XElement device in devices) { //get definition of the status command XElement statusCommand = device.Elements("Menu").Where(x => x.Attribute("Func") != null && x.Attribute("Func").Value == "Status").FirstOrDefault(); //Find and parse GET definitions for the function MethodDescription mdg = new MethodDescription(statusCommand, MethodType.GET); //get list of available commands for the device XElement cmd_list = device.Elements("Cmd_List").FirstOrDefault(); //find device status function path string path = cmd_list.Elements("Define").Where(x => x.Attribute("ID") != null && x.Attribute("ID").Value == mdg.Commands[0].ID).FirstOrDefault().Value; //request status of the device from receiver XElement resp = (new Communication(this._hostNameOrAddress)).SendYNCCommand(MethodType.GET, path); //get description of status path from command description string featurePath = mdg.Commands[0].Values[0].Split(new string[] { "=" }, StringSplitOptions.RemoveEmptyEntries)[0]; //get device name string name = device.Attribute("YNC_Tag").Value; //get device status string status = resp.Descendants(featurePath).FirstOrDefault().Value; //add device status to collection result.Add(new DeviceStatus(name, status)); } return(result); }
public void GenerateMethodWithArgs() { var methodDescription = new MethodDescription( "myMethod", new List <ModifierDescription> { ModifierDescription.PUBLIC, ModifierDescription.STATIC }, new List <ParameterDescription> { new ParameterDescription("arg0", "string[]"), new ParameterDescription("arg1", "int"), new ParameterDescription("arg31", "MyType") }, "void" ); var classDescription = new ClassDescription( "MyClass", "packageName", new List <ModifierDescription>(), new List <FieldDescription>(), new List <MethodDescription> { methodDescription }, new List <string>(), new List <ClassDescription>(), isNested: false); var classDeclaration = classProxyGenerator.Generate(classDescription); var method = classDeclaration.Members[0] as MethodDeclarationSyntax; TestBase.CheckParameters(methodDescription.Name, methodDescription.ParametersDescription, method.ParameterList.Parameters); }
private void CacheStatic(IEnumerable <Assembly> inAssemblies) { if (m_StaticMethods != null) { return; } m_StaticMethods = new Dictionary <StringHash32, MethodDescription>(32); inAssemblies = inAssemblies ?? Reflect.FindAllUserAssemblies(); foreach (var attrPair in Reflect.FindMethods <TAttr>(inAssemblies, StaticAttributeSearch, false)) { attrPair.Attribute.AssignId(attrPair.Info); if (m_StaticMethods.ContainsKey(attrPair.Attribute.Id)) { UnityEngine.Debug.LogErrorFormat("[MethodCache] Multiple instances of static method with id '{0}' found", attrPair.Attribute.Id.ToDebugString()); continue; } MethodDescription desc = CreateDescription(attrPair.Attribute, attrPair.Info); if (!desc.TryProcess(this)) { UnityEngine.Debug.LogErrorFormat("[MethodCache] Static method '{0}' on type '{1}' is incompatible", desc.Id.ToDebugString(), desc.Method.DeclaringType.FullName); continue; } m_StaticMethods.Add(desc.Id, desc); } }
public async Task Invoke(InvokeContext <TService> ctx) { IDataHelper <TService> dataHelper = ctx.ServiceContainer.GetDataHelper(); IServiceOperationsHelper <TService> serviceHelper = ctx.ServiceContainer.GetServiceHelper(); RunTimeMetadata metadata = ctx.Service.GetMetadata(); MethodDescription method = metadata.GetInvokeMethod(ctx.Request.methodName); List <object> methParams = new List <object>(); for (int i = 0; i < method.parameters.Count; ++i) { methParams.Add(ctx.Request.paramInfo.GetValue(method.parameters[i].name, method, dataHelper)); } RequestContext req = InvokeContext <TService> .CreateRequestContext(ctx.Service); using (RequestCallContext callContext = new RequestCallContext(req)) { MethodInfoData methodData = method.GetMethodData(); object instance = serviceHelper.GetMethodOwner(methodData); object invokeRes = methodData.MethodInfo.Invoke(instance, methParams.ToArray()); object methodResult = await serviceHelper.GetMethodResult(invokeRes); if (method.methodResult) { ctx.Response.result = methodResult; } } await _next(ctx); }
private static List <MethodDescription> GetMethods(Type type) { var methodsList = new List <MethodDescription>(); var methods = type.GetMethods(BindingFlagsSet); foreach (var method in methods) { var methodDescription = new MethodDescription { Name = method.Name, AccessModifier = GetAccessModifier(method), ReturnType = method.ReturnType }; foreach (var parameter in method.GetParameters()) { var paramInfo = new ParameterInfo { Name = parameter.Name, Type = parameter.ParameterType }; methodDescription.Params.Add(paramInfo); } methodsList.Add(methodDescription); } return(methodsList); }
public void MarkVirtualNotPublicStaticFinalMethods() { var methodDescription = new MethodDescription( "myMethod", new List <ModifierDescription> { ModifierDescription.PROTECTED }, new List <ParameterDescription>(), "void" ); var classDescription = new ClassDescription( "MyClass", "packageName", new List <ModifierDescription>(), new List <FieldDescription>(), new List <MethodDescription> { methodDescription }, new List <string>(), new List <ClassDescription>(), isNested: false); var classDeclaration = classProxyGenerator.Generate(classDescription); var method = classDeclaration.Members[0] as MethodDeclarationSyntax; TestBase.CheckModifiers(new HashSet <string> { "protected", "virtual" }, method.Modifiers); }
public Request Bind(string button = null) { string charset = GetCharset(); Uri action = Action; if (!MethodDescription.GetMethod(Method).BodyAllowed&& EncodingType == MediaType.ApplicationFormUrlEncoded) { action = Action.AddQueryParameters(GetSubmitData(button)); } Request request = Session.Bind(action) .ContentType(EncodingType) .Method(Method); if (MethodDescription.GetMethod(Method).BodyAllowed) { request.Body(GetSubmitData(button)); } if (charset != null) { request.CodecParameter("Charset", charset); } return(request); }
public void MarkVirtualNotPublicStaticFinalMethods() { var methodDescription = new MethodDescription( "myMethod", new List <ModifierDescription> { ModifierDescription.PROTECTED }, new List <ParameterDescription>(), "void", isConstructor: false ); var classDescription = new ClassDescription( "MyClass", "packageName", new List <ModifierDescription>(), new List <FieldDescription>(), new List <MethodDescription> { methodDescription }, new List <string>(), new List <ClassDescription>(), isNested: false); var classDeclaration = classProxyGenerator.Generate(classDescription); var method = GetFirstMethod(classDeclaration); Assert.AreNotEqual(null, method, "Class doesn't exist any methods"); TestBase.CheckModifiers(new HashSet <string> { "protected", "virtual" }, method.Modifiers); }
private bool VerifyInputParameter(MethodDescription mdp, string parameter) { bool result = false; string parameters = string.Empty; List <Command> cmds = mdp.Commands; this._acceptableParameters = string.Empty; if (mdp.PutType == 1) { foreach (Command cmd in cmds) { result = VerifyParameter <string>(cmd.Values, parameter); if (result == true) { break; } } } else if (mdp.PutType == 2) { result = VerifyParameter <IParameter>(mdp.Parameters, parameter); } return(result); }
private BlockSyntax GetMethodBody(MethodDescription description) { var isStatic = description.ModifiersDescriptions.Contains(ModifierDescription.STATIC); string type; string MethodBuilder(string ret) => $"Call{(isStatic ? "Static" : "")}{ret}Method"; if (description.ReturnType == "void" || description.ReturnType == "int") { type = description.ReturnType.UppercaseFirstLetter(); } else { type = "Object"; } var callJvmExpression = CallJvmExpression( MethodBuilder(type), jObjectName, ServiceUtils.GetMethodRefProperty(description), description.ParametersDescription ); var statement = (description.ReturnType == "void") ? callJvmExpression.ToStatement() : SyntaxFactory.ReturnStatement(callJvmExpression); return(SyntaxFactory.Block(statement)); }
private void AddIfMethodIdInvokeBlock(ILGenerator ilGen, Label elseLabel, LocalBuilder castedObject, MethodDescription methodDescription, string interfaceName) { ilGen.Emit(OpCodes.Ldarg_1); ilGen.Emit(OpCodes.Ldc_I4, methodDescription.Id); ilGen.Emit(OpCodes.Bne_Un, elseLabel); var requestBody = typeof(IServiceRemotingRequestMessageBody); // now invoke the method on the casted object ilGen.Emit(OpCodes.Ldloc, castedObject); if ((methodDescription.Arguments != null) && (methodDescription.Arguments.Length != 0)) { var method = requestBody.GetMethod("GetParameter"); for (var i = 0; i < methodDescription.Arguments.Length; i++) { var argument = methodDescription.Arguments[i]; // ReSharper disable once AssignNullToNotNullAttribute // castedRequestBody is set to non-null in the previous if check on the same condition ilGen.Emit(OpCodes.Ldarg_3); ilGen.Emit(OpCodes.Ldc_I4, i); ilGen.Emit(OpCodes.Ldstr, argument.Name); ilGen.Emit(OpCodes.Ldtoken, argument.ArgumentType); ilGen.Emit(OpCodes.Callvirt, method); ilGen.Emit(OpCodes.Unbox_Any, argument.ArgumentType); } } ilGen.EmitCall(OpCodes.Callvirt, methodDescription.MethodInfo, null); ilGen.Emit(OpCodes.Ret); }
private static void AddIfNotWrapMsgGetParameter( ILGenerator ilGen, LocalBuilder castedObject, MethodDescription methodDescription, Type requestBody) { // now invoke the method on the casted object ilGen.Emit(OpCodes.Ldloc, castedObject); if ((methodDescription.Arguments != null) && (methodDescription.Arguments.Length != 0)) { var method = requestBody.GetMethod("GetParameter"); for (var i = 0; i < methodDescription.Arguments.Length; i++) { var argument = methodDescription.Arguments[i]; // ReSharper disable once AssignNullToNotNullAttribute // castedRequestBody is set to non-null in the previous if check on the same condition ilGen.Emit(OpCodes.Ldarg_3); ilGen.Emit(OpCodes.Ldc_I4, i); ilGen.Emit(OpCodes.Ldstr, argument.Name); ilGen.Emit(OpCodes.Ldtoken, argument.ArgumentType); ilGen.Emit(OpCodes.Call, getTypeFromHandle); ilGen.Emit(OpCodes.Callvirt, method); ilGen.Emit(OpCodes.Unbox_Any, argument.ArgumentType); } } }
private static IList <MethodDescription> TranslateStartEdgeToVirtualTransitionMethodDescriptions(Graph graph, Edge edge) { var virtualTransitionMethodDescriptions = new List <MethodDescription>(); var internalMethodName = String.Concat(edge.Connection.GetName(), StartConnectionTransitionInternalMethodNameSufix); var parameterPairs = edge.Connection.GetParameters(); var internalMethod = new MethodDescription() { Name = internalMethodName, ReturnType = TypeName.Void(), Accessibility = Accessibility.Protected, DeclarationModifiers = DeclarationModifiers.Virtual }; internalMethod.Parameters = parameterPairs.Select(ConvertToParameter).ToList(); virtualTransitionMethodDescriptions.Add(internalMethod); var method = new MethodDescription() { Name = edge.Connection.GetName(), ReturnType = TypeName.CreateTypeName(String.Concat(GetTransitionClassName(graph), ".", String.Concat("I", edge.End.Identifier))), Accessibility = Accessibility.Public, Parameters = internalMethod.Parameters }; method.StatementsBuilders.Add(syntaxGenerator => GenerateInvokeMethodSyntaxNode(syntaxGenerator, internalMethodName, internalMethod.Parameters.Select(parameter => parameter.Name))); method.StatementsBuilders.Add(syntaxGenerator => syntaxGenerator.ReturnStatement(syntaxGenerator.ThisExpression())); virtualTransitionMethodDescriptions.Add(method); return(virtualTransitionMethodDescriptions); }
public void GenerateClassWithMethod() { var methodDescription = new MethodDescription( "myMethod", new List <ModifierDescription> { ModifierDescription.PUBLIC }, new List <ParameterDescription>(), "void" ); var classDescription = new ClassDescription( "MyClass", "packageName", new List <ModifierDescription>(), new List <FieldDescription>(), new List <MethodDescription> { methodDescription }, new List <string>(), new List <ClassDescription>(), isNested: false); var classDeclaration = classProxyGenerator.Generate(classDescription); TestBase.CheckMethods(classDeclaration, new List <MethodDescription> { methodDescription }); }
private void AddVoidMethodImplementationV1( ILGenerator ilGen, int interfaceId, MethodDescription methodDescription, MethodBodyTypes methodBodyTypes) { }
private void AddVoidMethodImplementation( TypeBuilder classBuilder, int interfaceDescriptionId, MethodDescription methodDescription, MethodBodyTypes methodBodyTypes, string interfaceName) { var interfaceMethod = methodDescription.MethodInfo; var methodBuilder = CodeBuilderUtils.CreateExplitInterfaceMethodBuilder( classBuilder, interfaceMethod); var ilGen = methodBuilder.GetILGenerator(); // Create Wrapped Request LocalBuilder wrappedRequestBody = CreateWrappedRequestBody(methodDescription, methodBodyTypes, ilGen, methodDescription.MethodInfo.GetParameters()); this.AddVoidMethodImplementation( ilGen, interfaceDescriptionId, methodDescription, wrappedRequestBody, interfaceName); ilGen.Emit(OpCodes.Ret); }
public BlockSyntax GetBodyFor(MethodDescription methodDescription) { var body = methodDescription.IsConstructor ? GetConstrctorBody(methodDescription) : GetMethodBody(methodDescription); return(WrapByUsingStatements(methodDescription.ParametersDescription, body)); }
public void ShouldFailIfMethodAttributeIsAbsent() { //Arrange var mi = typeof(IContract).GetMethod(nameof(IContract.WithoutMethodAttribute)); //Act & Assert Assert.Throws <ApiContractException>(() => MethodDescription.Create(mi)); }
private static FieldDescription GenerateMethodRefFieldDescription( MethodDescription methodDescription) { return(new FieldDescription( ServiceUtils.GetMethodRefName(methodDescription), GLOBAL_REF_TYPE, new List <ModifierDescription>())); }
private static Code.Type CreateBuilderClass(Graph graph) { var name = graph.GetName(); var accessibility = graph.GetAccessibility(); var builderClass = new Code.Type() { Name = name, Accessibility = accessibility, }; var interfaces = GetInterfacesDictionary(graph); var virtualTransitionMethodsDescription = GetVirtualTransitionMethodsDescription(graph); foreach (var transitionMethod in virtualTransitionMethodsDescription) { builderClass.Methods.Add(transitionMethod); } foreach (var @interface in interfaces.Values) { builderClass.BaseTypes.Add(TypeName.CreateTypeName(String.Concat(GetTransitionClassName(graph), ".", @interface.Name))); foreach (var method in @interface.Methods) { MethodDescription methodDescription = null; if (method.IsEndStateTransition) { methodDescription = new MethodDescription() { Name = String.Concat(GetTransitionClassName(graph), ".", @interface.Name, ".", method.Name), ReturnType = TypeName.CreateTypeName(method.ReturnType.Name), Parameters = method.Parameters.ToList() }; methodDescription.StatementsBuilders.Add(syntaxGenerator => syntaxGenerator.ReturnStatement(GenerateInvokeMethodSyntaxNode(syntaxGenerator, method.Name, method.Parameters.Select(parameter => parameter.Name)))); } else { methodDescription = new MethodDescription() { Name = String.Concat(GetTransitionClassName(graph), ".", @interface.Name, ".", method.Name), ReturnType = TypeName.CreateTypeName(String.Concat(GetTransitionClassName(graph), ".", method.ReturnType.Name)), Parameters = method.Parameters.ToList() }; methodDescription.StatementsBuilders.Add(syntaxGenerator => GenerateInvokeMethodSyntaxNode(syntaxGenerator, method.Name, method.Parameters.Select(parameter => parameter.Name))); methodDescription.StatementsBuilders.Add(syntaxGenerator => syntaxGenerator.ReturnStatement(syntaxGenerator.ThisExpression())); } builderClass.Methods.Add(methodDescription); } } return(builderClass); }
public HandlerClassBuildingContext(IReadOnlyList <ServiceDescription> serviceDescriptionChain, MethodDescription methodDescription, TypeBuilder builder, GenericTypeParameterBuilder[] genericTypeParameterBuilders, HandlerClassFieldCache fields) { ServiceDescriptionChain = serviceDescriptionChain; MethodDescription = methodDescription; Builder = builder; GenericTypeParameterBuilders = genericTypeParameterBuilders; Fields = fields; }
internal void AddMethodToPreserve(string assembly, string @namespace, string klassName, string methodName) { MethodDescription item = new MethodDescription { assembly = assembly, fullTypeName = @namespace + ((@namespace.Length <= 0) ? string.Empty : ".") + klassName, methodName = methodName }; this.m_MethodsToPreserve.Add(item); }
internal void AddVoidMethodImplementation2(ILGenerator ilGen, int interfaceDescriptionId, MethodDescription methodDescription, string interfaceName ) { var interfaceMethod = methodDescription.MethodInfo; var parameters = interfaceMethod.GetParameters(); LocalBuilder requestBody = null; if (parameters.Length > 0) { ilGen.Emit(OpCodes.Ldarg_0); // base requestBody = ilGen.DeclareLocal(typeof(IServiceRemotingRequestMessageBody)); ilGen.Emit(OpCodes.Ldstr, interfaceName); ilGen.Emit(OpCodes.Ldstr, methodDescription.Name); ilGen.Emit(OpCodes.Ldc_I4, parameters.Length); ilGen.EmitCall(OpCodes.Call, this.createMessage, null); ilGen.Emit(OpCodes.Stloc, requestBody); var setMethod = typeof(IServiceRemotingRequestMessageBody).GetMethod("SetParameter"); //Add to Dictionary for (var i = 0; i < parameters.Length; i++) { ilGen.Emit(OpCodes.Ldloc, requestBody); ilGen.Emit(OpCodes.Ldc_I4, i); ilGen.Emit(OpCodes.Ldstr, parameters[i].Name); ilGen.Emit(OpCodes.Ldarg, i + 1); if (!parameters[i].ParameterType.IsClass) { ilGen.Emit(OpCodes.Box, parameters[i].ParameterType); } ilGen.Emit(OpCodes.Callvirt, setMethod); } } // call the base Invoke method ilGen.Emit(OpCodes.Ldarg_0); // base ilGen.Emit(OpCodes.Ldc_I4, interfaceDescriptionId); // interfaceId ilGen.Emit(OpCodes.Ldc_I4, methodDescription.Id); // methodId if (parameters.Length > 0) { ilGen.Emit(OpCodes.Ldloc, requestBody); } else { ilGen.Emit(OpCodes.Ldnull); } ilGen.EmitCall(OpCodes.Call, this.invokeMethodInfo, null); }
public static MethodDescription CreateMethodDescription(MethodInfo syncMethod) { Type[] types = GetMethodParamTypes(syncMethod); MethodDescription methodDescription = new MethodDescription(); methodDescription.MethodName = syncMethod.Name; methodDescription.ParamTypes = types; methodDescription.ServiceType = syncMethod.DeclaringType; return(methodDescription); }
/// <summary> /// Adds the method defined by direct native method. /// </summary> /// <param name="methodPath">The method path.</param> /// <param name="source">The source.</param> /// <param name="description">The description of method signature.</param> /// <returns>TestingAssembly.</returns> public TestingAssembly AddMethod(string methodPath, DirectMethod source, MethodDescription description) { var methodInfo = buildDescription(description, methodPath); var method = new DirectGenerator(source); addMethod(method, methodInfo, description.Implemented); return(this); }
public async Task Invoke(QueryContext <TService> ctx) { Security.IAuthorizer <TService> authorizer = ctx.ServiceContainer.GetAuthorizer(); RunTimeMetadata metadata = ctx.Service.GetMetadata(); MethodDescription method = metadata.GetQueryMethod(ctx.Request.dbSetName, ctx.Request.queryName); await authorizer.CheckUserRightsToExecute(method.GetMethodData()); await _next(ctx); }
private void AddVoidMethodImplementation( TypeBuilder classBuilder, int interfaceId, MethodDescription methodDescription, MethodBodyTypes methodBodyTypes) { var interfaceMethod = methodDescription.MethodInfo; var parameters = interfaceMethod.GetParameters(); var methodBuilder = CodeBuilderUtils.CreateExplitInterfaceMethodBuilder( classBuilder, interfaceMethod); var ilGen = methodBuilder.GetILGenerator(); LocalBuilder requestBody = null; if (methodBodyTypes.RequestBodyType != null) { // create requestBody and assign the values to its field from the arguments requestBody = ilGen.DeclareLocal(methodBodyTypes.RequestBodyType); var requestBodyCtor = methodBodyTypes.RequestBodyType.GetConstructor(Type.EmptyTypes); if (requestBodyCtor != null) { ilGen.Emit(OpCodes.Newobj, requestBodyCtor); ilGen.Emit(OpCodes.Stloc, requestBody); for (var i = 0; i < parameters.Length; i++) { ilGen.Emit(OpCodes.Ldloc, requestBody); ilGen.Emit(OpCodes.Ldarg, i + 1); ilGen.Emit(OpCodes.Stfld, methodBodyTypes.RequestBodyType.GetField(parameters[i].Name)); } } } // call the base Invoke method ilGen.Emit(OpCodes.Ldarg_0); // base ilGen.Emit(OpCodes.Ldc_I4, interfaceId); // interfaceId ilGen.Emit(OpCodes.Ldc_I4, methodDescription.Id); // methodId if (requestBody != null) { ilGen.Emit(OpCodes.Ldloc, requestBody); } else { ilGen.Emit(OpCodes.Ldnull); } ilGen.EmitCall(OpCodes.Call, this.invokeMethodInfo, null); ilGen.Emit(OpCodes.Ret); }
public static string GetMethodJavaSignature(MethodDescription description) { var signature = new StringBuilder(); foreach (var paramDescription in description.ParametersDescription) { signature.Append(ToJavaSignature(paramDescription.Type)); } return($"({signature}){ToJavaSignature(description.ReturnType)}"); }
private bool ExtractExtensionMethods(TypeDefinition type) { // type is enclosing type if(!type.IsClass) { return false; } var methodAdded = false; foreach(var method in type.Methods) { if(method.IsStatic && method.IsPublic && method.CustomAttributes.Any(x => x.AttributeType.FullName == typeof(System.Runtime.CompilerServices.ExtensionAttribute).FullName)) { // so this is extension method // let's check the type of the first parameter var paramReference = method.Parameters[0]; var paramType = paramReference.ParameterType.Resolve(); if(paramType == null) { if(paramReference.ParameterType.IsGenericParameter || paramReference.ParameterType.GetElementType().IsGenericParameter) { // we do not handle generic extension methods now continue; } Logger.LogAs(this, LogLevel.Warning, "Could not resolve parameter type {0} for method {1} in class {2}.", paramReference.ParameterType.FullName, method.FullName, type.FullName); continue; } if(IsInterestingType(paramType) || (paramType.FullName == typeof(object).FullName && method.CustomAttributes.Any(x => x.AttributeType.FullName == typeof(ExtensionOnObjectAttribute).FullName))) { methodAdded = true; // that's the interesting extension method var methodDescription = new MethodDescription(type.FullName, method.Name, GetMethodSignature(method), true); if(extensionMethodsTraceFromTypeFullName.ContainsKey(paramType.FullName)) { extensionMethodsTraceFromTypeFullName[paramType.FullName].Add(methodDescription); } else { extensionMethodsTraceFromTypeFullName.Add(paramType.FullName, new HashSet<MethodDescription> { methodDescription } ); } } } } return methodAdded; }