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. TargetInvocationException

TargetInvocationException

Scheduled Pinned Locked Moved C#
dotnetdata-structures
6 Posts 4 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.
  • G Offline
    G Offline
    Gilbert Consellado
    wrote on last edited by
    #1

    Its so bad i cant find any solution on this exception. The program is running well on the windows 7 machine, but its not working on windows XP(ugh.. they cant move on their old machine). I am getting this exception Exception Info: System.Reflection.TargetInvocationException base on the stack the exception started at Properties.Resources.get_mainIcon() now looking at the IL, the cause of the exception is setting the form icon

    form.Icon = Properties.Resources.mainIcon;

    can anybody here shade me some light. any advice will be appreciated. Thank you.

    P L 2 Replies Last reply
    0
    • G Gilbert Consellado

      Its so bad i cant find any solution on this exception. The program is running well on the windows 7 machine, but its not working on windows XP(ugh.. they cant move on their old machine). I am getting this exception Exception Info: System.Reflection.TargetInvocationException base on the stack the exception started at Properties.Resources.get_mainIcon() now looking at the IL, the cause of the exception is setting the form icon

      form.Icon = Properties.Resources.mainIcon;

      can anybody here shade me some light. any advice will be appreciated. Thank you.

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

      Is there an InnerException being raised?

      G 1 Reply Last reply
      0
      • G Gilbert Consellado

        Its so bad i cant find any solution on this exception. The program is running well on the windows 7 machine, but its not working on windows XP(ugh.. they cant move on their old machine). I am getting this exception Exception Info: System.Reflection.TargetInvocationException base on the stack the exception started at Properties.Resources.get_mainIcon() now looking at the IL, the cause of the exception is setting the form icon

        form.Icon = Properties.Resources.mainIcon;

        can anybody here shade me some light. any advice will be appreciated. Thank you.

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

        Sounds like code blowing inside a constructor. Can you show us the code from the stacktrace?

        Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

        G 1 Reply Last reply
        0
        • P Pete OHanlon

          Is there an InnerException being raised?

          G Offline
          G Offline
          Gilbert Consellado
          wrote on last edited by
          #4

          Finally, I made it worked. The problem is on the icon itself, it doesn't support some resolution. The solution is, I just create an icon that has 16x16, 32x32, 48x48 pixel resolutions. BTW thank you for the reply.

          H 1 Reply Last reply
          0
          • L Lost User

            Sounds like code blowing inside a constructor. Can you show us the code from the stacktrace?

            Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^][](X-Clacks-Overhead: GNU Terry Pratchett)

            G Offline
            G Offline
            Gilbert Consellado
            wrote on last edited by
            #5

            Thanks for the reply, here is the actual stack trace.

            Exception Info: System.Reflection.TargetInvocationException
            Stack:
            at System.RuntimeMethodHandle._SerializationInvoke(System.IRuntimeMethodInfo, System.Object, System.SignatureStruct ByRef, System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
            at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(System.Object, System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
            at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(System.Runtime.Serialization.ObjectHolder)
            at System.Runtime.Serialization.ObjectManager.DoFixups()
            at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(System.Runtime.Remoting.Messaging.HeaderHandler, System.Runtime.Serialization.Formatters.Binary.__BinaryParser, Boolean, Boolean, System.Runtime.Remoting.Messaging.IMethodCallMessage)
            at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(System.IO.Stream, System.Runtime.Remoting.Messaging.HeaderHandler, Boolean, Boolean, System.Runtime.Remoting.Messaging.IMethodCallMessage)
            at System.Resources.ResourceReader.DeserializeObject(Int32)
            at System.Resources.ResourceReader._LoadObjectV2(Int32, System.Resources.ResourceTypeCode ByRef)
            at System.Resources.ResourceReader.LoadObjectV2(Int32, System.Resources.ResourceTypeCode ByRef)
            at System.Resources.ResourceReader.LoadObject(Int32, System.Resources.ResourceTypeCode ByRef)
            at System.Resources.RuntimeResourceSet.GetObject(System.String, Boolean, Boolean)
            at System.Resources.RuntimeResourceSet.GetObject(System.String, Boolean)
            at System.Resources.ResourceManager.GetObject(System.String, System.Globalization.CultureInfo, Boolean)
            at System.Resources.ResourceManager.GetObject(System.String, System.Globalization.CultureInfo)
            at POS.Properties.Resources.get_POS_RED()
            at POS.Extensions.AssignIcon(System.Windows.Forms.Form)
            at POS.Program.Main()

            actually I already fixed the problem, see my reply above on Pete

            1 Reply Last reply
            0
            • G Gilbert Consellado

              Finally, I made it worked. The problem is on the icon itself, it doesn't support some resolution. The solution is, I just create an icon that has 16x16, 32x32, 48x48 pixel resolutions. BTW thank you for the reply.

              H Offline
              H Offline
              Herman T Instance
              wrote on last edited by
              #6

              That can help me out! Had this problem in the past on a Windows CE Device

              In Word you can only store 2 bytes. That is why I use Writer.

              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