COMException and Photoshop classes missing in Object Model Viewer after installing Photoshop CC 2015

  • 4
  • Question
  • Updated 2 years ago
Users getting "Class not registered" errors after upgrading to Photoshop CC2015.
The errors are seen in a C# program I made some years ago, that make some calls to Photoshop to generate images in different sizes, and then register them in a databas.

It seems the all photoshop component entries are removed from the registry, and new ones not added with the new version of Photoshop.
Uninstalling, starting an older version of Photoshop (that I still had on my computer), and installing Photoshop 2015 again got the COM functionality back for me, but this doesn't always seem to help. The same actions on a user's computer didn't resolve the issue on her machine.

The error look like this:
System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {14300B0E-D530-4964-885F-5C1C4C760EBE} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

I've also noticed that the Photoshop Class entries in the Object Model Viewer (can be started from a menu in Extend Script Toolkit) disappears when you install Photoshop CC2015.
After uninstalling / reinstalling Photoshop 2014 appeared in the list (not 2015)!

It's hard to recommend customers (the ones using our programs and scripts) to update with these kind of errors, rendering their image workflows unusable.

I've described the issue on the Adobe Forum as well ( https://forums.adobe.com/thread/1875061 ), but now that I got information from a customer that the reinstallation did not help, I thought I'd add it here also, for more input.
Photo of Andreas Jansson

Andreas Jansson

  • 15 Posts
  • 14 Reply Likes

Posted 3 years ago

  • 4
Photo of Andreas Jansson

Andreas Jansson

  • 15 Posts
  • 14 Reply Likes
Today I get similar errors again.
If no Photoshop application is running when I start my C# program that opens an instance of Photoshop, I get Photoshop CS4 to open.
But if I start Photoshop CC 2015 so that it's already running, my program seems to try to communicate with CC 2015 instead. However, after 30 seconds there is just an error message:
Additional information: Retrieving the COM class factory for component with CLSID {6568E194-96D8-4035-9087-99E4F75E9ABC} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

The code I use to get a reference to Photoshop is this one:
appRef = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));

It has been working fine up until the last update of Photoshop (CC2015). What should I do?
Photo of Tom Ruark

Tom Ruark, Official Rep

  • 26 Posts
  • 11 Reply Likes
You appear to have some registry entries pointing at CS4 (launching it when none are running) and then some pointing at CC 2015. I'll look further into the exact ID's it is complaining about to see.

I would recommend the following. Uninstall CC 2015. Uninstall CS4 (make sure you have the installer for this version!). And then reinstall CS4.

That should get you back up and running with the old version.

More thoughts:
Photoshop.Application is the "newest version I have on my machine". It should of been picking up CC 2015 when no Photoshop is running and launced CC 2015.

How is your project built? It is probably using the type library for CS4 and that GUID does not exist in CC 2015. (I need to confirm this)
Photo of Andreas Jansson

Andreas Jansson

  • 15 Posts
  • 14 Reply Likes
Thanks for looking into this, Tom!
Regarding the version, eventually we will need to get this working with the new versions of Photoshop, otherwise the people using my program would have to revert to an older version of Photoshop and stick with that, and that is not likely to happen (they like to use the newest versions). So there is no real need for me to get it working in CS4 again, other than if it could somehow help us find the cause of this.

In October 2011 i rewrote this C# program to make use of "dynamics" in all references to the Photoshop objects. I did this to make it work for any version of Photoshop. That is: no explicit reference to a specific type library or version of Photoshop. It has been working fine in all versions of Photoshop CS and CC up until now. Photoshop CC 2015 seems to have changed or to miss something, which is also the case when you look in the Object Model Viewer in Extend Script Toolkit - there is no object library called Adobe Photoshop CC2015, only CC2014.

If I would like to set the application reference to CC2015 explicitly, how would I go on? I don't find the type library to set as a reference.

Using "dynamics" means that I set the application object reference like this:
appRef = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"))

The same goes for all Photoshop objects that I make use of, such as:

dynamic options = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ExportOptionsSaveForWeb"));

or

dynamic saveOpts = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.PNGSaveOptions"));

The two last samples above have been causing problems. Perhaps there is a change in ExportOptionsSaveForWeb and PNGSaveOptions in CC2015? I've been using the Object Model Viewer to look at the objects, but since there is no class library available for CC2015 I'm at a loss.
Photo of Andreas Jansson

Andreas Jansson

  • 15 Posts
  • 14 Reply Likes
I haven't uninstalled CS4 yet, but I installed a Photoshop CC2015 update that was available (no change as to the errors).
Had a look in the registry at the class id HKEY_CLASSES_ROOT\CLSID\{c09f153e-dff7-4eff-a570-af82c1a5a2a8} which seems to be InDesign CC2015, or at least the path under its LocalServer key leads to the CC 2015 application file.

Its ProgID however says "Photoshop.Application.90"... which I believe is CS2.

Here is the full branch of that registry entry, if you need me to pick something else out from the registry, to check for errors, please just ask.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\CLSID\{c09f153e-dff7-4eff-a570-af82c1a5a2a8}]
@="Photoshop Application"

[HKEY_CLASSES_ROOT\CLSID\{c09f153e-dff7-4eff-a570-af82c1a5a2a8}\LocalServer32]
@="C:\\Program Files\\Adobe\\Adobe Photoshop CC 2015 (32 Bit)\\Photoshop.exe /Automation"

[HKEY_CLASSES_ROOT\CLSID\{c09f153e-dff7-4eff-a570-af82c1a5a2a8}\ProgID]
@="Photoshop.Application.90"

