none
Form won't open after deployment on Win XP SP2 RRS feed

  • Question

  • Hi,

    I have an application that I have spent some time testing and getting to the bottom of issues. I have a couple that I'd like to share, if I may.

    I have a report form that contains two grids filled with data from my database. (SQL CE V3.5) I have no problems in my VS 2008 Express IDE, no errors or warnings (running VISTA Ultimate). I have published the application using Click Once deployment. Burnt to a CD and taken the CD to machine running XP SP2 and installed the application. It took quite a while to install all the prerequisites but eventually loaded them and installed my application.  Uneventful so far.  When I run the application one of the forms fails to open; this doesn't occur in the IDE on a different machine. The error is listed below. There is a lot to look through & I can't seem to put my finger on the thing that is causing the failure of the form. Thanks  I hope someone can tell me which is the important part of this voluminous diatribe!

    kind regards

    Graham Oakford


    Error Message: Unhandled Exception has occurred in your application. If you click Continue, the application will ignore this error and attempt to continue. If you click Quit, the application will close immediately.

    An error occurred creating the form. See Exception.InnerException for details. The error is: Exception has been thrown by the target of an invocation.

    Information contained in the Details section;

    See the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.

    ************** Exception Text **************
    System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details.  The error is: Exception has been thrown by the target of an invocation. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: The parameter is incorrect
       at System.Drawing.Icon.Initialize(Int32 width, Int32 height)
       at System.Drawing.Icon..ctor(SerializationInfo info, StreamingContext context)
       --- End of inner exception stack trace ---
       at System.RuntimeMethodHandle._SerializationInvoke(Object target, SignatureStruct& declaringTypeSig, SerializationInfo info, StreamingContext context)
       at System.Reflection.RuntimeConstructorInfo.SerializationInvoke(Object target, SerializationInfo info, StreamingContext context)
       at System.Runtime.Serialization.ObjectManager.CompleteISerializableObject(Object obj, SerializationInfo info, StreamingContext context)
       at System.Runtime.Serialization.ObjectManager.FixupSpecialObject(ObjectHolder holder)
       at System.Runtime.Serialization.ObjectManager.DoFixups()
       at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
       at System.Resources.ResourceReader.DeserializeObject(Int32 typeIndex)
       at System.Resources.ResourceReader.LoadObjectV2(Int32 pos, ResourceTypeCode& typeCode)
       at System.Resources.ResourceReader.LoadObject(Int32 pos, ResourceTypeCode& typeCode)
       at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase, Boolean isString)
       at System.Resources.RuntimeResourceSet.GetObject(String key, Boolean ignoreCase)
       at System.Resources.ResourceManager.GetObject(String name, CultureInfo culture, Boolean wrapUnmanagedMemStream)
       at System.Resources.ResourceManager.GetObject(String name)
       at CPE_Recorder.frmReport.InitializeComponent()
       at CPE_Recorder.frmReport..ctor()
       --- End of inner exception stack trace ---
       at CPE_Recorder.My.MyProject.MyForms.Create__Instance__[T](T Instance)
       at CPE_Recorder.My.MyProject.MyForms.get_frmReport()
       at CPE_Recorder.frmCPETransaction.OpenReportsToolStripMenuItem_Click(Object sender, EventArgs e)
       at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
       at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
       at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
       at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
       at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.ToolStrip.WndProc(Message& m)
       at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


    ************** Loaded Assemblies **************
    mscorlib
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
    ----------------------------------------
    CPE Recorder
        Assembly Version: 1.0.0.0
        Win32 Version: 1.0.0.0
        CodeBase: file:///C:/Documents%20and%20Settings/Graham/Local%20Settings/Apps/2.0/G661T46C.QX1/M53J7A02.9RZ/cper..tion_d0175cdaca77e8db_0000.0000_535b4bbfec434aec/CPE%20Recorder.exe
    ----------------------------------------
    Microsoft.VisualBasic
        Assembly Version: 8.0.0.0
        Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
    ----------------------------------------
    System
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
    ----------------------------------------
    System.Windows.Forms
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
    ----------------------------------------
    System.Drawing
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
    ----------------------------------------
    System.Configuration
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
    ----------------------------------------
    System.Xml
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
    ----------------------------------------
    System.Runtime.Remoting
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
    ----------------------------------------
    System.Data
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
    ----------------------------------------
    System.Data.DataSetExtensions
        Assembly Version: 3.5.0.0
        Win32 Version: 3.5.30729.1 built by: SP
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Data.DataSetExtensions/3.5.0.0__b77a5c561934e089/System.Data.DataSetExtensions.dll
    ----------------------------------------
    System.Core
        Assembly Version: 3.5.0.0
        Win32 Version: 3.5.30729.1 built by: SP
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll
    ----------------------------------------
    Accessibility
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
    ----------------------------------------
    System.Data.SqlServerCe
        Assembly Version: 3.5.1.0
        Win32 Version: 3.5.5692.0
        CodeBase: file:///C:/Documents%20and%20Settings/Graham/Local%20Settings/Apps/2.0/G661T46C.QX1/M53J7A02.9RZ/cper..tion_d0175cdaca77e8db_0000.0000_535b4bbfec434aec/System.Data.SqlServerCe.DLL
    ----------------------------------------
    System.Transactions
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
    ----------------------------------------
    System.EnterpriseServices
        Assembly Version: 2.0.0.0
        Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
        CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
    ----------------------------------------

    ************** JIT Debugging **************
    To enable just-in-time (JIT) debugging, the .config file for this
    application or computer (machine.config) must have the
    jitDebugging value set in the system.windows.forms section.
    The application must also be compiled with debugging
    enabled.

    For example:

    <configuration>
        <system.windows.forms jitDebugging="true" />
    </configuration>

    When JIT debugging is enabled, any unhandled exception
    will be sent to the JIT debugger registered on the computer
    rather than be handled by this dialog box.


    Hobart, Tasmania
    Wednesday, April 1, 2009 8:26 AM

