Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. And the prize for the most stupid error messages goes to....

And the prize for the most stupid error messages goes to....

Scheduled Pinned Locked Moved The Lounge
csharphelp
32 Posts 15 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D David Radcliffe 0

    Microsoft C#. I set a function parameter (string myVar = string.Empty) and got: Default parameter value for 'myVar' must be a compile-time constant I fail to see how anything could be more constant than string.Empty.... :laugh:

    S Offline
    S Offline
    S Douglas
    wrote on last edited by
    #22

    I raise you a SQL error.. [Error Message] TITLE: SQL Server Setup failure. ------------------------------ SQL Server Setup has encountered the following error: The given key was not present in the dictionary.. For help, click: ------------------------------ BUTTONS: OK ------------------------------ [/Error Message] In the end, it was not happy about an IP address in the cluster.


    Common sense is admitting there is cause and effect and that you can exert some control over what you understand.

    1 Reply Last reply
    0
    • OriginalGriffO OriginalGriff

      Nope, it's much better! :laugh:

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #23

      What!!! I've been extremely anal about using string.Empty instead of "" and you tell me it's the lesser option.

      Never underestimate the power of human stupidity RAH

      1 Reply Last reply
      0
      • F F ES Sitecore

        You should give your variables meaningful names.

        G Offline
        G Offline
        Gary Huck
        wrote on last edited by
        #24

        Tell him there's no functions in C#.

        1 Reply Last reply
        0
        • L Lost User

          So "" != String.Empty ? :laugh:

          Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.

          W Offline
          W Offline
          Wearwolf
          wrote on last edited by
          #25

          Run this code

          if (ReferenceEquals(string.Empty, ""))
          {
          Console.WriteLine("\"\" is the same as String.Empty");
          }

          String.Empty and "" are likely to reference the same memory location so they are effectively the same (There's a name for this combining of string resources but I forget what it is). The problem with using String.Empty as a default value for a function parameter is that it's not a COMPILE time constant. The value stored in String.Empty is a reference to the string "" stored in memory and that reference doesn't get set until the program starts and the string "" gets loaded into memory. Because how can you have a reference to a memory location before the program has started? So basically this error message is 100% accurate. It wanted a compile time constant but was given a runtime constant and it said "That's not good enough, mate".

          L 1 Reply Last reply
          0
          • W Wearwolf

            Run this code

            if (ReferenceEquals(string.Empty, ""))
            {
            Console.WriteLine("\"\" is the same as String.Empty");
            }

            String.Empty and "" are likely to reference the same memory location so they are effectively the same (There's a name for this combining of string resources but I forget what it is). The problem with using String.Empty as a default value for a function parameter is that it's not a COMPILE time constant. The value stored in String.Empty is a reference to the string "" stored in memory and that reference doesn't get set until the program starts and the string "" gets loaded into memory. Because how can you have a reference to a memory location before the program has started? So basically this error message is 100% accurate. It wanted a compile time constant but was given a runtime constant and it said "That's not good enough, mate".

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #26

            I wasn't too serious :laugh: However, I think it would make sense if Microsoft actually allow parameters to have a default value of string.Empty instead of "". It's always been pushed as being a bad practice to have 'magic strings' in code.

            Now is it bad enough that you let somebody else kick your butts without you trying to do it to each other? Now if we're all talking about the same man, and I think we are... it appears he's got a rather growing collection of our bikes.

            1 Reply Last reply
            0
            • D David Radcliffe 0

              Microsoft C#. I set a function parameter (string myVar = string.Empty) and got: Default parameter value for 'myVar' must be a compile-time constant I fail to see how anything could be more constant than string.Empty.... :laugh:

              K Offline
              K Offline
              Kelly J Grant
              wrote on last edited by
              #27

              Many of you may not be old enough to remember this one. Dumbest error message I ever saw was from early Microsoft DOS: Keyboard not found. Press Enter to continue.

              J 1 Reply Last reply
              0
              • D David Radcliffe 0

                Microsoft C#. I set a function parameter (string myVar = string.Empty) and got: Default parameter value for 'myVar' must be a compile-time constant I fail to see how anything could be more constant than string.Empty.... :laugh:

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #28

                What about: Keyboard not found. Press any key to continue.

                1 Reply Last reply
                0
                • D David Radcliffe 0

                  If it is set to readonly so can never change, doesn't that make it constant?

                  D Offline
                  D Offline
                  Daniel Wilianto
                  wrote on last edited by
                  #29

                  Bro... Readonly field / variable is not the same as constant. I thought it was a very basic knowledge. It seems that I was wrong.

                  1 Reply Last reply
                  0
                  • D David Radcliffe 0

                    Microsoft C#. I set a function parameter (string myVar = string.Empty) and got: Default parameter value for 'myVar' must be a compile-time constant I fail to see how anything could be more constant than string.Empty.... :laugh:

                    P Offline
                    P Offline
                    Peltier Cooler
                    wrote on last edited by
                    #30

                    Nah, it's this one: I ran into a nasty little problem while creating the .CAB file which contains the installation, since I have a thousand sound files, which is more than the cabwiz.exe which comes with Visual Studio 2008 can accommodate…and the error code for this defect is completely unhelpful, in the grand Microsoft tradition: Error: File c:\users\[me]\appdata\local\temp\wizbbe1.inf contains DirIDs, which are not supported ERROR: The Windows CE CAB Wizard encountered an error. See the output window for more information. It turns out that VS2008’s cabwiz.exe chokes on more than 998 included files, and this application has 1057. The workaround is to download the SDK for Windows Mobile 6 and use the cabwiz.exe (and the cabwiz.ddf) from that version instead (C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\SDKTools\CabWiz.exe and CabWiz.ddf with the ones under C:\Program Files\Windows Mobile 6 SDK\Tools\CabWiz). No problem once I had done this. Painful details: Win CE Audible Spanish Flashcards | Stuffilike.net[^]

                    1 Reply Last reply
                    0
                    • K Kelly J Grant

                      Many of you may not be old enough to remember this one. Dumbest error message I ever saw was from early Microsoft DOS: Keyboard not found. Press Enter to continue.

                      J Offline
                      J Offline
                      James Curran
                      wrote on last edited by
                      #31

                      Actually, that was from the ROM BIOS. (ANd I haven't tried in a while, but you can probably still get it)

                      Truth, James

                      1 Reply Last reply
                      0
                      • D David Radcliffe 0

                        Microsoft C#. I set a function parameter (string myVar = string.Empty) and got: Default parameter value for 'myVar' must be a compile-time constant I fail to see how anything could be more constant than string.Empty.... :laugh:

                        J Offline
                        J Offline
                        James Curran
                        wrote on last edited by
                        #32

                        Wait I can beat that. I got that same error message just this week, and this code (simplified):

                        Func Five = ()=>5;

                        void MyFunc(Func func = Five) { }

                        How is THAT not a constant?

                        Truth, James

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups