madskristensen / WebEssentials2015

A Visual Studio extension for web developers
Other
300 stars 92 forks source link

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component #149

Open JiriZidek opened 8 years ago

JiriZidek commented 8 years ago

System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.Exceptions.ThrowEFail() at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.ExternalElements.AbstractExternalCodeElement.get_ProjectItem() at EnvDTE.CodeClass.get_ProjectItem() at MadsKristensen.EditorExtensions.IntellisenseParser.ProcessElement(CodeElement element, List1 list, HashSet1 underProcess) in C:\projects\webessentials2015\EditorExtensions\Misc\CodeGeneration\IntellisenseParser.cs:line 89 at MadsKristensen.EditorExtensions.IntellisenseParser.ProcessFile(ProjectItem item, HashSet`1 underProcess) in C:\projects\webessentials2015\EditorExtensions\Misc\CodeGeneration\IntellisenseParser.cs:line 49 at MadsKristensen.EditorExtensions.ScriptIntellisenseListener.<>c__DisplayClass7_0.b__0() in C:\projects\webessentials2015\EditorExtensions\Misc\CodeGeneration\ScriptIntellisenseListener.cs:line 58 MessagePoco.zip

JiriZidek commented 8 years ago

I found, that this happens on class that is derived from class in another assembly.

Base:

    public class EmailAddress
    {
        public string DisplayName { get; set; }
        public string Email { get; set; }

        public override string ToString() {
            return FormatEmailAddress(DisplayName, Email);
        }

        public static string FormatEmailAddress(string displayName, string email) {
            if(string.IsNullOrWhiteSpace(displayName)) return email;
            var dn = displayName.Replace("\"", "\\\"");
            if(string.IsNullOrEmpty(email)) return dn;
            if(dn.Contains(',') || dn.Contains(';') || dn.Contains('<') || dn.Contains('>')) return $"\"{dn}\" <{email}>";
            return $"{dn} <{email}>";
        }

        public static string FormatEmailAddress(RO.Gateway g) {
            if(g == null) return null;
            return FormatEmailAddress(g.DisplayName, g.PilotAddress);
        }

        public static string FormatEmailAddress(Gateway g) {
            if(g == null) return null;
            return FormatEmailAddress(g.DisplayName, g.PilotAddress);
        }

    }

Derived - that should be converted to d.ts:

    [TypeScriptModule("Pocos")]
    public class EmailAddressPoco : EmailAddress
    {
        public int key { get; set; }            //  index
        public bool IsValid { get; set; }
    }
conficient commented 8 years ago

Getting the same error here - the code is an api controller which exports a type ApplicationUser based on IdentityUser. I commented things out to the point I had public string Test() as the sole method and it still crashed.