To get a trial key
fill out the form below
Team License (standard version)
Enterprise License (extended version)
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Request our prices
New License
License Renewal
--Select currency--
USD
EUR
GBP
RUB
* By clicking this button you agree to our Privacy Policy statement

** This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.
Message submitted.

Your message has been sent. We will email you at


If you haven't received our response, please do the following:
check your Spam/Junk folder and click the "Not Spam" button for our message.
This way, you won't miss messages from our team in the future.

>
>
>
Examples of errors detected by the V301…

Examples of errors detected by the V3012 diagnostic

V3012. The '?:' operator, regardless of its conditional expression, always returns one and the same value.


MonoDevelop

V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value: WindowCommands.NextDocument. MonoDevelop.Ide WindowCommands.cs 254


public enum WindowCommands
{
  NextDocument,
  PrevDocument,
  OpenDocumentList,
  OpenWindowList,
  SplitWindowVertically,
  SplitWindowHorizontally,
  UnsplitWindow,
  SwitchSplitWindow,
  SwitchNextDocument,
  SwitchPreviousDocument
}

protected static void Switch (bool next)
{
  if (!IdeApp.Preferences.EnableDocumentSwitchDialog) {
       IdeApp.CommandService.DispatchCommand (
         next ? WindowCommands.NextDocument :
                WindowCommands.NextDocument);
       return;
  }

  var toplevel = Window.ListToplevels ()
                       .FirstOrDefault (w => w.HasToplevelFocus)
                       ?? IdeApp.Workbench.RootWindow;
  var sw = new DocumentSwitcher (toplevel, next);
  sw.Present ();
}

MonoDevelop

V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value: result.Test.FullName. GuiUnit_NET_4_5 NUnit2XmlOutputWriter.cs 207


private void StartTestElement(ITestResult result)
{
  ITest test = result.Test;
  TestSuite suite = test as TestSuite;

  if (suite != null)
  {
    xmlWriter.WriteStartElement("test-suite");
    xmlWriter.WriteAttributeString("type", suite.TestType);
    xmlWriter.WriteAttributeString("name",
      suite.TestType == "Assembly" ?
        result.Test.FullName : result.Test.FullName);
  }
  ....
}

IronPython and IronRuby

V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value: newHandlers. DebugInfoRewriter.cs 252


protected override MSAst.Expression VisitTry(
  MSAst.TryExpression node) {
  ....
  if (newHandlers != null || newFinally != null) {
    node = Ast.MakeTry(node.Type, node.Body,
      newFinally != null ? newFinally : node.Finally,
      node.Fault,
      newHandlers != null ? newHandlers : newHandlers
    );
  }
  return node;
}

.NET Compiler Platform ("Roslyn")

V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value. AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction_Pragma.cs 177


private Task<SyntaxToken>
GetNewTokenWithRemovedOrToggledPragmaAsync(....)
{
  var result = isStartToken
    ? GetNewTokenWithPragmaUnsuppress(
        token, indexOfTriviaToRemoveOrToggle, _diagnostic, Fixer,
        isStartToken, toggle)
    : GetNewTokenWithPragmaUnsuppress(
        token, indexOfTriviaToRemoveOrToggle, _diagnostic, Fixer,
        isStartToken, toggle);

  return Task.FromResult(result);
}

.NET Compiler Platform ("Roslyn")

V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value: ScriptingResources.PlusAdditionalError. CommandLineRunner.cs 428


private void DisplayDiagnostics(....)
{
  ....
  _console.Out.WriteLine(
    string.Format((notShown == 1) ?
      ScriptingResources.PlusAdditionalError :
      ScriptingResources.PlusAdditionalError,
      notShown));
  ....
}

Mono

V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value: Color.FromArgb (150, 179, 225). ProfessionalColorTable.cs 258


private void CalculateColors ()
{
  ....
  button_pressed_highlight = use_system_colors ?
                             Color.FromArgb (150, 179, 225) :
                             Color.FromArgb (150, 179, 225);
  ....
}

RunUO

V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 0xe7f. TreasureChestLevel2.cs 52


private void SetChestAppearance()
{
  bool UseFirstItemId = Utility.RandomBool();

  switch( Utility.RandomList( 0, 1, 2, 3, 4, 5, 6, 7 ) )
  {
    ....
    case 6:// Keg
      this.ItemID = ( UseFirstItemId ? 0xe7f : 0xe7f );
      this.GumpID = 0x3e;
      break;

    case 7:// Barrel
      this.ItemID = ( UseFirstItemId ? 0xe77 : 0xe77 );
      this.GumpID = 0x3e;
      break;
  }
}

Similar errors can be found in some other places:

  • V3012 The '?:' operator, regardless of its conditional expression, always returns one and the same value: 0xe77. TreasureChestLevel2.cs 57

This website uses cookies and other technology to provide you a more personalized experience. By continuing the view of our web-pages you accept the terms of using these files. If you don't want your personal data to be processed, please, leave this site.
Learn More →
Accept