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: LINQ query with anonymous types throw NullReferenceException #5119

Closed
natemcmaster opened this issue Apr 19, 2016 · 7 comments
Closed

Comments

@natemcmaster
Copy link
Contributor

natemcmaster commented Apr 19, 2016

With UWP Tooling 1.3.1 (latest at time of writing), some queries that use anonymous types fail on .NET Native (aka Universal Windows Platform apps on "Release" mode).

Example query that fails:

from e in es.Select(e => new { e })
from o in os.Select(o => new { o })
where e.e.EmployeeID == o.o.EmployeeID
select new { e, o }

Example error:

System.NullReferenceException: Arg_NullReferenceException
   at UserProject!<BaseAddress>+0xa0b22c
   at SharedLibrary!<BaseAddress>+0x37975c
   at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor<>.EnumeratorExceptionInterceptor.MoveNext()
   at SharedLibrary!<BaseAddress>+0x2dca0f

Workaround

Replace anonymous types with concrete types. Although a little cumbersome, this should fix this issue. It also improves the speed and functionality of .NET Native's LINQ interpretation.

@divega
Copy link
Contributor

divega commented Apr 19, 2016

Curious about what the failure looks like.

@natemcmaster
Copy link
Contributor Author

Added example error and stack trace.

@divega
Copy link
Contributor

divega commented Apr 19, 2016

Thanks. Failure isn't great. I hope this can be fixed in .NET Native. I didn't know that nominal types made LINQ interpretation faster. That is interesting.

@rowanmiller
Copy link
Contributor

We are discussing this with the .NET Native team, hopefully they can do something to enable this for us. Leaving open so that we can track the scenario (and marking as blocked since the fix is external to us).

@rowanmiller rowanmiller modified the milestones: 1.0.1, 1.0.0 May 13, 2016
@rowanmiller rowanmiller removed the pri0 label Jul 6, 2016
@natemcmaster natemcmaster removed their assignment Aug 24, 2016
@divega divega changed the title Queries with anonymous types fail on .NET Native .NET Native: Queries with anonymous types fail on Release mode Aug 30, 2016
@xxyuze
Copy link

xxyuze commented Sep 2, 2016

I did not use anonymous types, but in the debug is very fast, less than half a second. In relese very slow, there are more than ten seconds.

await db.Bibles.Where (m => m.Scripture.Contains (text)).ToListAsync();

@divega
Copy link
Contributor

divega commented Sep 2, 2016

@Ghbi this issue is specifically about a failure with anonymous types. You should be able to find other .NET Native issues that are performance related if you do some searching. If you aren't sure whether what you are seeing has already been reported please create a new issue and provide a repro.

@rowanmiller rowanmiller modified the milestones: External, 1.1.0 Sep 16, 2016
@divega divega removed their assignment Oct 12, 2016
@rowanmiller rowanmiller changed the title .NET Native: Queries with anonymous types fail on Release mode .NET Native: LINQ query with anonymous types throw NullReferenceException Feb 27, 2017
@divega divega modified the milestones: 2.1.0, External Jul 27, 2017
@AndriySvyryd
Copy link
Member

Verified that this is fixed in the prerelease builds of EF 2.0.1 and UWP 6.0.0

@AndriySvyryd AndriySvyryd removed their assignment Aug 15, 2017
@ajcvickers ajcvickers removed this from the 2.1.0 milestone Oct 6, 2017
@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
Projects
None yet
Development

No branches or pull requests

6 participants