-
-
Notifications
You must be signed in to change notification settings - Fork 231
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
Package 1.0.6.3 install fails for UWP App #33
Comments
If possible, create an example app. With and without references to system.linq.dynamic.core And also checkout my example project https://github.com/StefH/System.Linq.Dynamic.Core/tree/master/test-uap/UniversalWindowsApp and see the differences. |
With Microsoft.NETCore.UniversalWindowsPlatform 5.1.0, my app works fine just like your example project. I tried to upgrade your example project to 5.2.0 and I got the same error. I need to upgrade my app to 5.2.0 in order to use EFCore 1.0 RTM. Could you try to upgrade your example app to Microsoft.NETCore.UniversalWindowsPlatform 5.2.0 ? |
I forgot to mention that I have added System.Linq.Dynamic.Core project to the solution of my app to make it works with 5.1.0, like your example project. |
Ok. Enough details I think. Thanks for this analysis. I'll take a look in some days. |
Strange error, maybe no related to this library but see also |
AutoMapper seems to had the same problem and apparently were able to fix it |
In Automapper I think this was the fixing commit:AutoMapper/AutoMapper@f3e345d |
By replacing some dependencies for .NetStandard by the "NETStandard.Library": "1.6.0" dependency ? |
Don't know. I only found this commit. I don't use UWP |
I think the commit mostly remove the code for .Net Core that depends on ILGeneration. I have removed the aot runtimes (ahead of time) from my project.json of my UWP app and I can now successfully install package 1.0.5. I won't be able to build my app for .Net Native but at least I can pursue the development until a compatible version of system.Reflection.Emit.ILGeneration (hopefully!) comes up. |
Hi! |
Can somebody point me in some direction how to solve this? |
Until there is a version of System.Reflection.Emit.ILGeneration compatible with the aot runtimes (.Net Native), I don't see what can be done. |
Anyone have any idea on this one? |
Maybe it's related to scottksmith95/LINQKit#47 I'll apply same fix and publish new NuGet. |
NuGet created (System.Linq.Dynamic.Core 1.0.6.3) which maybe solves this, please retest. |
1.0.6.3, same error for me. From the blog post Introducing .NET Standard, the following is stated:
That problably means it is not possible to generate type with TypeBuilder in .Net Native. |
So if that is the case then shouldn't it target a different profile so that it cannot be installed in profiles that do not support it? |
@MattWhilden Maybe you can shed some light here ? Can you take a look at the supported frameworks and advice maybe to change / remove some ? Like is adding netstandard 2.0 as described in the blog post above already supported ? |
Unfortunately, building against netstandard will only get you slightly further. The core problem is that Reflection.Emit is completely unsupported for platforms that only support ahead of time compilation (read: UWP). These platforms currently have no way to generate native code for any IL that you generate... that's what the warning is attempting to say (poorly). It looks like core functionality of this library needs RefEmit to work so it's probably going to be in pretty bad shape even if you can get it to restore and build. That said, I'm a bit surprised that this causes a restore failure. I would have expected runtime failures (PlatformNotSupportedException/NotImplementedException etc). I'll have to chase someone down tomorrow to see what the deal is. We have some strategies about how we might enable this in the future but nothing to share right now. |
@MattWhilden The restore failure started with Microsoft.NETCore.UniversalWindowsPlatform 5.2 Really looking forward for a way to emit types in UWP, hopefully in a near future :). Thank you for the clarification anyway. |
Thanks. That'll help me track down what happened... As I said, I'd expect that this would just cause runtime exceptions and not package restore problems. Adding runtime dynamism (JIT compiler? Interpreter??) is something we're interested in attempting for a bunch of reasons. As you could imagine, attaching that kind of component into a compiler/runtime pipeline after the fact has lots of gnarly technical issues. Question: For your scenarios, does having RefEmit be available but very slow (aka interpreter) actually help? Or do you find that the things you use RefEmit for end up being on performance critical paths? If this takes us way off topic, I'm happy to move it to email. We love getting feedback/issues/etc at [email protected]. :-D |
It's certainly right on topic for System.Linq.Dynamic.Core :) My only scenario for now is to use this library in a UWP app. The library make use of RefEmit TypeBuilder to create anonymous type to be use in select clause of linq query build at run time. I'm not sure but I think performance is not critical. Maybe @StefH can step in and add more insight. |
Correct, the https://github.com/StefH/System.Linq.Dynamic.Core/blob/master/src/System.Linq.Dynamic.Core/DynamicClassFactory.cs is used to generate a fields, getters, setters, constructors based on the properties and types you want on a DynamicClass class. If there is another way to do this in UWP, please provide some details. |
I solved this problem for winrt here: jogibear9988/System.Linq.Dynamic@c746fd1 |
@jogibear9988 : Thanks for your example. @fgoulet : Please test if the new version 1.0.6.4 can be installed on UAP 5.2.2 and also works as expected. |
As you may have seen, I did one more commit for this after the one I showed you: jogibear9988/System.Linq.Dynamic@e2dbfc7 |
Yes, with the dependency on System.Refection.Emit removed, it install fine on 5.5.2. |
I tried to make it generic, but I could not get ot working. How many do you need ? 64 max , or 256max ? |
It is for adhoc query, so the user choose the fields that he needs. It would be nice not to have a limit on the number of fields but I guest the UI would become impracticable with more than, say 128. I try replacing all the constructors of DynamicClass with this one: Now, the challenge is to modify ExpressionParser.CreateNewExpression to make Expression.New call this constructor. I did not succeed so far but I have the feeling that it should be feasible. |
I also tried public DynamicClass(params KeyValuePair<string, object>[] propertylist) But I run into problems here: var constructor = type.GetTypeInfo().DeclaredConstructors.First(x => x.GetParameters().Count() == properties.Count());
return Expression.New(constructor, parameters); |
Yes, same as me. Since the number of constructors is down to one, it it possible to get it with var constructor = type.GetTypeInfo().DeclaredConstructors.First();
but I could not make Expression.New call the constructor with params |
I don't know exactly why i did how its implemented, but i think i also tried in other ways. Maybe I've time to look over ? But we could also generate this class via tt Von meinem iPhone gesendet
|
tt/t4 is not supported in .net core However I can just generate a class myself with 128 constructors. ..... done... |
Trying to follow this example https://rogeralsing.com/2008/02/28/linq-expressions-creating-objects/, but no luck still... |
@StefH |
@fgoulet I fixed the issue the constructor. Can you please review the code ? If all is fine, I'll create a new NuGet/ |
@StefH Nice work! I tested it and works fine. |
Closing |
Just catching up after being away for a few days and y'all seem to have crushed this issue. Let me know if there are other things you find lingering. I'll +1 all of the concerns that have been expressed in this thread into our internal issues tracking this stuff. |
Hi, Having trouble understanding this thread. Sounds like DynamicLinq should work with UAP, but doesn't work for me. Maybe because my UWP version is 5.2.2? Anyway to make this combo work? I see project.json |
Closed by #72 ? |
In a new blank UWP App with Microsoft.NETCore.UniversalWindowsPlatform 5.1.0, I got a lot of downgrade warnings and this error:
System.Reflection.Emit.ILGeneration 4.0.1 provides a compile-time reference assembly for System.Reflection.Emit.ILGeneration on UAP,Version=v10.0, but there is no
run-time assembly compatible with win10-x86-aot.
When I bump the version to Microsoft.NETCore.UniversalWindowsPlatform 5.2.0, the downgrade warnings are gone but still the same error.
The text was updated successfully, but these errors were encountered: