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

.NET Native support #623

Closed
divega opened this issue Sep 4, 2014 · 24 comments
Closed

.NET Native support #623

divega opened this issue Sep 4, 2014 · 24 comments
Assignees
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Milestone

Comments

@divega
Copy link
Contributor

divega commented Sep 4, 2014

Supporting running EF based applications in .NET native is important, especially for Windows Universal Apps in the short term. This was always part of the plan for EF7 and we have made specific choices to make this easier, e.g. avoiding taking dependencies on functionality that is not available when working in .NET Native, investigating how we could use Roslyn to optimize some aspects of the application using EF at compile time, etc. This is a general placeholder for all remaining work we may need to do to support .NET Native. We need to start with investigating what the gaps are and once we have made progress we can create new work items for individual tasks we identify.

@rowanmiller rowanmiller modified the milestone: 1.0.0 Sep 5, 2014
@rowanmiller rowanmiller modified the milestones: Backlog, 7.0.0 Nov 26, 2014
@bricelam bricelam modified the milestone: Backlog Apr 16, 2015
@bricelam
Copy link
Contributor

@divega divega added the pri0 label May 7, 2015
@divega divega added this to the 7.0.0 milestone May 7, 2015
@divega divega assigned mikary and divega and unassigned mikary May 7, 2015
@divega divega assigned natemcmaster and unassigned divega Jun 3, 2015
@divega
Copy link
Contributor Author

divega commented Jun 3, 2015

@natemcmaster here is the.NET Native issue I promised I would assign to you 😄

@natemcmaster
Copy link
Contributor

Current status: a blank Windows Universal app with EF 7 referenced causes the app to crash during startup before the app can start. The same app runs just fine when not using the .NET Native toolchain.

The help instructions provided in the dialog did not provide answers.

image

@bricelam
Copy link
Contributor

bricelam commented Jun 5, 2015

@natemcmaster Remind me to show you where to get the latest Tools for Windows 10. You may encounter less red herrings than with the public previews.

@natemcmaster
Copy link
Contributor

Status updated to blocked. Waiting for now on improvements to the .NET Native toolchain that will allow us to find the source of these crashes.

@bricelam
Copy link
Contributor

I just tried this for fun on the latest bits and got:

Exception thrown: '$65_System.Reflection.MissingRuntimeArtifactException' in Unknown Module.
An exception of type '$65_System.Reflection.MissingRuntimeArtifactException' occurred in Unknown Module. but was not handled in user code
Additional information: MakeGenericMethod() cannot create this generic method instantiation because the instantiation was not metadata-enabled: 'Microsoft.Data.Entity.Metadata.Internal.ClrAccessorSource<Microsoft.Data.Entity.Metadata.Internal.IClrPropertySetter>.CreateGeneric<App6.Context,Microsoft.Data.Entity.DbSet<App6.Entity>,Microsoft.Data.Entity.DbSet<App6.Entity>>(System.Reflection.PropertyInfo)' For more information, please visit http://go.microsoft.com/fwlink/?LinkID=616868

@divega
Copy link
Contributor Author

divega commented Jul 16, 2015

I remember we were supposed to do something to explicitly enable the production of reflection metadata. Could it be that these exceptions are the consequence of not doing that?

@divega
Copy link
Contributor Author

divega commented Jul 16, 2015

The information on how to do it is actually in the link in the exception. Did you try it?

BTW, it would be a shame if we needed to include reflection information for the EF assemblies as opposed to just for the application assemblies.

@natemcmaster
Copy link
Contributor

If we are doing reflection on EF types and user-code types, won't we need metadata for both?

@natemcmaster
Copy link
Contributor

The latest Win10 (RTM) tooling allows for installing, compilation, and even launches the app just fine with EF7. At runtime, however, calling new DbContext throws this error:

Unhandled exception at 0x0201AE83 (App1.dll) in App1.exe: 0xC00000FD: Stack overflow (parameters: 0x00000000, 0x06E62EC0).

@natemcmaster
Copy link
Contributor

The compiler crashes because of IEnumerable<EntityLoadInfo>. Reaching out to the .NET Native team for help.

FYI (team), we can use dynamic in our code, but when we get ready to do perf work, we should consider alternatives. IL uses reflection to accomplish dynamic which means .NET Native will need to include a bunch of additional reflection info.

@natemcmaster
Copy link
Contributor

Unless I am mistaken, it appears we will also need some of our dependencies to add .Net Native runtime directives to their projects.

Libraries that need to add directives (there may be others)

*Note: current debugging tools for .NET Native don't make it clear which libraries are causing issues for .NET Native. The error messages I am currently encountering do not specify which metadata is missing.

@MichaelKetting
Copy link
Contributor

@natemcmaster Just figured out the Remotion.Linq feature request is related to EF. Should have known :)

Say, do you have any best practices for doing automated (regression) testing for .NET Native rd.xml? I'm thinking about figuring out who to create a .NET Native application and stuffing integration test code in there, then invoking the application as a process from my regular resting framework and check if it runs successfully or fails.

Haven't actually tried this yet, so I have no idea if I actually need a UWP application or if I can just manually call the .NET Native compiler/tooling on a run of the mill console application. Will need to read more on the documentation and stuff.

@natemcmaster
Copy link
Contributor

@MichaelKetting we haven't had much success in fully automating UWP/netnative testing either (that is, with our CI server). But, it is easy to create a UWP Unit Test app in VS 2015 with Win10 tooling installed. I haven't looked to see if NUnit will run on UWP yet, but I had no trouble getting xUnit to execute.

image

@MichaelKetting
Copy link
Contributor

Ah, that's good to know about the test app. NUnit3 apparently will support UWP tests and luckily, the MSBuildExtensions will soon support NUnit3 so that's one hurdle less when it gets to automating stuff.

Anyhow, I actually didn't realize that I could exercise unit tests for a .NET Native compiled library since it's mentioned in the docs that it all gets compiled into one big, happy UWP application.

@natemcmaster
Copy link
Contributor

For now I have been doing manual testing of .NET Native. When we actually get it working, we may try to add this to automated testing. @MichaelKetting If you find a good away to automate .NET Native testing, please share! I haven't yet found a way to integrate this with our platform-testing on CI.

@MichaelKetting
Copy link
Contributor

@natemcmaster Sure thing! :)

@rowanmiller rowanmiller modified the milestones: 7.0.0-rc1, 7.0.0 Sep 17, 2015
@rowanmiller
Copy link
Contributor

We should push to get this done for RC if possible since UWP apps can't be deployed without it. We get blocked on this often, so it may be out of our hands.

@rowanmiller
Copy link
Contributor

@natemcmaster are we completely blocked on this, or are there things we can do on our side to make it work?

@natemcmaster
Copy link
Contributor

@rowanmiller I am still not able to get EF and UWP to play nice. NuGet's latest updates also broke SQLite. Prior to the update, I was able to get parts of our framework running. Query and dependency injection have never worked.

@MichaelKetting
Copy link
Contributor

@natemcmaster just a heads-up: Haven't gotten around to .NET Native yet in re-linq (probably won't get to it before October, either) but we do accept PRs (after the Apache 2 CLA is signed :) ). If you want to discuss specifics, the https://www.re-motion.org/jira/browse/RMLNQ-92 issue's comment thread is probably best for this.

@natemcmaster
Copy link
Contributor

See also #3019

@natemcmaster
Copy link
Contributor

Made modest improvements with #3478. @rowanmiller the UWP sample application in our docs now works in release mode.

Remaining TODOs (which are not trivial):

  • Inference on types needed for query
  • ...and async query
  • ...and materialization
  • Handle projection
  • Support provider-specific value types
  • Inference of user types without an explicit DbSet<TUserType>

@natemcmaster
Copy link
Contributor

Closing now that EF has basic support for .NET Native. Complete functionality will require more changes. See issues #3603, #3604 and #3561 for further work on .NET Native.

@divega divega added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label May 8, 2017
@ajcvickers ajcvickers modified the milestones: 1.0.0-rc1, 1.0.0 Oct 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. type-enhancement
Projects
None yet
Development

No branches or pull requests

7 participants