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
  • 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-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 java library that I am accessing in VB.NET via COM. The
I have an OLE COM object that trying to write a wrapper for, I
I have a COM object written using the MS ATL library. I have declared
Have you used the Application Recovery APIs with vista? http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx Do you find them
We have a COM object implemented with C++/ATL that includes a method which will
I'm trying to write a managed library in C# that will act as an
Update https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIScreen_Class/index.html#//apple_ref/occ/instp/UIScreen/brightness That's the Apple Doc for controlling screen brightness. Below is the original
I'm using a COM object from a third party library that generates periodic events.
The process is explained here: http://msdn.microsoft.com/en-US/library/d1ae6tz5%28v=VS.80%29.aspx What I don't get from that article is
I have already added delay loading to my project, using the instructions in http://msdn.microsoft.com/en-us/library/151kt790.aspx

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.