2
Vote

extract option crashes

description

Am running 1.5.1 utility under Windows 2008 Server R2 and it crashes using the extract option with the following:

Unhandled Exception: System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap.FromResource(IntPtr hinstance, String bitmapName)
at IconPatcher.ExtractIcons.ExtractFromDll(String language, DllInformation dl
l) in d:\Visual Studio Icon Patcher\Development\src\Icon Patcher\ExtractIcons.cs
:line 81
at IconPatcher.ExtractIcons.ExtractFromDll(DllInformation dll) in d:\Visual S
tudio Icon Patcher\Development\src\Icon Patcher\ExtractIcons.cs:line 56
at System.Collections.Generic.List1.ForEach(Action1 action)
at IconPatcher.ExtractIcons.Run(String[] remainingArguments) in d:\Visual Stu
dio Icon Patcher\Development\src\Icon Patcher\ExtractIcons.cs:line 43
at ManyConsole.ConsoleCommandDispatcher.DispatchCommand(IEnumerable1 command
s, String[] arguments, TextWriter consoleOut) in c:\src\ManyConsole\ManyConsole\
ConsoleCommandDispatcher.cs:line 72
at ManyConsole.ConsoleModeCommand.Run(String[] remainingArguments) in c:\src\
ManyConsole\ManyConsole\ConsoleModeCommand.cs:line 59
at ManyConsole.ConsoleCommandDispatcher.DispatchCommand(IEnumerable
1 command
s, String[] arguments, TextWriter consoleOut) in c:\src\ManyConsole\ManyConsole\
ConsoleCommandDispatcher.cs:line 72
at IconPatcher.Program.Main(String[] args) in d:\Visual Studio Icon Patcher\D
evelopment\src\Icon Patcher\Program.cs:line 21

Note that images ARE being extracted as at least 86 images were extracted prior to crashing.

file attachments

comments

PRISMAY wrote Sep 17, 2012 at 3:58 PM

I tried running 1.5.1 on my other computer with Windows 7 x86 and it crashes immediately with the following:

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at IconPatcher.Program.LoadLanguagesFor2010(String[]& allLanguages) in d:\Vis
ual Studio Icon Patcher\Development\src\Icon Patcher\Program.cs:line 64
at IconPatcher.Program.LoadLanguages() in d:\Visual Studio Icon Patcher\Devel
opment\src\Icon Patcher\Program.cs:line 46
at IconPatcher.Program.Main(String[] args) in d:\Visual Studio Icon Patcher\D
evelopment\src\Icon Patcher\Program.cs:line 29

Please let me know if you need any other information.

xt0rted wrote Sep 17, 2012 at 6:51 PM

Can you post the list of images that have been created? You can get that by using dir /b > files.txt

The second issue looks like you're running it on a machine without VS2010 installed. If you do have it installed what version are you running?

If you need to run this without VS2010, or VS2012, the latest code has an option that lets you run in extract mode or inject mode.

PRISMAY wrote Sep 17, 2012 at 8:46 PM

Attached is the list of images extract on my development computer (Windows 2008 Server R2).

My Windows 7 x86 laptop IS running both VS2010 and 2012. I still use VS2010 and have it open all day long for mainly TFS and source control use.

Here's the 2010 version info I copied from the About:
Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel
Microsoft .NET Framework
Version 4.5.50709 SP1Rel

Installed Version: Ultimate

I left out all the module-specific info.

xt0rted wrote Sep 17, 2012 at 9:12 PM

Can you check your registry under one of these spots, what keys are listed?

x64 - HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\10.0
x86 - HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\vs\Servicing\10.0

On my 2010 Pro install I see
bsln
procore
prolp (only when a language pack is installed)

PRISMAY wrote Sep 17, 2012 at 10:38 PM

x86 - under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\DevDiv\VS\Servicing\10.0
IntShell
vstscore

x64 - under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\DevDiv\vs\Servicing\10.0
bsln
IntShell
vstscore

xt0rted wrote Sep 19, 2012 at 6:00 AM

It looks like the current language check may not be right for all installs. Yours is the first I've seen without the bsln key but we can try the version key instead. This has a different value depending on your version. The options are
VSTSCore - Ultimate
VSTDCore - Premium
PROCore - Professional

Since you have Ultimate can you try downloading the code and switching the bsln key on line 100 of Program.cs to VSTSCore and trying again.

PRISMAY wrote Sep 19, 2012 at 12:54 PM

I won't have time to do this until this weekend. I'll keep you posted once I've grabbed the code and tried your suggestion. I assume the solution is a VS2012 solution? ;)

