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

Compatibility with System.Linq.Dynamic.Library #35

Closed
jwperez1 opened this issue Jul 13, 2016 · 12 comments
Closed

Compatibility with System.Linq.Dynamic.Library #35

jwperez1 opened this issue Jul 13, 2016 · 12 comments
Assignees
Labels

Comments

@jwperez1
Copy link

Is this backwards compatible with System.Linq.Dynamic.Library by Nathan Arnott? That lib seems to have disappeared and I am looking for a way to migrate my code. I think I see you started with a fork from there.

@StefH
Copy link
Collaborator

StefH commented Jul 13, 2016

This library is indeed a fork from the deleted library from Nathan.

It should be compatible, except for some namespaces.

@jwperez1
Copy link
Author

Awesome. I pulled it using nugit and the only thing I had to do was change the using to have the correct namespace and it builds perfectly. I get the error below when I run the app immediately after building:

  •   [1] {"Could not load file or assembly 'Remotion.Data.Linq, Version=1.13.52.2, Culture=neutral, PublicKeyToken=0669cf0452175907' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Remotion.Data.Linq, Version=1.13.52.2, Culture=neutral, PublicKeyToken=0669cf0452175907"}  System.Exception {System.IO.FileLoadException}
    

The odd thing is, if I run the app again (without building it), it works without an error. The error occurs the first time I make a call to the dynamic linq api. This is the stacktrace:

at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.Linq.Dynamic.Core.CustomTypeProviders.DefaultDynamicLinqCustomTypeProvider.<>c.b__3_1(Assembly x)
at System.Linq.Enumerable.d__162.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext()
at System.Collections.Generic.HashSet1.UnionWith(IEnumerable1 other)
at System.Collections.Generic.HashSet1..ctor(IEnumerable1 collection, IEqualityComparer1 comparer) at System.Linq.Dynamic.Core.CustomTypeProviders.DefaultDynamicLinqCustomTypeProvider.GetCustomTypes() at System.Linq.Dynamic.Core.ExpressionParser.CreateKeywords() at System.Linq.Dynamic.Core.ExpressionParser..ctor(ParameterExpression[] parameters, String expression, Object[] values) at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Boolean createParameterCtor, ParameterExpression[] parameters, Type resultType, String expression, Object[] values) at System.Linq.Dynamic.Core.DynamicExpressionParser.ParseLambda(Boolean createParameterCtor, Type itType, Type resultType, String expression, Object[] values) at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where(IQueryable source, String predicate, Object[] args) at System.Linq.Dynamic.Core.DynamicQueryableExtensions.Where[TSource](IQueryable1 source, String predicate, Object[] args)
at DashboardDemo1.Model.Criteria.Filter.FilterIt[U](SearchCriteria criteria, IQueryable`1 query)

This happened for the first time this morning (I have had the app in prod since February). I was hoping migrating to your api would fix it but it did not. Do you have any idea what is causing this?

@StefH
Copy link
Collaborator

StefH commented Jul 13, 2016

Which dotnet framework do you use ?

And regarding this CustomTypeProvider error, it could be that some small business logic is different when loading external libraries.

@jwperez1
Copy link
Author

I use 4.5.1

@StefH StefH self-assigned this Jul 14, 2016
@StefH StefH added the question label Jul 14, 2016
@jogibear9988
Copy link
Contributor

jogibear9988 commented Jul 24, 2016

When we look in the code from Nathan: (he deleted his branch) https://github.com/jogibear9988/System.Linq.Dynamic/blob/master/Src/System.Linq.Dynamic/DynamicLinqTypeProvider.cs
we use AppDomain.CurrentDomain.GetAssemblies(); the same in https://github.com/StefH/System.Linq.Dynamic.Core/blob/master/src/System.Linq.Dynamic.Core/DefaultAssemblyHelper.cs

The difference is this line: assemblies = assemblies.Where(x => !x.IsDynamic).ToArray();

But do we need that ".ToArray" ?

@jogibear9988
Copy link
Contributor

Maybe also we could make the default "CustomTypeProvider" exception friendly.
See: #39

@jogibear9988
Copy link
Contributor

i think this could now be closed?

@StefH
Copy link
Collaborator

StefH commented Jul 26, 2016

@jwperez1 ; can you please verify ?

@StefH
Copy link
Collaborator

StefH commented Aug 22, 2016

Closing issue.

@StefH StefH closed this as completed Aug 22, 2016
@mayankgaur
Copy link

Is it resolved I am also facing same issue?

@jogibear9988
Copy link
Contributor

What issue?

@mayankgaur
Copy link

mayankgaur commented Aug 29, 2019

@jogibear9988 I am having below issue

System.IO.FileLoadException: 'Could not load file or assembly 'System.Linq.Dynamic.Core, Version=1.0.17.0, Culture=neutral, PublicKeyToken=0f07ec44de6ac832'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

here is my code details

image

Installed nuget package details
image

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

4 participants