0

I have a VS extension project.

In the project I need to traverse thru all class and find all public properties with public getters.

the code looks like

        private static IEnumerable<IntellisenseProperty> GetProperties(CodeElements props, HashSet<string> traversedTypes, HashSet<string> references = null)
        {
            return from p in props.OfType<CodeProperty>()
                   where !p.Attributes.Cast<CodeAttribute>().Any(a => "System.Runtime.Serialization.IgnoreDataMemberAttribute" == a.FullName || "Newtonsoft.Json.JsonIgnoreAttribute" == a.FullName)
                   where vsCMAccess.vsCMAccessPublic == p.Access && p.Getter != null && !p.Getter.IsShared && vsCMAccess.vsCMAccessPublic == p.Getter.Access
                   select new IntellisenseProperty
                   {
                       Name = GetName(p),
                       Type = GetType(p.Parent, p.Type, traversedTypes, references),
                       Summary = GetSummary(p),
                       JsonName = GetJsonName(p)
                   };
        }

the following input cause the issue

sing System.ComponentModel.DataAnnotations;
using Microsoft.AspNet.Identity;
using Newtonsoft.Json;
using System.Runtime.Serialization;

namespace ClaimsManager.Models.UI
{
    public class WindowsAccount
    {     
        [JsonProperty("Test")]
        public string UserName { get; set; }
        [Required]
        public string Domain { get; set; }

        public string WindowsUserID => $"{Domain}\\{UserName}"; 

        [JsonIgnore]
        public UserLoginInfo UserLogin => new UserLoginInfo("Windows", WindowsUserID);


    }
}

works great till it gets to

public string WindowsUserID => $"{Domain}\\{UserName}"; 

where it blows up on vsCMAccess.vsCMAccessPublic == p.Getter.Access with a COMException.

stack trace at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo) at Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.Exceptions.ThrowEFail() at Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.CSharpCodeModelService.GetDefaultAccessibility(SyntaxNode node) at Microsoft.VisualStudio.LanguageServices.CSharp.CodeModel.CSharpCodeModelService.GetAccess(SyntaxNode node) at Microsoft.VisualStudio.LanguageServices.Implementation.CodeModel.InternalElements.CodeAccessorFunction.get_Access() at EnvDTE.CodeFunction.get_Access() at TypeScriptDefinitionGenerator.IntellisenseParser.IsPublic(CodeFunction cf) in C:\code\GitHub\TypeScriptDefinitionGenerator\src\Generator\IntellisenseParser.cs:line 190

HResult = 0x80004005

Message "Error HRESULT E_FAIL has been returned from a call to a COM component

Source "EnvDTE"

TargetSite {EnvDTE.vsCMAccess get_Access()}

the only properties this happens on are all expression-bodied members

Is the a EnvDTE issue?

If it is an EnvDTE issue....how / where do I report it.

Robert Raboud
  • 1,004
  • 8
  • 7
  • 1
    There are *thousands* of different kinds of COMExceptions. There is no point whatsoever to force us to guess which one you got. At minimum the HResult, any message you see. – Hans Passant May 12 '17 at 12:52
  • added exception information – Robert Raboud May 12 '17 at 13:24
  • so access denied....but really doesn't say anything...the input code is valid code so EnvDTE should not blow up. – Robert Raboud May 12 '17 at 13:27
  • Do *not* try to understand C# code with a parser that was made to understand TypeScript code. They are vastly different languages. If you think this is sensible anyway for some reason, or just not happy with the quality of the error reporting, then simply click the New Issue button in the GitHub project. – Hans Passant May 12 '17 at 13:33
  • What does EnvDTE have to do with TypeScript? All code here is C#. EnvDTE is not a GitHub project. – Robert Raboud May 12 '17 at 13:57
  • Ok I put a bug and fix into Roslyn....it is scheduled for the 15.3 release – Robert Raboud May 18 '17 at 19:01

1 Answers1

0

Ok I put a bug and fix into Roslyn....it is scheduled for the 15.3 release

Robert Raboud
  • 1,004
  • 8
  • 7