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

Issues with UWP on EF7 beta 6 #3293

Closed
m0ngr31 opened this issue Oct 1, 2015 · 9 comments
Closed

Issues with UWP on EF7 beta 6 #3293

m0ngr31 opened this issue Oct 1, 2015 · 9 comments

Comments

@m0ngr31
Copy link

m0ngr31 commented Oct 1, 2015

I have a UWP app ready to go, but it crashes when running in .NET native. It took me a while to pin down why (Debug runs fine), but I think this is the problem: MakeGenericMethod() cannot create this generic method instantiation because the instantiation was not metadata-enabled: 'MicrosoftDataEntityMetadataInternalClrAccessorSource<MicrosoftDataEntityMetadataInternalIClrPropertySetter>CreateGeneric<app_Unofficial.Models.appModels,MicrosoftDataEntityDbSet<app_Unofficial.Models.Favorite>. I don't even know what this means, but this is one of my Entity models. Any suggestions? The code for this is after one of my other Models. It didn't seem to have any issues?

@natemcmaster
Copy link
Contributor

Yes, this is exactly the issue we are working on in #623. It's ugly, but if you really need to work around this, you will need to add runtime directives to your project.

In Default.rd.xml, you will need to add lines that look like this (this is the bit I had to add for my testproject...names will be different for you). This is just one instance. You will probably need more, especially for queries and for anything that uses re-linq. (They also use MakeGenericMethod).

 <Type Name="Microsoft.Data.Entity.Metadata.Internal.ClrAccessorSource{Microsoft.Data.Entity.Metadata.Internal.IClrPropertySetter}">
      <MethodInstantiation Name="CreateGeneric" Arguments="NetNative.BloggingContext,Microsoft.Data.Entity.DbSet{NetNative.Blog},Microsoft.Data.Entity.DbSet{NetNative.Blog}" Dynamic="Required" />
      <MethodInstantiation Name="CreateGeneric" Arguments="NetNative.BloggingContext,Microsoft.Data.Entity.DbSet{NetNative.Post},Microsoft.Data.Entity.DbSet{NetNative.Post}" Dynamic="Required" />
  </Type>

This is an unfortunate result of https://msdn.microsoft.com/en-us/library/dn600644(v=vs.110).aspx.

A MethodInstantiation directive is required for each different instantiation of the method that is dynamically invoked, and the Arguments element is updated to reflect each different instantiation argument.

We cannot provide these directives in EF directly, but will examine better solutions than adding loads of XML to your project....stay tuned.

@m0ngr31
Copy link
Author

m0ngr31 commented Oct 1, 2015

I can't seem to get it working... I got rid of that original error, but now I'm seeing this:

TypeHandles are not supported for types that return true for ContainsGenericParameters

@natemcmaster
Copy link
Contributor

@m0ngr31 I haven't seen this error yet. .NET Native support is still a work in progress, and it is currently a minefield of bugs. If you can share any more details about this error message your project and types, which call triggered this, etc. we would appreciate it.

@m0ngr31
Copy link
Author

m0ngr31 commented Oct 1, 2015

@natemcmaster What info would help the most? I had to dig around in the memory to find that little error snip.

I can add you to my Bitbucket repo if that would be easiest?

@natemcmaster
Copy link
Contributor

@m0ngr31 Please link to your repo here so I and the community can see what is causing the issue. If it's not a public project, please create a separate, public repo that reproduces the issue without your "secret sauce".

@m0ngr31
Copy link
Author

m0ngr31 commented Oct 1, 2015

I don't have anything to hide, I'm just a terrible programmer! Here's my repo: https://github.com/m0ngr31/Wikki

Hopefully you can figure out something...

@natemcmaster
Copy link
Contributor

@m0ngr31 Thanks for sharing. The issue you encountered above ("TypeHandles ...") is a bug in UWP. I've passed along info to the net native team and they will work on fixing it. We hope to deliver a solution that doesn't require you to include lines of XML. Closing this issue as it is part of #623.

@m0ngr31
Copy link
Author

m0ngr31 commented Oct 2, 2015

Is there a way I can track the progress of this bug with the .net native team?

@natemcmaster
Copy link
Contributor

Nope. 😞 I will update #623 as we make progress on this and other issues in our dependencies.

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants