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

  • Home
  • SEARCH
  • 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 7963653
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:39:22+00:00 2026-06-04T05:39:22+00:00

I am using following code to do azure-caching and it works fine… [Serializable] public

  • 0

I am using following code to do azure-caching and it works fine…

[Serializable]
public class Person
{
    public string First { set; get; }
    public string Last { set; get; }

}

[TestClass]
public class AzureCachingTests1
{
    private static DataCacheFactory _factory;

    [TestInitialize]
    public void Setup()
    {

        _factory = new DataCacheFactory(new DataCacheFactoryConfiguration("mycache"));
    }


    [TestMethod]
    public void TestMethod1()
    {

        DataCache cache = _factory.GetDefaultCache();

        var person = new Person { First = "Jane", Last = "doe" };
        const string key = "mykey";

        cache.Put(key, person, TimeSpan.FromMinutes(10));
        var data = (Person)cache.Get(key);
        Assert.AreEqual("Jane", data.First);

    }
}

Now in another instance of Visual studio, I run the following code…

[TestClass]
public class AzureCachingTests
{
    private static DataCacheFactory _factory;
    [TestInitialize]
    public void Setup()
    {

        _factory = new DataCacheFactory(new DataCacheFactoryConfiguration("mycache"));
    }


    [TestMethod]
    public void TestMethod1()
    {

        DataCache cache = _factory.GetDefaultCache();
        const string key = "mykey";
        var data = (Person) cache.Get(key);  <----- Error here... <--------
        Assert.AreEqual("Jane", data.First);

    }
}

[Serializable]
public class Person
{
    public string First { set; get; }
    public string Last { set; get; }

}

This time, I get the following error…

Test method AzureCaching.AzureCachingTests.TestMethod1 threw exception:
System.Runtime.Serialization.SerializationException: Assembly ‘AzureCaching1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ is not found.

My class Person is Serializable. Why am I not able to query for the cache in AzureCaching that I cached in AzureCaching1 ??

Please help. thanks

  • 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-04T05:39:24+00:00Added an answer on June 4, 2026 at 5:39 am

    Unless you’ve referenced the project AzureCachingTests1 is in, your test has no idea how to deserialize the item that it is retrieving from the cache. You have two classes that have the same name and the same properties, but they’re not the same class.

    Because this you’re writing tests, you’ll need to reference the project AzureCachingTests1 is in from the project that AzureCachingTests is in and delete the class definition for Person in the AzureCachingTests project (and make sure you’re casting to the right class as well).

    If this wasn’t a test and you just wanted to share a class between two or more projects the best idea is to have a third project that contains all of the classes that are common to both, in this case it’s just the Person class.

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

Sidebar

Related Questions

I'm Using following code in flex4 mxml That works fine. <mx:Button label=Set focus to
I am using following code to create a list dynamically. It works fine but
I have using following code to set a thread on button action. public void
I am using following code for session management. public class MyClass { public static
I am using following code UiApplication.getUiApplication().invokeLater(new Runnable(){ public void run(){ // your code here
I am creating HTML using following code : NSString *string = [NSString stringWithFormat: @<html>
I am using following code and want to know whether we require to set
I'm using following code in my app: Calendar tmpCalendar = Calendar.getInstance(Locale.getDefault()); String itemTime =
I'm using following code to extract a string variable in my JavaScript file in
I have the following code: public static string FormatHostAndUrl(this HttpSessionStateBase session) { var a

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.