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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:00:34+00:00 2026-05-16T11:00:34+00:00

Let me start from a real life example: Customer: Alex, just noticed something strange

  • 0

Let me start from a real life example:

Customer:
Alex, just noticed something strange in the RemovalProcessor at line 138:

if (Session.Handler.ExecutePrefetchTasks()==null); 
  Session.ExecuteDelayedQueries(); 

Should the semicolumn behind the ‘if’ be there?

Me:
Oops… I’ll send this to our guys to check, but most likely, you’re right.

Although the case is rare, I admit nearly any big project has similar issue.

I understand that semicolon (and statement block) usage rules in C# can’t be changed (personally I’d prefer Python style). But I think it’s a good idea to identify exactly this case with if statement, and classify it as an error or warning.

Few Q/A I have in mind:

  • Why warning or error should be generated in this case?

    Because it’s a developer’s mistake with may be 99% probability.

  • Why error is preferable in this case?

    In many cases warnings are ignored by developers.

    I understand this is their own problem, and there is /warnaserror
    (threat warnings as errors) switch, but since this is an error
    with very high probability, and, if it isn’t an error (really? 😉 ),
    it’s quite easy to fix this, may be it’s better to classify this case
    as an error.

    Finally, error in this case won’t “restrict” the developer,
    since such code can (and likely, must) always be rewritten
    without if statement.

  • Why warning is preferable in this case?

    This won’t break the compatibility; I also suspect some code generators
    may generate code relying on the current behavior.

So I’d be glad to hear your opinions about this.

  • 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-16T11:00:34+00:00Added an answer on May 16, 2026 at 11:00 am

    It already produces a warning:

    Possible mistaken empty statement

    I agree with you that an error would have been preferable (if you really want an empty statement, can always write it as { }, which is more explicit) — but they are not going to change the C# language in this way. It would be a breaking change, and I suspect their (read: Eric Lippert’s) justification will be “the benefit doesn’t outweigh the cost”.

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

Sidebar

Related Questions

Before I start with the real question, let me just say that I might
Let me start with a specific example of what I'm trying to do. I
Let me start by saying that I do not advocate this approach, but I
Let me start off with a bit of background. This morning one of our
Let me start by saying I'm a huge fan of the elegance of this
Let's start with the following snippet: Foreach(Record item in RecordList){ .. item = UpdateRecord(item,
Let me start out by saying that I'm not a JavaScript developer so this
Let me start by explaining our set-up: I am working with some contractors. They
First off, let me start off that I am not a .net developer. The
Let's say you want to start contributing to an open source project with thousands

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.