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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:56:06+00:00 2026-05-16T06:56:06+00:00

I’ve been breaking apart a large VS C# project into smaller projects, and while

  • 0

I’ve been breaking apart a large VS C# project into smaller projects, and while everything worked fine when it was all one project, I’m getting an error now that I’ve split it apart. There is an exception being thrown when I try a cast, though I haven’t changed any of the code. The exception is as follows:

InvalidCastException
[A]MyApplication.MyProject.MyNamespace.Class cannot be cast to [B]MyApplication.MyProject.MyNamespace.Class. Type A originates from ‘MyProgram, Version=2.4.0.46, Culture=neutral, PublicKeyToken=null’ in the context ‘Default’ at location ‘c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\rc\78e25ad5\28e4b7d\assembly\dl3\877f6451\b808fef4_4e19cb01\MyProgram.DLL’. Type B originates from ‘MyProgram, Version=2.4.0.46, Culture=neutral, PublicKeyToken=null’ in the context ‘LoadFrom’ at location ‘C:\Source\view\Application\Version\core\bin\MyProgram.dll’.

As you can see, the two types in the cast are identical, the only differences are the contexts and the locations. A method called GetHelperPage() is the source of the problem – it’s an external method in an outside application. This normally wouldn’t be a problem except that the external application then calls back to this dll. The method looks like this:

[DllImport(“EpsComHelper.dll”, EntryPoint = “EPSCOMClientGetPage”, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
private static extern int HelperGetPage(uint pClient, String sPage, StringBuilder sBuff, int nBuffSize);

This external program has the correct path for the dll: “C:\Source\view\Application\Version\core\bin\MyProgram.dll”. However, VS is loading the dll into its temporary files and running it from there as you can see by the path in the exception above. This makes it so its looking in two identical dlls, which is causing the error. I saw the responses at Reflection and casting but i don’t have ConfigurationManager.AppSettings[“DLL_File_Path”] or Assembly.LoadFrom(“path.dll”) anywhere in my solution. In fact, Assembly or LoadFrom or the location of the dll are never mentioned in the solution at all in an significant way. All I can think is that this is somehow being done behind the scenes by VS, and I can’t find anywhere where I can change it. Any help would be much appreciated.

The call stack for the error:

RedCarpetCore.dll!RedCarpet.Core.EpsInProcess.EpsConnector.ChangeLogLevel(string[] args = {string[3]}) Line 3727 + 0x1d bytes
DotNetBridge.DLL!<Module>.RunMethodInProcess(sbyte* szAssembly = 0x035b7db4, sbyte* szFullyQualifiedName = 0x08ebfcf4, sbyte* szClientPtr = 0x0bccd26c, int nArgs = 2, sbyte** arrArgs = 0x0263190c) + 0x43f bytes
[Native to Managed Transition]
DotNetScriptPlugin.dll!034d9e5f()
ntdll.dll!7c827a29()
kernel32.dll!77e6570a()
MSVCR71.DLL!7c352d9b()
MSVCR71.DLL!7c3531c5()
MSVCR71.DLL!7c352e69()
MSVCR71.DLL!7c36a582()
MSVCR71.DLL!7c34f9a2()
MSVCR71.DLL!7c34f9a2()
MSVCR71.DLL!7c350135()
MSVCR71.DLL!7c36a582()
eprise.dll!01d15fa7()
eprevent.dll!01e218f0()
eprevent.dll!01e2ec73()
eprise.dll!01ccf427()
wcc200.dll!01c0a6c5()
oleaut32.dll!77d04141()
[Managed to Native Transition]
RedCarpetCore.DLL!RedCarpet.Core.EpsInProcess.EpsClient.GetPage(string s = "/sysinfo") Line 318 + 0x1a bytes

You’ll notice the dll gets switched somewhere in all the jumble. The dll with the capital letters at the start is in the temporary files and the dll at the end with the lower-case letters is the one in the bin.

  • 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-16T06:56:07+00:00Added an answer on May 16, 2026 at 6:56 am

    When it calls the external program via HelperGetPage(), that program is then also calling back to this dll. It has the path of this dll at C:\Source\view\Application\Version\core\bin\MyProgram.dll, and even though it seems to be finding the correct dll there (as in an identical dll with the same name), it is in fact not the correct dll. The dll in this bin is being generated when that project compiles, but that dll is then copied over to the bin of the main project when it compiles. The path of the correct dll is C:\Source\view\Application\Version\application\bin\MyProgram.dll. Even though the dlls are identical, it’s running it from the application\bin folder not the core\bin folder, so that’s the dll the external program must access in order to not cause a dll mix-up.

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

Sidebar

Ask A Question

Stats

  • Questions 507k
  • Answers 507k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer It simply means it can be serialized by the pickle… May 16, 2026 at 4:07 pm
  • Editorial Team
    Editorial Team added an answer Build the convex hull from the given points Algorithms are… May 16, 2026 at 4:07 pm
  • Editorial Team
    Editorial Team added an answer There is even another option: If you use both computers… May 16, 2026 at 4:07 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I'm looking for suggestions for debugging... If you view this site in Firefox or
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.