System.InvalidCastExecption error message when a programm with Interop.photoshop.dll after updating Windows10


After updating to Windows 10, C# program on VisualStudio 2017, which processes images and uses Interop.Photoshop.dll and Interop.PhotoshopTypeLibrary.dll, got following issue :

"System.InvalidCastException: Unable to cast COM object of type 'Photoshop.ApplicationClass' to interface type 'Photoshop._Application'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).
   at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
   at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
   at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
   at Photoshop.ApplicationClass.Quit()"

The same program was working before the update and it works on windows 7 and 8.

Can someone help me?

asked on Stack Overflow Apr 3, 2018 by clementRO • edited Apr 3, 2018 by Atur

3 Answers


Solved it running Photoshop as administrator and then restart my machine. Besides that I used the following function to find my instance of PS.

And instead of crashing again, it got executed correctly:

        /// <summary>
    /// Find the Photoshop instance and return it
    /// </summary>
    /// <returns>Photoshop Application COM object</returns>
    public static Photoshop.Application SetPhotoshop()
        Type photoshopType = Type.GetTypeFromProgID("Photoshop.Application");
        Photoshop.Application psApp = null;
        object obj = Activator.CreateInstance(photoshopType);
        if (photoshopType != null)
                psApp = (Photoshop.Application)obj;
            catch (Exception ex)
                return null;
        return psApp;
answered on Stack Overflow Jul 9, 2018 by kogen00

You must close Visual Studio and start it by right clicking and choosing "Run as administrator"

answered on Stack Overflow Sep 24, 2019 by Behrooz Moghaddam • edited Sep 24, 2019 by bradbury9

Anyways, what I have found out is that it's not a Photoshop problem, it's a .Net Problem:

Using CreateInstance in Windows 10 Universal Apps

This answer suggests a solution, though I haven't tried it out yet:

InvalidCastException of a Activator.CreateInstance object during an installation procedure

answered on Stack Overflow Jun 18, 2018 by kogen00 • edited Jun 18, 2018 by divibisan

User contributions licensed under CC BY-SA 3.0