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. Weird Exception

Weird Exception

Scheduled Pinned Locked Moved C#
sysadminhelpquestion
4 Posts 3 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
    kingletas
    wrote on last edited by
    #1

    Hello everyone, I think tonight is not my night... I wondering if any of you has gotten this exception or know why i am getting it. System.InvalidOperationException was unhandled Message="SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application." Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(Boolean defaultValue) at Client.Program.Main() in I:\Documents\Server\Client\Client\Program.cs:line 17 I have 2 applications a client and a server and i Compiled them both on the same computer before it did not seem to be any problem but not it does... I wonder why? Thanks in advance

    Luis E Tineo S

    C G 2 Replies Last reply
    0
    • K kingletas

      Hello everyone, I think tonight is not my night... I wondering if any of you has gotten this exception or know why i am getting it. System.InvalidOperationException was unhandled Message="SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application." Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(Boolean defaultValue) at Client.Program.Main() in I:\Documents\Server\Client\Client\Program.cs:line 17 I have 2 applications a client and a server and i Compiled them both on the same computer before it did not seem to be any problem but not it does... I wonder why? Thanks in advance

      Luis E Tineo S

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Looks like a race condition, and it looks like you're setting this property too late in your application's lifetime.

      Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      K 1 Reply Last reply
      0
      • C Christian Graus

        Looks like a race condition, and it looks like you're setting this property too late in your application's lifetime.

        Christian Graus - Microsoft MVP - C++ "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

        K Offline
        K Offline
        kingletas
        wrote on last edited by
        #3

        I don't really understand but how can I fix it because running it from within vs2005 I don't get the exception on either the client or the server !?

        Luis E Tineo S

        1 Reply Last reply
        0
        • K kingletas

          Hello everyone, I think tonight is not my night... I wondering if any of you has gotten this exception or know why i am getting it. System.InvalidOperationException was unhandled Message="SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application." Source="System.Windows.Forms" StackTrace: at System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(Boolean defaultValue) at Client.Program.Main() in I:\Documents\Server\Client\Client\Program.cs:line 17 I have 2 applications a client and a server and i Compiled them both on the same computer before it did not seem to be any problem but not it does... I wonder why? Thanks in advance

          Luis E Tineo S

          G Offline
          G Offline
          Guffa
          wrote on last edited by
          #4

          What do you do before you call SetCompatibleTextRenderingDefault? If you create an instance of a form, simply do that after the call to SetCompatibleTextRenderingDefault.

          Experience is the sum of all the mistakes you have done.

          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