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

Ignored Property causes StackOverflowException #4049

Closed
mjeanrichard opened this issue Dec 11, 2015 · 5 comments
Closed

Ignored Property causes StackOverflowException #4049

mjeanrichard opened this issue Dec 11, 2015 · 5 comments

Comments

@mjeanrichard
Copy link

The following Code causes a StackOverflow (after quite some time...):

    internal class Program
    {
        private static void Main(string[] args)
        {
            DbContextOptionsBuilder optionsBuilder = new DbContextOptionsBuilder();
            optionsBuilder.UseSqlServer(@"Server=.;Database=Test;Integrated Security=True;");

            Data data = new Data();

            TestContext context = new TestContext(optionsBuilder.Options);
            context.Jobs.Add(data);
            context.SaveChanges();
        }
    }

    public class TestContext : DbContext
    {
        public DbSet<Data> Jobs { get; set; }

        public TestContext(DbContextOptions options)
            : base(options)
        {}

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Data>().ToTable("Jobs");
            modelBuilder.Entity<Data>().Ignore(j => j.ParsedXml);
        }
    }

    public class Data
    {
        public int Id { get; set; }
        public XmlDocument ParsedXml { get; set; }
    }

If I remove the XmlDocument Property then everything works as expected.

@smitpatel
Copy link
Contributor

Which version of EF are you using?
I was not able to reproduce the stackoverflow
but with rc1-final I hit the exception same as #3894
And in latest codebase it is working perfect.

@mjeanrichard
Copy link
Author

I am using EF7 RC1 final, .Net Framework 4.6 in VS2015 as well.
I will check on Monday if Ignoring the XmlDocument Type will help (as suggested in #3894).

@mjeanrichard
Copy link
Author

It does not help if I ignore XmlDocument. I verified that I am getting a StackOverflow with rc1-final and the code above. I have not tried with the current code base. Is there a way to get the current code base as a nuget package?

@smitpatel
Copy link
Contributor

@mjeanrichard - for nightly build, add appropriate feed from http://myget.org/gallery/aspnetcidev

@mjeanrichard
Copy link
Author

With the current code base everything works as expected. Thanks for your help!

@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