Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue : SkipWhile Method not found in mono #157

Closed
jogibear9988 opened this issue Apr 18, 2018 · 5 comments
Closed

Issue : SkipWhile Method not found in mono #157

jogibear9988 opened this issue Apr 18, 2018 · 5 comments
Assignees
Labels

Comments

@jogibear9988
Copy link
Contributor

DynamicLinq Core does not work with mono atm.

Can we fix this? Method SkipWhile isnot found. Following methods exist in mono:
bildschirmfoto 2018-04-18 um 20 38 11

jogibear9988 added a commit to jogibear9988/System.Linq.Dynamic.Core that referenced this issue Apr 18, 2018
@jogibear9988
Copy link
Contributor Author

System.TypeInitializationException: The type initializer for 'System.Linq.Dynamic.Core.DynamicQueryableExtensions' threw an exception. ---> System.Exception: Method not found: SkipWhile
at System.Linq.Dynamic.Core.DynamicQueryableExtensions.GetMethod (System.String name, System.Int32 parameterCount, System.Func`2[T,TResult] predicate) [0x00041] in F:\csharp\git\github\System.Linq.Dynamic.Core\src\System.Linq.Dynamic.Core\DynamicQueryableExtensions.cs:2019
at System.Linq.Dynamic.Core.DynamicQueryableExtensions..cctor () [0x00160] in F:\csharp\git\github\System.Linq.Dynamic.Core\src\System.Linq.Dynamic.Core\DynamicQueryableExtensions.cs:1638
--- End of inner exception stack trace ---

@jogibear9988
Copy link
Contributor Author

jogibear9988 commented Apr 18, 2018

This Code:

    private static MethodInfo GetMethod(string name, int parameterCount = 0, Func<MethodInfo, bool> predicate = null)
    {
        try
        {
            return typeof(Queryable).GetTypeInfo().GetDeclaredMethods(name).Single(mi =>
                mi.GetParameters().Length == parameterCount + 1 && (predicate == null || predicate(mi)));
        }
        catch (Exception ex)
        {
            var a = new StringBuilder();
            a.AppendLine("");
            a.AppendLine("Methods with Name:" + name);
            var mth = typeof(Queryable).GetTypeInfo().GetDeclaredMethods(name).Where(x => x.Name == name);
            a.AppendLine("Method Count" + mth.Count());
            foreach (var methodInfo in mth)
            {
                a.AppendLine(mth.ToString());
                foreach (var p in methodInfo.GetParameters())
                {
                    a.AppendLine(p.ToString());
                }
                a.AppendLine("--------------------");
            }

            throw new Exception(a.ToString());
            TraceSource.TraceEvent(TraceEventType.Error, 0, "Method not found:  {0} - {1}", name, ex);
        }

        return null;
    }

Produces following output:

Methods with Name:SkipWhile
Method Count2
System.Linq.Enumerable+WhereEnumerableIterator`1[System.Reflection.MethodInfo]
IQueryable`1 source
 predicate
--------------------
System.Linq.Enumerable+WhereEnumerableIterator`1[System.Reflection.MethodInfo]
IQueryable`1 source
 predicate
--------------------

@jogibear9988
Copy link
Contributor Author

In Net 4.7.1. this is print out:

Methods with Name:SkipWhile
Method Count2
System.Linq.Enumerable+WhereEnumerableIterator`1[System.Reflection.MethodInfo]
System.Linq.IQueryable`1[TSource] source
System.Linq.Expressions.Expression`1[System.Func`2[TSource,System.Boolean]] predicate
--------------------
System.Linq.Enumerable+WhereEnumerableIterator`1[System.Reflection.MethodInfo]
System.Linq.IQueryable`1[TSource] source
System.Linq.Expressions.Expression`1[System.Func`3[TSource,System.Int32,System.Boolean]] predicate
--------------------

@jogibear9988
Copy link
Contributor Author

so you'll see mono has a differnet ToString implementation! Think we should change the code so it does notlook for strings!

@jogibear9988
Copy link
Contributor Author

jogibear9988 commented Apr 18, 2018

I've reported a Mono Issue too, but I think we should fix, as I think the too string output may change on a new runtime. mono/mono#8312

jogibear9988 added a commit to jogibear9988/System.Linq.Dynamic.Core that referenced this issue Apr 18, 2018
@StefH StefH changed the title Doesnot work with Mono -> SkipWhile Method not found Issue : SkipWhile Method not found in mono Apr 25, 2018
@StefH StefH added the bug label Apr 25, 2018
@StefH StefH self-assigned this Apr 25, 2018
jogibear9988 added a commit to jogibear9988/System.Linq.Dynamic.Core that referenced this issue Apr 27, 2018
@StefH StefH closed this as completed in 85c7cde Apr 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants