-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Collection Navigation property without Setter error on UWP #19535
Comments
I happened to just update a few minutes ago and hit this same issue. |
We just updated our application to EF Core 3.1 and faced the same issue. |
@bricelam @AndriySvyryd Do either of you have a machine already setup for UWP development where you could test this? |
Notes from investigation: This appears to be a bug in delegate compilation for setting read-only fields. I was able to reproduce using EF, but so far my attempts to repro outside of EF have failed--It may be that the offending code has to be compiled as a .NET Standard 2.0 library, like EF is. @YZahringer @adamhewitt627 @Mys73rion A couple of workarounds:
|
We ran into this error when running in .Net Framework 4.8 ASP.NET Web Forms application. |
Related to #19588 |
Since Currently |
@YZahringer We are watching with interest how the various U.I. platforms develop. Given all the issues we have had trying to create a good experience for UWP together with internal usage data, we have currently put it on the backburner. |
@YZahringer What are your plans in general? Will you be converting your apps use WinUI 3 on top of .NET 5/Win32, or do you intend to remain on .NET Native/UWP? |
Also, are you considering .NET MAUI (the evolution of Xamarin.Forms) as a viable alternative? |
@bricelam We mainly use EF Core SQLite on UWP with Xamarin.Forms in multiple cross-platform applications (UWP, Android, iOS). Currently we do not use WinUI "natively", but Xamarin.Forms uses WinUI 2.4 to render on UWP. WinUI 3 is still in preview and maybe supported by Xamarin.Forms 5 !11955 or reported to MAUI. The future with .NET MAUI and .NET 6 is very interesting, but it won't be before the end of next year. So in the meantime, it would be useful to find a solution to use the latest version of EF Core on cross-platform apps with Xamarin.Forms 😃 |
Multitarget |
Note from triage: UWP is not supported in .NET 6. |
Just wanted to put this here in case someone else was having this problem. This was happening to me as well for a .Net Framework web application, it was really weird because it only happened to one of our clients, the rest were fine. What I ended up finding is that the one that wasn't working didn't have the http runtime target framework set so it was running under .net 4.0, causing it to throw that exception everytime ef core was trying to initialise a collection that was set to readonly. So the fix was changing the http runtime to the one we were using (4.7.2) and this got sorted. <httpRuntime requestValidationMode="2.0" targetFramework="4.7.2" executionTimeout="600" /> |
On UWP, when a navigation property of type
ICollection
does not have a setter and is auto-initialized, an error occurs when retrieving the object or when adding it:It works correctly in
.NET Core 3.1
web app and it worked correctly in 2.2 on both platforms. UWP uses.NET Standard 2.0
, could this be the cause of a different behavior compared to.NET Core 3.1
?Steps to reproduce
This test pass on
netcoreapp3.1
but fails on Unit Test App (UWP)Further technical details
EF Core version: 3.1
Database provider: Microsoft.EntityFrameworkCore.Sqlite or InMemory
Target framework: .NET Standard 2.0
Operating system: Windows 10.0.18362
IDE: Visual Studio 2019 16.4.2
The text was updated successfully, but these errors were encountered: