Get Method for Open Generic Type not supported RRS feed

  • Question

  • Hi,

    I was executing a project which has generic type methods. I build the project for XP-x86 as well as CE-x86.

    The project runs some unit tests of other project say X. X project has generic methods. The methods were executed properly in XP but on executing it on CE, I got the following error - 

    Error Message : GetMethods for Open Generic Types is not supported.
       at System.RuntimeType.GetMethods(BindingFlags bindingAttr)
       at System.Type.GetMethods()
       at System.Linq.Enumerable.<SelectManyIterator>d__1a`2.MoveNext()
       at System.Linq.Enumerable.<WhereIterator>d__0`1.MoveNext()
       at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source)

    Kindly help me figure out why this is happening.


    Thursday, September 27, 2018 9:05 AM

All replies

  • Hello,

    please provide more Information. Please show us one or two generic type methods that produce the error.

    Regards, Guido

    Thursday, September 27, 2018 9:12 AM
  • public class ThreeKeyFilter<TFirstKey, TSecondKey, TThirdKey, TLeafNode, TFilterable, TFilterAdapter> where TFilterAdapter : IThreeKeyFilterAdapter<TFilterable, TFirstKey, TSecondKey, TThirdKey>, new()
            public ThreeKeyFilter();
            public void AddPattern(TFirstKey firstKey, TSecondKey secondKey, TThirdKey thirdKey, TLeafNode node);
            public IEnumerable<TLeafNode> Filter(TFilterable theEvent);
            public void RemovePattern(TFirstKey firstKey, TSecondKey secondKey, TThirdKey thirdKey, TLeafNode node);

    IThreeKeyFilterAdapter - 

    public interface IThreeKeyFilterAdapter<TFilterable, TFirstKey, TSecondKey, TThirdKey>
            TFirstKey GetFirstAnyKey();
            TFirstKey GetFirstKey(TFilterable filterable);
            TSecondKey GetSecondAnyKey();
            TSecondKey GetSecondKey(TFilterable filterable);
            TThirdKey GetThirdAnyKey();
            TThirdKey GetThirdKey(TFilterable filterable);

    And while creating object this is being done-

    ThreeKeyFilter<string, string, uint, Multi...tor, Usem...ject, Usem...ter> filter = new ThreeKeyFilter<string, string, uint, Multi...tor, Usem...ject, Usem...ter>();

    Thursday, September 27, 2018 11:08 AM