Answers

  • Hello to anyone interested.

    I have resolved this issue.  One of the last things I did before deploying it was update an icon I used throughout the application. The inner exception referred to "System.Drawing.Icon.Initialize(Int32 width, Int32 height)". I went to each of the forms that used the icon and reselected it in the forms property grid. I must have changed the resolution of the icon to 32x32.

    Kept me on my toes for a day or so!

    Cheers

    Graham Oakford
    Hobart, Tasmania
    Wednesday, April 1, 2009 9:26 AM

All replies

  • Hello to anyone interested.

    I have resolved this issue.  One of the last things I did before deploying it was update an icon I used throughout the application. The inner exception referred to "System.Drawing.Icon.Initialize(Int32 width, Int32 height)". I went to each of the forms that used the icon and reselected it in the forms property grid. I must have changed the resolution of the icon to 32x32.

    Kept me on my toes for a day or so!

    Cheers

    Graham Oakford
    Hobart, Tasmania
    Wednesday, April 1, 2009 9:26 AM
  • Thanks allot!
    Had the same error: "at System.Drawing.Icon.Initialize(Int32 width, Int32 height)".
    Changing ico size to 32x32 fix everything.
    Monday, December 14, 2009 10:09 PM
  • I'm pleasd you found this useful

    kind regards

    Graham Oakford
    Hobart, Tasmania
    Monday, December 14, 2009 10:17 PM
  • Thank you so much for posting your resolution.  I deployed three applications on two servers, and one of the apps had the Win32Exception with System.Drawing.Icon.Initialize on one server, but only with certain users .  So essentially 5 out of 6 apps worked fine, but one didn't in some circumstances.

    Oddly, all 3 of the apps used the same icon, but it seems that some type of corruption or problem occurred with one, and it only caused a problem on one server with certain users.

    I removed the icon from both of the app forms, saved and closed the project, and then re-opened the project and added the icons back to the form.  I recompiled, installed the new version, and the app works fine now on the one server for all users.

    One of the strangest arcane errors that I have actually been able to resolve.

    Thanks!

    Tuesday, July 27, 2010 7:47 PM
  • Glad to be of help Steve,

    I'm surprised this is still here, it was a real headache to sort out but it is about 15 months old.  I'm pleased someone is still finding it useful.

    Kind regards

    Graham Oakford


    Hobart, Tasmania
    Tuesday, July 27, 2010 11:58 PM
  • Thank you so much Graham! I was scratching my head for the last 2 hours because of this. Changed to 32x32 and it works!

    -Mike

    Thursday, January 19, 2012 12:54 AM