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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:34:54+00:00 2026-06-01T10:34:54+00:00

I am getting a file not found exception for this code: (System.IO.FileNotFoundException : Die

  • 0

I am getting a file not found exception for this code:
(System.IO.FileNotFoundException : Die Datei oder Assembly “System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e” oder eine Abhängigkeit davon wurde nicht gefunden. Das System kann die angegebene Datei nicht finden.)

public interface ISocket
{
    int Receive(byte[] buffer);
}

    [Test]
    public void ShouldMock()
    {
        var Mock = new Mock<ISocket>();
        ToBeTested Example = new ToBeTested ((ISocket)Mock.Object);
    }

I can not find my error and in no case i ever referenced a system.xml. What could have gone wrong?

EDIT:

I did never solve this problem and i am still stuck with manual mocking. I tried once again to set up a project that uses moq but failed again. Here is some other code with the same runtime error message:

    [Test]
    public void shouldLoadContextBasedOn_Type_AfterGettingContextDictionary()
    {
        Type loadableType = typeof(Context_Empty);
        var mocklib= new Mock<IDictionary<Type, Type>>();
        mocklib.SetupGet(lib => lib[loadableType]).Returns(loadableType);

        ContextLoader tested = new ContextLoader();
        tested.setContextKnowledge(mocklib.Object);
        tested.loadContext(loadableType);

        IContextBase expected = new mockContext();
        IContextBase actual = tested.getCurrentContext();

        mocklib.VerifyGet( lib => lib[typeof(Context_Empty)]);
        Assert.AreEqual(expected.ToString(), actual.ToString());
    }

The stacktray shows that moq is looking for its source before killing itself – is that it? Does it actually only work if i have the source installed under d:\Code\moq\src\Source ? This does not seem rigth. (EDIT: amd it wasnt – nunit just informed me that i can not find the files, so nothing to do with the error)

Do i have the right package? I chose silverligth4 and i am using both dlls i found in there – the others did not work because something was missing.

EDIT:

To illustrate the problem even sharper. hiere is another failing piece of code:

    [Test]
    public void mockDemo()
    {
        var crappy = new Mock<IDisposable>();
        IDisposable instance = crappy.Object; //Runtime Error
    }

And here isthe stacktrace – manual rewritten, typingerror may occur

ContextLoader_Spec mockDemo()
Mock1 get_Object()
Mock1 OnGetObject()
Mock1 InitialiseInstance()
PexProtector Invoke()
Mock1 <InitializeInstance>b_32()
ProxyGenerator CreateInterfaceProxyWithoutTarget()
DefaultProxyBuilder CreateInterfaceProxyTypeWithoutTarget()
InterfaceProxyWithTargetGenerator GenerateCode()
InterfaceProxyWithoutTargetGenerator GenerateType()
InterfaceProxyWithTargetGenerator Init()
InterfaceProxyWithTargetGenerator CreateFields()

I dont know why this exception happens.

EDIT: This seems to be a known issue withSilverlight4
EDIT: Retried with the other versions NET35/NET40/NET40Castle/Silverlight4 – all show the same error.

  • 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-01T10:34:55+00:00Added an answer on June 1, 2026 at 10:34 am

    Switching to Rhino works like a charm.
    Rhino can be downloadad seperately or is in the lib folder of your nunit testframework.

    All you have to do is switch your project properties from the .Net Client profile to the pure .Net Profile and you are good to go.

    Here is a Testsnippet that helps you control if you have done it.

    using System;
    using NUnit.Framework;
    using Rhino.Mocks;
    
    namespace Test.selftest
    {
        [TestFixture]
        class Framework_Test
        {
            [Test]
            public void ShouldCompileAndExecuteASimpleNUnitTest()
            {
                Assert.IsTrue(true);
            }
    
            [Test]
            public void ShouldVerifyRhinoMock()
            {
                ICloneable mock = MockRepository.GenerateMock<ICloneable>();
                mock.Expect(x => x.Clone()).Return(new Object()).Repeat.Times(1);
                mock.Clone();
                mock.VerifyAllExpectations();
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

While running some code I am getting a unhanded exception for file not found
I am new to use Andengine.. i getting file not found exception error when
I'm getting a file not found exception when my application is called by Outlook.
Hi I am a novice in JAVA. I have been getting this file not
I'm getting an activity not found exception. I'm starting a SplashScreen Activity and then
I am getting an error I do not understand. I am using File:Find to
Via post (not get) method, i'mm getting id's in one file in php... How
Jeff wrote about getting a file version/datestamp a while back. Visual studio doesn't increment
An unhandled exception of type 'System.ArgumentException' occurred in System.Drawing.dll Additional information: Parameter is not
In the following code, I'm having some sort of issue getting my .yaml file

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.