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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:30:55+00:00 2026-05-16T07:30:55+00:00

I have a COM library that I have to reference in my app and

  • 0

I have a COM library that I have to reference in my app and I am trying to mock its interfaces.

I am getting exceptions when I am doing this MockRepository.GenerateMock<IAmAComInterface>();

I don’t get exceptions when I do this: MockRepository.GenerateDynamicMockWithRemoting<IAmAComInterface>(); but none of my expectations are verifying.

Am I doing something wrong?

For now, I have a bunch of wrappers for all of my COM interfaces and I am mocking them, but I would really like to not have to wrap everything.

EDIT:
Exceptions with GenerateMock:
System.TypeLoadException

With the message of:
The type is marked as eligible for type equivalence, but either it has generic parameters, or it is not a structure, COM imported interface, enumeration, or delegate.

When using GenerateDynamicMockWithRemoting test failure always says Expected: 1 Actual: 0 for any expectations on the COM interface.

Using Rhino.Mocks 3.6.

  • 1 1 Answer
  • 1 View
  • 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-16T07:30:55+00:00Added an answer on May 16, 2026 at 7:30 am

    Looks like this is an issue with .NET 4.0’s “Type Equivalence”. See this for more details: http://code.google.com/p/moq/issues/detail?id=254

    The fix (as noted above) is easy by adding:

    Castle.DynamicProxy.Generators.AttributesToAvoidReplicating.Add(typeof (TypeIdentifierAttribute));
    

    To your unit test.

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

Sidebar

Related Questions

I have a sql statement that uses Difference => http://msdn.microsoft.com/en-us/library/ms188753.aspx I do this in
I have used code like this: http://msdn.microsoft.com/en-us/library/dw70f090.aspx to access database before when working in
Using this page, http://developer.android.com/sdk/compatibility-library.html , I have installed the Android Support Package, added a
I have a Nhibernate Class Library and a Web App that references it. I
I have a simple C# library that I have registered for COM interop. I
I have to build OEM versions of a COM library (DLL). Does anyone know
I have installed a sample database, specifically Northwind from http://msdn.microsoft.com/en-us/library/8b6y4c7s.aspx . After installing the
I'm looking at WCF documentation in the MSDN ( http://msdn.microsoft.com/en-us/library/bb332338.aspx ), and have come
I have built the Boost library from these instructions: http://stackoverflow.com/questions/3529163/install-boost-library-in-visual-c-2008 Directory of the unzipped
com/jniwrapper/win32/ie/WebBrowser class not found. From where can I download jniWrapper library. I have downloaded

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.