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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:24:37+00:00 2026-06-16T09:24:37+00:00

So Resharper is putting a line break before the new in my code when

  • 0

So Resharper is putting a line break before the “new” in my code when re-formatting it as follows:

var foo = new Foo
{
    Bar = null,
    Baz =
        new Baz
        {
            Bap = null,
            Bork = null,
            Help =
                new PweaseHelp
                {
                    Korben = null,
                    Dallas = null,
                    Multipass = null
                },
            Me =
                new ClearlyMyAbilityToUnderstandResharperSettingsIs(
                    null),
        }
};

But I’d really like it too do this:

var foo = new Foo
{
    Bar = null,
    Baz = new Baz
    {
        Bap = null,
        Bork = null,
        Help = new PweaseHelp
        {
            Korben = null,
            Dallas = null,
            Multipass = null
        },
        Me = new ClearlyMyAbilityToUnderstandResharperSettingsIs(null),
    }
};

I’ve delved though all the settings I have in my .DotSettings file(s) and I can’t work out what is causing it… Any help would be most appreciated 🙂

EDIT 2 (UPDATED)

Here are the R# settings that seem to be getting me close to what I have listed, you’ll still see the new line after then equals sign (with the listed configuration) unless you select “chop always” for “wrap invocation arguments” and “wrap object and collection initializer” (as suggested by Kristian).

The problem with “chop always” is that you’ll have really short method calls and object/collection initializers also chopping all the time, which looks bad, so I think what we want is:

Don’t put a new line after the equals sign for method calls / object/collection initializers (but I can’t find that setting anywhere, so it could be a bug or feature of R#).

I’ll try to raise it on the R# forums / support and report back my findings.

<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARRAY_AND_OBJECT_INITIALIZER/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ANONYMOUS_METHOD_DECLARATION_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CASE_BLOCK_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/CONTINUOUS_INDENT_MULTIPLIER/@EntryValue">1</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/EMPTY_BLOCK_STYLE/@EntryValue">TOGETHER_SAME_LINE</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_ANONYMOUS_METHOD_BLOCK/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INITIALIZER_BRACES/@EntryValue">NEXT_LINE</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TRAILING_COMMENT/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_ARGUMENTS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">150</s:Int64>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_OBJECT_AND_COLLECTION_INITIALIZER_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_PARAMETERS_STYLE/@EntryValue">CHOP_IF_LONG</s:String>
  • 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-16T09:24:38+00:00Added an answer on June 16, 2026 at 9:24 am

    If you are using R# 7.1 it could be due to the new Code Formatting Improvements. All this behavior can easily be configured under R# options:

    Resharper C# Formatting Style

    EDIT: With my settings, the closest I’ve come to your proposed solution is setting Wrap object and collection initializer to Chop always, but then, for some reason, it ignores the “Array and object initializer” setting under Braces layout and puts the opening brace on the same line, like this:

    var foo = new Foo {
        Bar = null,
        Baz = new Baz {
            Bap = null,
            Bork = null,
            Help = new PweaseHelp {
                Korben = null,
                Dallas = null,
                Multipass = null
            },
            Me = new ClearlyMyAbilityToUnderstandResharperSettingsIs(null),
        }
    };
    

    It could be some other settings I have that is causing this, but to me this looks like it’s bugged. Maybe you should contact ReSharper Support and have them take a look at it…

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

Sidebar

Related Questions

Resharper just prompted me on this line of code: private static bool shouldWriteToDatabase =
Resharper wanted me to change this code: foreach (var item in cmbxColor1.Items) { cmbxColor2.Items.Add(item);
Resharper's code formatting is generally fine, but it seems completely broken when dealing with
Resharper tells me that MemberInfo.DeclaringType can never be null: However when that code is
ReSharper says Check if 'UserHostAddress' is not null when I'm accessing HttpContext.Current.Request.UserHostAddress (it is
ReSharper has proposed me to make the following changes: From: foreach (var item in
I love resharper it makes refactoring other peoples code also most fun. www.jetbrains.com/resharper And
I would like put a bar and a line plot of two separate but
Resharper is suggesting I change the following code to an auto-property. Can anyone explain
Before installing Resharper, Ctrl + Left Click for Go to definition , Visual Studio

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.