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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:19:51+00:00 2026-05-26T19:19:51+00:00

I have a Silverlight ValueConverter that should take an enum and convert it to

  • 0

I have a Silverlight ValueConverter that should take an enum and convert it to a Brush. Something like this simplified example:

public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
    var brush = new SolidColorBrush(Colors.Blue);
    var entryType = (EntryType)value;
    if (entryType == EntryType.Hour)
        brush.Color = Colors.Red;
    return (brush);
}

If I want to unit-test this, it won’t work. I get this exception:

System.TypeInitializationException : The type initializer for 'MS.Internal.JoltHelper' threw an exception.
----> System.IO.FileNotFoundException : Could not load file or assembly 'System.Xml, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e' or one of its dependencies. 
at MS.Internal.JoltHelper.get_ThreadID()
at MS.Internal.XcpImports.CheckThread()
at System.Windows.DependencyObject..ctor(UInt32 nativeTypeIndex, IntPtr constructDO)
...

I know this is because in my (NUnit) unittests, a different CLR is loaded than when my Silverlight application would run. I know I shouldn’t test UI in unit-tests, but this is just testing my ValueConverter, so I think it is a valid test.

Does anyone know if and how this is testable?

  • 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-26T19:19:52+00:00Added an answer on May 26, 2026 at 7:19 pm

    I think the main problem here is that you are trying to run Silverlight code in a non-Silverlight runtime.

    Either yesterday or the day before I wrote a ValueConverter that does much the same as yours. I also wrote some tests for it. I ran the tests using the Silverlight unit test runner that comes with the Silverlight Toolkit, and the tests all ran fine.

    I’d recommend running your Silverlight tests in a Silverlight runtime, i.e. within the browser plugin. You can use the Silverlight unit test framework I mentioned above, and there is also a port of NUnit to Silverlight which you might like to try. However, I don’t know how up-to-date this Silverlight NUnit port is.

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

Sidebar

Related Questions

I have silverlight usercontrol. This contains Service Entity object. see below public partial class
I would like to have Silverlight read text. I've seen this done with the
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I have a Silverlight 2 application that is consuming a WCF service. As such,
We have a Silverlight 2 project (game) that will require a lot of character
I have a Silverlight application that is built from a set of Silverlight class
I have a Silverlight control that tries to have the same background as the
I have a Silverlight application that communications with an ASP.NET backend through WCF. I
I have Silverlight application that retrieves data from the database through a WCF Service.
I have Silverlight 4.0.50524 , but I have Silverlight SDK 4.0.50401 . This makes

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.