An unhandled exception of type "System.StackOverflowException" occurred in the mscorlib.dll file

Good thing I am using asp.net mvc with linq for sql. I have a scenario that has two table groups and functions with many and many relationships with a third group of groupfeatures. I dragged all three tables into the dbml file.

The thing is, it works fine with the group, but when I call the Feature objects, the above error occured and the compilers stop at that line at ((())).

public partial class EgovtDataContext : System.Data.Linq.DataContext
{

    private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource();

    #region Extensibility Method Definitions
    partial void OnCreated();
    partial void InsertGroup(Group instance);
    partial void UpdateGroup(Group instance);
    partial void DeleteGroup(Group instance);
    partial void InsertFeature(Feature instance);
    partial void UpdateFeature(Feature instance);
    partial void DeleteFeature(Feature instance);
    partial void InsertGroupFeature(GroupFeature instance);
    partial void UpdateGroupFeature(GroupFeature instance);
    partial void DeleteGroupFeature(GroupFeature instance);
    #endregion

    (((public EgovtDataContext() : 
           base(global::System.Configuration.ConfigurationManager.ConnectionStrings["egovtsConnectionString"].ConnectionString, mappingSource))))

      

The code in both the controller file and the function file is copied. Note that all things in the group work, but the functions do not.

FeaturesRepository.cs

 public IQueryable<Feature> FindAllFeatures()
 {
     return db.Features;
 }

      

FeaturesController.cs

  FeaturesRepository FeatureRepository = new FeaturesRepository();
  public ActionResult Index()
  {
      var Feature = FeatureRepository.FindAllFeatures();

      return View(Feature);
  }

      

So what could be wrong?

+2


a source to share


1 answer


StackOverflowException usually means that you are trapped in an infinite recursive loop. If I were in your shoes, I would be looking for where one of your methods or properties could be called (or call another method chain that goes back to itself).



+3


a source







All Articles