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. General Programming
  3. C#
  4. C# Warnings

C# Warnings

Scheduled Pinned Locked Moved C#
csharphelpquestion
8 Posts 5 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.
  • K Offline
    K Offline
    karthikgowda
    wrote on last edited by
    #1

    hi, i've got some warnings which i couldnt resolve... Could somebody pls help me with it? The list of warnings are: Warning 1 Object reference not set to an instance of an object. 0 0 Warning 2 The referenced component 'DockingToolbar' could not be found. Warning 3 The referenced component 'ImageLib.Imaging' could not be found. Warning 4 The referenced component 'ImageLib.Math' could not be found. Warning 5 The referenced component 'SourceGrid2' could not be found. Warning 6 The referenced component 'SourceLibrary' could not be found. Warning 7 The referenced component 'WeifenLuo.WinFormsUI' could not be found.

    P P OriginalGriffO G 4 Replies Last reply
    0
    • K karthikgowda

      hi, i've got some warnings which i couldnt resolve... Could somebody pls help me with it? The list of warnings are: Warning 1 Object reference not set to an instance of an object. 0 0 Warning 2 The referenced component 'DockingToolbar' could not be found. Warning 3 The referenced component 'ImageLib.Imaging' could not be found. Warning 4 The referenced component 'ImageLib.Math' could not be found. Warning 5 The referenced component 'SourceGrid2' could not be found. Warning 6 The referenced component 'SourceLibrary' could not be found. Warning 7 The referenced component 'WeifenLuo.WinFormsUI' could not be found.

      P Offline
      P Offline
      Pritesh Aryan
      wrote on last edited by
      #2

      for first one that is "Warning 1 Object reference not set to an instance of an object.0 0" you may have just declaring object..... but not create instance....... for example....... suppose one class Triangle then, 1.Declare object of Triangle class

      private triangleObj;

      2. You may don't have do the following step before using it so just do it

      triangleObj = new Triangle();

      Thanks.........

      1 Reply Last reply
      0
      • K karthikgowda

        hi, i've got some warnings which i couldnt resolve... Could somebody pls help me with it? The list of warnings are: Warning 1 Object reference not set to an instance of an object. 0 0 Warning 2 The referenced component 'DockingToolbar' could not be found. Warning 3 The referenced component 'ImageLib.Imaging' could not be found. Warning 4 The referenced component 'ImageLib.Math' could not be found. Warning 5 The referenced component 'SourceGrid2' could not be found. Warning 6 The referenced component 'SourceLibrary' could not be found. Warning 7 The referenced component 'WeifenLuo.WinFormsUI' could not be found.

        P Offline
        P Offline
        Pete OHanlon
        wrote on last edited by
        #3

        When you see errors warning you that component X could not be referenced, this normally means that the application is referencing a DLL (or DLLs) that no longer exist at the path it was picked up from. To identify whether or not this is the problem, take a look at the references for your application - if there's a little yellow warning triangle on some of the references, then these are the culprits, and they will need to be dropped and readded to your project.

        I'm not a stalker, I just know things. Oh by the way, you're out of milk.

        Forgive your enemies - it messes with their heads

        My blog | My articles | MoXAML PowerToys | Onyx

        1 Reply Last reply
        0
        • K karthikgowda

          hi, i've got some warnings which i couldnt resolve... Could somebody pls help me with it? The list of warnings are: Warning 1 Object reference not set to an instance of an object. 0 0 Warning 2 The referenced component 'DockingToolbar' could not be found. Warning 3 The referenced component 'ImageLib.Imaging' could not be found. Warning 4 The referenced component 'ImageLib.Math' could not be found. Warning 5 The referenced component 'SourceGrid2' could not be found. Warning 6 The referenced component 'SourceLibrary' could not be found. Warning 7 The referenced component 'WeifenLuo.WinFormsUI' could not be found.

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          The first thing to do is to look at each one in turn: and treat each warning as if it was an error - it probably is, and will cause other problems later when you run your code. Compile your app. Look at the error pane. Double click on the first warning - VS will take you to the line involved. The first one is obvious: you have declared a variable, but VS thinks it can see a path by which it can be used without being set first. Normally, this is because either you haven't set it at all, or there is a logic condition which sets it one of two ways, but VS thinks it might not get to one of the two. For example:

          private int GetTotal(int[] values)
          {
          int total;
          foreach(int value in count)
          {
          total = Sum(value);
          }
          return total;
          }

          You know that values will never be empty - but VS doesn't. The other errors are harder, without knowing more. Look at each line, and try to see what VS is talking about!

          Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          P K 2 Replies Last reply
          0
          • OriginalGriffO OriginalGriff

            The first thing to do is to look at each one in turn: and treat each warning as if it was an error - it probably is, and will cause other problems later when you run your code. Compile your app. Look at the error pane. Double click on the first warning - VS will take you to the line involved. The first one is obvious: you have declared a variable, but VS thinks it can see a path by which it can be used without being set first. Normally, this is because either you haven't set it at all, or there is a logic condition which sets it one of two ways, but VS thinks it might not get to one of the two. For example:

            private int GetTotal(int[] values)
            {
            int total;
            foreach(int value in count)
            {
            total = Sum(value);
            }
            return total;
            }

            You know that values will never be empty - but VS doesn't. The other errors are harder, without knowing more. Look at each line, and try to see what VS is talking about!

            Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

            P Offline
            P Offline
            Pete OHanlon
            wrote on last edited by
            #5

            Sorry to be pedantic but, strictly speaking, when you talk about VS seeing a path that can be used that's uninitialised, this is not accurate. Visual Studio doesn't care - it's just an IDE. It's the compiler that sees the path. I know that you know that VS isn't the compiler, but a lot of people seem to think it is.

            I'm not a stalker, I just know things. Oh by the way, you're out of milk.

            Forgive your enemies - it messes with their heads

            My blog | My articles | MoXAML PowerToys | Onyx

            OriginalGriffO 1 Reply Last reply
            0
            • P Pete OHanlon

              Sorry to be pedantic but, strictly speaking, when you talk about VS seeing a path that can be used that's uninitialised, this is not accurate. Visual Studio doesn't care - it's just an IDE. It's the compiler that sees the path. I know that you know that VS isn't the compiler, but a lot of people seem to think it is.

              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

              OriginalGriffO Offline
              OriginalGriffO Offline
              OriginalGriff
              wrote on last edited by
              #6

              I know, I know - but I don't like to add too much new stuff for beginners: they are generally confused without me adding distinctions! :-D

              Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

              "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
              "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                The first thing to do is to look at each one in turn: and treat each warning as if it was an error - it probably is, and will cause other problems later when you run your code. Compile your app. Look at the error pane. Double click on the first warning - VS will take you to the line involved. The first one is obvious: you have declared a variable, but VS thinks it can see a path by which it can be used without being set first. Normally, this is because either you haven't set it at all, or there is a logic condition which sets it one of two ways, but VS thinks it might not get to one of the two. For example:

                private int GetTotal(int[] values)
                {
                int total;
                foreach(int value in count)
                {
                total = Sum(value);
                }
                return total;
                }

                You know that values will never be empty - but VS doesn't. The other errors are harder, without knowing more. Look at each line, and try to see what VS is talking about!

                Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

                K Offline
                K Offline
                karthikgowda
                wrote on last edited by
                #7

                Thanks everyone i got it :) cheers!!!!

                1 Reply Last reply
                0
                • K karthikgowda

                  hi, i've got some warnings which i couldnt resolve... Could somebody pls help me with it? The list of warnings are: Warning 1 Object reference not set to an instance of an object. 0 0 Warning 2 The referenced component 'DockingToolbar' could not be found. Warning 3 The referenced component 'ImageLib.Imaging' could not be found. Warning 4 The referenced component 'ImageLib.Math' could not be found. Warning 5 The referenced component 'SourceGrid2' could not be found. Warning 6 The referenced component 'SourceLibrary' could not be found. Warning 7 The referenced component 'WeifenLuo.WinFormsUI' could not be found.

                  G Offline
                  G Offline
                  Ganesh Kumar Kaki
                  wrote on last edited by
                  #8

                  Hi Paste your code snippet if you have. According to the information you provided i can guess that you are forgot to refer your dll. :doh:

                  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