Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8618941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:13:25+00:00 2026-06-12T06:13:25+00:00

Getting an error in my (at this stage) simple c# MVC3 (Razor) application, and

  • 0

Getting an error in my (at this stage) simple c# MVC3 (Razor) application, and I can’t seem to find out what is causing the error below.

[InvalidOperationException: Sequence contains no elements]
   System.Linq.Enumerable.Last(IEnumerable`1 source) +4188046
   RouteDebug.RouteDebuggerHttpModule.OnBeginRequest(Object sender, EventArgs e) +78
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

this is all I get, no line numbers, no nothing.

I’ve tried putting breakpoints in various locations in the code, including the application_start sectin of Global.asax.cs, but these never get hit, the program just immediately bombs out with the stack trace as soon as i start debugging.

The structure of the application is as follows:

[Application.Core]
+Properties
+Reference
+Controllers
+Helpers
+Models
+AdminAreaRegistration.cs
+Global.asax.cs
[Application.Tests]
[Application.UI]
+Properties
+References
+App_Data
+Areas
    +Admin
        +Views
+Assets (css/js/images)
+Views

I’ve tried a few suggestions already, including adding the Application.Core namespace to the AdminAreaRegistration.cs file, and removing obj/bin and rebuilding.

I just can’t see whats causing the problem.

Update

AdminAreaRegistration.cs

using System.Web.Mvc;

namespace Application.Core
{
    public class AdminAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Admin";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                "Admin_default",
                "Admin/{controller}/{action}/{id}",
                new {controller = "Page", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}

Global.asax.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Application.Core
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801

    public class MvcApplication : System.Web.HttpApplication
    {
        public static void RegisterGlobalFilters(GlobalFilterCollection filters)
        {
            filters.Add(new HandleErrorAttribute());
        }

        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                "Default", // Route name
                "{controller}/{action}/{id}", // URL with parameters
                new { controller = "Page", action = "Homepage", id = UrlParameter.Optional } // Parameter defaults
            );

        }

        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterGlobalFilters(GlobalFilters.Filters);
            RegisterRoutes(RouteTable.Routes);
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:13:26+00:00Added an answer on June 12, 2026 at 6:13 am

    Glancing at RouteDebugger in reflector, the offending code is:

    private static void OnBeginRequest(object sender, EventArgs e)
    {
        if (RouteTable.Routes.Last<RouteBase>() != DebugRoute.Singleton)
        {
            RouteTable.Routes.Add(DebugRoute.Singleton);
        }
    }
    

    So: it sounds like somehow you have no routes. However, I would also wonder whether this module should actually use LastOrDefault, or basically cope better with this scenario.

    Have you ensured that you have the current and up-to-date version of RouteDebugger ?

    As for why you have no routes: maybe the pipeline is running in a different order now? First thing to do: remove that module and see if everything else works. If the site works fine minus that module, then ask Phil about it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Am getting this error message and matched my brackets and couldn't find anything wrong.
Getting this error: 2009-09-03 12:44:02.307 xcodebuild[307:10b] warning: compiler 'com.apple.compilers.llvm.clang.1_0.analyzer' is based on missing compiler
Getting this error with jquery & jquery.form. Site has been live for awhile..upgraded to
Getting this error when try to add an item to my repositories/context: Collection has
I´m getting this error while trying to commit to a svn repository: svn: MKACTIVITY
Keep getting this error after inserting a subdatasheet into a query and trying to
am getting this error when i open my site in internet explorer......... plz help
Am getting this error for my code: Undefined symbols for architecture x86_64: _spendDollars, referenced
I keep getting this error and have no idea why. I googled and scanned
I am getting this error from eway token payment API, soap:ReceiverServer was unable to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.