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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:17:01+00:00 2026-05-28T07:17:01+00:00

To ensure coding standards I have a couple of unit test which uses reflection

  • 0

To ensure coding standards I have a couple of unit test which uses reflection to see that nothing is wrong. One of those looks like this:

[Test]
public void All_structs_should_be_immutable()
{
    var mutableStructs = typeof (Product).Assembly
        .GetTypes()
        .Where(type =>
                type.IsValueType && !type.IsCompilerGenerated() &&
                !type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic).All(
                field => field.IsInitOnly))
        .OrderBy(type => type.FullName);

    foreach (var mutableStruct in mutableStructs)
    {
        Console.WriteLine(mutableStruct.FullName);
    }

    Assert.AreEqual("", string.Join(", ", mutableStructs.Select(x => x.FullName).ToArray()));
    Assert.AreEqual(0, mutableStructs.Count());
}

The Product class is within my own assembly which has nothing to do with Jetbrains/Teamcity.

This works fine when running the tests with Resharper. But when I run it in Teamcity, I get this error:

Test(s) failed. Expected string length 0 but was 51. Strings differ at index 0.

Expected:

But was: “JetBrains.Profiler.Core.Instrumentation.DataOnStack”

———–^

at NUnit.Framework.Assert.That(Object actual, IResolveConstraint expression, String message, Object[] args)

at NUnit.Framework.Assert.AreEqual(Object expected, Object actual)

at Litium.Kamakura.UnitTest.CodingStandards.ImmutableStructs.All_structs_should_be_immutable() in c:\TeamCity\buildAgent\work\99395abb82d2a3b3\Test\Litium.Kamakura.UnitTest\CodingStandards\ImmutableStructs.cs:line 26

——- Stdout: ——-

JetBrains.Profiler.Core.Instrumentation.DataOnStack

How and why does Teamcity modify my assembly?

  • 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-28T07:17:02+00:00Added an answer on May 28, 2026 at 7:17 am

    It seems as Teamcity’s test runner (NUnit test runner?) was configured to run with dotCover / dotTrace. One of the profilers above has edited your code (remember that they are .net profilers, and they can inject code at JIT compile time, among others).

    According to this bug track, Jetbrains use this structure and will not remove it, so you will have to use a workaround.

    See also Teamcity documentation – you can try running with a different runner, or collecting coverage with NCover, or disable coverage altogether.

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

Sidebar

Related Questions

How would you ensure that only one user is logged in per account at
I have an aspx page which is checking Request.IsSecureConnection to ensure it is true,
For some derived classes, I want to ensure that one of two overloaded abstract
I have 2 objects (one hand crafted that is my expected and one is
How do you ensure, that you can checkout the code into Eclipse or NetBeans
How do you ensure that the project will be build with good design decisions
I need to ensure that any number of websites and services haven't bitten the
How do you properly ensure that a user isnt tampering with querystring values or
I would like to ensure that I only subscribe once in a particular class
How do you ensure that your applications in production are up and running? How

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.