[HKEY_CLASSES_ROOT\CLSID\{c09f153e-dff7-4eff-a570-af82c1a5a2a8}\Programmable]
@=""

[HKEY_CLASSES_ROOT\CLSID\{c09f153e-dff7-4eff-a570-af82c1a5a2a8}\TypeLib]
@="{E891EE9A-D0AE-4cb4-8871-F92C0109F18E}"

[HKEY_CLASSES_ROOT\CLSID\{c09f153e-dff7-4eff-a570-af82c1a5a2a8}\VersionIndependentProgID]
@="Photoshop.Application"

By the way, what entry in the registry decides which version of Photoshop to reference when I just write "Photoshop.Application", as I do with "dynamics" binding?
Photo of Andreas Jansson

Andreas Jansson

  • 15 Posts
  • 14 Reply Likes
Here is a more complete error dump from a user's computer.

Error processing 50115316.eps: System.Runtime.InteropServices.COMException (0x80041F47): Operationen har avbrutits av användaren
at System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32 hresult, Excep Info& excepInfo, UInt32 argErr, String message)
at CallSite.Target(Closure , CallSite , ComObject , String , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at CallSite.Target(Closure , CallSite , Object , String , Object )
at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid3[T0,T1,T2](CallSite site, T0 arg0, T1 arg1, T2 arg2)
at Combinations.ImageConvert.PhotoshopCS.SaveFileAsPng(Object docRef, String fullNewFilePath)

The SaveFileAsPng method contains the following code:

public void SaveFileAsPng(dynamic docRef, string fullNewFilePath) {
string sPngName = "";
// Put a jpg extension on the bare file name.
if (fullNewFilePath.IndexOf('.') >= 0)
{
sPngName = System.IO.Path.GetFileNameWithoutExtension(fullNewFilePath) + ".png";
sPngName = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(fullNewFilePath), sPngName);
}
else
{
sPngName = fullNewFilePath + ".png";
}

// Photoshop.PNGSaveOptions saveOpts = new PNGSaveOptions() ... using dynamics instead:
dynamic saveOpts = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.PNGSaveOptions"));
saveOpts.Interlaced = false;
docRef.SaveAs(sPngName, saveOpts);
}

I guess there is a change in either PNGSaveOptions or in the SaveAs method, in the latest version of Photoshop. Could you confirm that? Any idéas or answers regarding the missing CC2015 entries in the Object Model Viewer / type library?
Photo of Andreas Jansson

Andreas Jansson

  • 15 Posts
  • 14 Reply Likes
Hi,

I've been able to sort this out now, I believe. (Still waiting for a final "ok" from the users though.)

I did the following:
Uninstalling Photoshop CC2015
Uninstalling Photoshop CS4
Installing Photoshop CC2015

Now the registry seems to be more in order.

The different versions of Photoshop obviously do not go well together.

Then I could replicate the error that the users got. It turned out that their error occurred when they pressed Cancel in a Save dialogue box that showed upon the call to Save as png. (That part was not previously communicated to me.)

The Save dialogue box did not show until the upgrade to Photoshop CC 2015, and the error was actually a "User cancelled the operation" error:
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in System.Dynamic.dll
Additional information: User cancelled the operation
ErrorCode: -2147213497
I guess that should be considered an expected error (that I just didn't know you had to look for, since there had never been a user interaction here in earlier versions of Photoshop).

I don't know why the "Save as" dialogue box started to show after upgrade to Photoshop CC 2015, and it didn't even show up for all images being saved, according to the users.

The code I used was this:
dynamic saveOpts = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.PNGSaveOptions"));
saveOpts.Interlaced = false;
saveOpts.Compression = 0;
docRef.SaveAs(sPngName, saveOpts);

I changed the code into using "export" instead. Then no dialogue box shows up, but I don't know whether it affects the image quality or size in an unwanted way:
dynamic options = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.ExportOptionsSaveForWeb"));
options.format = 13; // PNG = 6 (according to Object Model Viewer)
docRef.Export(mockupValidFilePath, 2, options);

The problem is likely solved with this workaround, but I still don't see why installing CC2015 should mess up the registry if you have earlier versions of Photoshop installed (please fix that), nor why the Save As dialogue box appeared in the SaveAs call for Photoshop CC 2015.
Photo of Andreas Jansson

Andreas Jansson

  • 15 Posts
  • 14 Reply Likes
Changing the Identity from "The launching user" to "The interactive user" on the properties pane for Component services/My computer/DCOM Config/Photoshop ActionReference may also make a difference. After entering a new windows domain (meaning a new user account) the object calls to Photoshop returned errors, but after changing the identity at least I got it to work with an older version of Photoshop (CS5 extended). CC is still troubleing, so the changes in DCOM Config might not affect CC.

Perhaps a reinstallation of the programs is needed again, for CC to work.

Upgrading to latest CC2015 (yes I know there is a 2017 version as well) did not help. Running this code:
appRef = Activator.CreateInstance(Type.GetTypeFromProgID("Photoshop.Application"));
raises the following error:
Exception thrown: 'System.Runtime.InteropServices.COMException' in mscorlib.dll

Additional information: Retrieving the COM class factory for component with CLSID {D9389EDE-AEF8-4092-9377-075E94B7CB9A} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

UPDATE:
Installing Photoshop 2017 made the Photoshop objects possible to call again. Since I've got an old CS5 installation there is another Photoshop, and when (deliberately or accidentally) starting Photoshop CS5 it obviously takes precedence before the latest CC versions. I'll try not to start CS5 any more (I might need one of the other CS5 programs, and they can't be uninstalled one by one, in the version I've got installed, it's the whole studio or nothing)
(Edited)