locked
System.NotSupportedException was unhandled error help RRS feed

  • Question

  • I've just recently been getting this error every time i start to run my program from VS 2005.

    [code]
    System.NotSupportedException was unhandled
      Message="System.Drawing.Bitmap"
      StackTrace:
        at System.Resources.ResourceReader.LoadObjectV2()
        at System.Resources.ResourceReader.LoadObject()
        at System.Resources.RuntimeResourceSet.GetObject()
        at System.Resources.ResourceManager.GetObject()
        at System.Resources.ResourceManager.GetObject()
        at DeviceApplication1.CFAPGPMmain.InitializeComponent()
        at DeviceApplication1.CFAPGPMmain..ctor()
        at System.Reflection.RuntimeConstructorInfo.InternalInvoke()
        at System.Reflection.RuntimeConstructorInfo.Invoke()
        at System.Reflection.ConstructorInfo.Invoke()
        at System.Activator.CreateInstance()
        at MyForms.Create__Instance__()
        at MyForms.get_CFAPGPMmain()
        at DeviceApplication1.CFAPGPMmain.Main()
    [/code]

    When i compile it and run it on the PDA itself it runs just fine. What do i need to do to correct this because ive tryed everything! Even to the point to redue the form over again!

    David

    Saturday, March 24, 2007 4:25 AM

Answers

  • I just ran into the same problem myself. I believe it happens when for some reason a desktop version of System.Drawing.DLL is deployed into your application directory. Check your deployment window for any mentioning of System.XXX.dll being deployed. The desktop dlls are usually deployed as a result of referencing a dll build for full framework (like some of the autogenerated DLLs - tlbimp, aximp-produced)

    Another reason would be a reference to a CF1.0 assembly. If this is the case, it will be accompanied by a warning in the log:

    Consider app.config remapping of assembly "System.Drawing, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "2.0.0.0" [C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\System.Drawing.dll] to solve conflict and get rid of warning.

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning MSB3247: Found conflicts between different versions of the same dependent assembly.

    • Marked as answer by warrentang Friday, January 29, 2010 7:30 AM
    Thursday, April 12, 2007 8:16 PM

All replies

  • Anyone know how to correct this error?

    David

    Sunday, March 25, 2007 3:37 AM
  • Dear David,

     

    "... i start to run my program from VS 2005", Does it mean you debug/run your application in emulator?

    And, would you please tell me what statement throws this exception? Thanks!

     

     

    Regards,

    Zero Dai - MSFT

    Tuesday, March 27, 2007 5:00 AM
  • Yes, sorry, i start to debug/run it.

     

    The error is on this:

    Me.PictureBox1.Image = CType(resources.GetObject("PictureBox1.Image"), System.Drawing.Image)

     

    The picturebox1 is on the form so i dont know whats its not finding....

     

    David

    Wednesday, March 28, 2007 6:12 AM
  • I get the same exception, with the same stack trace. I have tried it on a VS2005, aVS2005 with SP1 and a VD2005 120 (150?) day trial edition and they all give me the same result. I've tried deploying to an emulator and to a WM5 device.

    Something that's strange is that I can create a brand new project, insert a picture box, give it an image (using the designer) and the new project works.

    Does anyone have any ideas?

    Thanks
    Tuesday, April 10, 2007 8:54 AM
  • Can one of you provide repro project?
    Wednesday, April 11, 2007 12:07 AM
  • I'm getting the same error, I built the project and added an input box in a completely seperate form which added references, later removing it and unused refs, the exception is now thrown on designer generated code

    frmMain.Designer.vb;

     

    Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))

     

    throws

    System.NotSupported Exception

    System.Drawing.Bitmap

     

     

    at System.Resources.ResourceReader.LoadObjectV2()

    at System.Resources.ResourceReader.LoadObject()
    at System.Resources.RuntimeResourceSet.GetObject()
    at System.Resources.ResourceManager.GetObject()
    at System.Resources.ResourceManager.GetObject()
    at McCurrachs.frmMain.InitializeComponent()
    at McCurrachs.frmMain..ctor()
    at System.Reflection.RuntimeConstructorInfo.InternalInvoke()
    at System.Reflection.RuntimeConstructorInfo.Invoke()
    at System.Reflection.ConstructorInfo.Invoke()
    at System.Activator.CreateInstance()"

     

    Can anyone clarify

    http://msdn2.microsoft.com/en-us/library/system.type.typehandle(vs.80).aspx

    The typehandle is what seems to be causing the exception but on the same page it say it IS and IS NOT supported.

    Help Please.

    Thursday, April 12, 2007 8:37 AM
  • Please see http://forums.microsoft.com/msdn/showpost.aspx?postid=935721&siteid=1 for a workaround if not an explanation
    Thursday, April 12, 2007 8:59 AM
  • I just ran into the same problem myself. I believe it happens when for some reason a desktop version of System.Drawing.DLL is deployed into your application directory. Check your deployment window for any mentioning of System.XXX.dll being deployed. The desktop dlls are usually deployed as a result of referencing a dll build for full framework (like some of the autogenerated DLLs - tlbimp, aximp-produced)

    Another reason would be a reference to a CF1.0 assembly. If this is the case, it will be accompanied by a warning in the log:

    Consider app.config remapping of assembly "System.Drawing, Culture=neutral, PublicKeyToken=969db8053d3322ac, Retargetable=Yes" from Version "1.0.5000.0" [] to Version "2.0.0.0" [C:\Program Files\Microsoft.NET\SDK\CompactFramework\v2.0\WindowsCE\System.Drawing.dll] to solve conflict and get rid of warning.

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets : warning MSB3247: Found conflicts between different versions of the same dependent assembly.

    • Marked as answer by warrentang Friday, January 29, 2010 7:30 AM
    Thursday, April 12, 2007 8:16 PM
  • The problem does indeed seem to have been incorrect references copied to the device application folder, after deleting the application folder from the device and analysing all project refs, rebuild & deploy has resolved the problem.
    Friday, April 13, 2007 8:52 AM