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 325311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:12:18+00:00 2026-05-12T09:12:18+00:00

In my LINQ-to-SQL DAL, I’m getting a Specified Cast Was Not Valid. Here is

  • 0

In my LINQ-to-SQL DAL, I’m getting a “Specified Cast Was Not Valid.”

Here is the exact error:

System.InvalidCastException was unhandled by user code   Message="Specified cast is not valid." Source="System.Data.Linq"   StackTrace:
   at System.Data.Linq.IdentityManager.StandardIdentityManager.SingleKeyManager`2.TryCreateKeyFromValues(Object[] values, V& v)
   at System.Data.Linq.IdentityManager.StandardIdentityManager.IdentityCache`2.Find(Object[] keyValues)
   at System.Data.Linq.IdentityManager.StandardIdentityManager.Find(MetaType type, Object[] keyValues)
   at System.Data.Linq.CommonDataServices.GetCachedObject(MetaType type, Object[] keyValues)
   at System.Data.Linq.ChangeProcessor.GetOtherItem(MetaAssociation assoc, Object instance)
   at System.Data.Linq.ChangeProcessor.BuildEdgeMaps()
   at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
   at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
   at System.Data.Linq.DataContext.SubmitChanges()
   at DomainModel.Repository.Concrete.SqlClientRepository.InsertClientByUsername(String username, Client clientInfo) in C:\Documents and Settings\Owner\Desktop\CollectionTree v1.1\DomainModel\Repository\Concrete\SqlClientRepository.cs:line 99
   at WebUI.Secure.Controllers.ClientAdminController.EditProfile(Client clientProfile) in C:\Documents and Settings\Owner\Desktop\CollectionTree v1.1\WebUI.Secure\Controllers\ClientAdminController.cs:line 69
   at lambda_method(ExecutionScope , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7()
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation)   InnerException:

It is happening on my db.SubmitChanges().

Anyway, where in this exception is what types it is having trouble casting? It would help narrow it down if I knew what specific types it was having issues with. I can hover over the exception in Visual Studio but I don’t know what properties to look at.

  • 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-05-12T09:12:19+00:00Added an answer on May 12, 2026 at 9:12 am

    You’re SOL, at least for .NET < 4.0. I entered a Connect bug report on this (“InvalidCastException Should Display or Contain More Detail“), and they say it’s fixed.

    I haven’t seen the fix yet.

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

Sidebar

Related Questions

I use LINQ-SQL as my DAL, I then have a project called DB which
We've just started using LINQ to SQL at work for our DAL & we
Can LINQ to SQL query using NOT IN ? e.g., SELECT au_lname, state FROM
I have a Desktop application that uses Linq To SQL as the DAL. It
The setup: I use Linq to Sql for my DAL and I extend the
I'm considering using LINQ-to-SQL for creating the DAL in my app. I normally create
How can I put the LINQ to SQL generated classes in a dedicated DAL
I am using Linq to SQL as my DAL layer and during unit test
I'm using Linq to SQL for my DAL and have heard various things about
I use Linq To Sql Join Query in DAL layer, How can I define

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.