PRISMAY wrote Sep 24, 2012 at 1:40 PM

Okay, changing the source did the trick using VSTSCore on Win 7 Enterprise x86 running VS 2010 Ultimate.

I still have the original issue though with the exception while extracting the images under Windows 2008 Server R2. I did try building from source with both bsln and vstscore and both crash the same way. But the image extract process is definitely started because they're still being extracted and then the exception occurs.

PRISMAY wrote Sep 24, 2012 at 2:08 PM

I debugged into the code to see if I can get you more detail on the crash under W2008Server R2 and it's crashing at line 87 in ExtractIcons.cs, i.e.,

using (var bitmap = Bitmap.FromResource(library, dll.ImageResourceIdString))

Here is some of the debug info on the objects in and around that line. I hope it helps.

sourceDll "d:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\1033\Microsoft.VisualStudio.Windows.FormsUI.dll" string

outFile "Microsoft.VisualStudio.Windows.FormsUI.dll.2501.bmp" string

library 11206657 System.IntPtr
  • Static members
    Size 8 int
    Zero 0 System.IntPtr
dll.ImageResourceIdString "#2501" string

xt0rted wrote Sep 26, 2012 at 5:50 AM

Version 1.5.2 contains some p/invoke updates as well as better error messages. Give this a try and see if the errors persist.

PRISMAY wrote Sep 26, 2012 at 1:18 PM

1.5.2 is crashing as well.

Unhandled Exception: System.ArgumentException: Parameter is not valid.
at System.Drawing.Bitmap.FromResource(IntPtr hinstance, String bitmapName)
at IconPatcher.ExtractIcons.ExtractFromDll(String language, DllInformation dl
l) in d:\Visual Studio Icon Patcher\Development\src\Icon Patcher\ExtractIcons.cs
:line 95
at IconPatcher.ExtractIcons.ExtractFromDll(DllInformation dll) in d:\Visual S
tudio Icon Patcher\Development\src\Icon Patcher\ExtractIcons.cs:line 69
at System.Collections.Generic.List1.ForEach(Action1 action)
at IconPatcher.ExtractIcons.Run(String[] remainingArguments) in d:\Visual Stu
dio Icon Patcher\Development\src\Icon Patcher\ExtractIcons.cs:line 54
at ManyConsole.ConsoleCommandDispatcher.DispatchCommand(IEnumerable1 command
s, String[] arguments, TextWriter consoleOut) in c:\src\ManyConsole\ManyConsole\
ConsoleCommandDispatcher.cs:line 72
at ManyConsole.ConsoleModeCommand.Run(String[] remainingArguments) in c:\src\
ManyConsole\ManyConsole\ConsoleModeCommand.cs:line 59
at ManyConsole.ConsoleCommandDispatcher.DispatchCommand(IEnumerable
1 command
s, String[] arguments, TextWriter consoleOut) in c:\src\ManyConsole\ManyConsole\
ConsoleCommandDispatcher.cs:line 72
at IconPatcher.Program.Main(String[] args) in d:\Visual Studio Icon Patcher\D
evelopment\src\Icon Patcher\Program.cs:line 38

oliverkx wrote Nov 20, 2012 at 4:11 PM

I experienced the same crash during extract, using VS 2010 ultimate version 10.0.40219.1 SP1 Rel on Windows 7 64-bit. It did extract some of the icons though, and the subsequent injection into VS 2012 premium worked without errors.

The solution icon was copied correctly.
The folder icons were copied, but the edges are all dotted lines.
C# file icons have not been copied.

Not sure what the steps are to fix extract. Are the extracted icons available for download from somewhere?

Thanks,

Oliver.

Wingman_1977 wrote Jan 24, 2013 at 9:48 AM

alter ExtractIcons.cs, line 95:
using (var bitmap = Bitmap.FromResource(library, dll.ImageResourceIdString))
            {
                bitmap.Save(Path.Combine(ImageFolder, outFile), ImageFormat.Bmp);
            }
to:

try
        {
            using (var bitmap = Bitmap.FromResource(library, dll.ImageResourceIdString))
            {
                bitmap.Save(Path.Combine(ImageFolder, outFile), ImageFormat.Bmp);
            }
        }
        catch (System.ArgumentException)
        {
            //image not in correct format
        }
The exception happens because the image information is not a recognized format in a specific dll. This catch will ignore this error and continue the extraction of other images. It works perfectly for me now, all images are replaced just fine (v 1.5.2)