SpecFlowOSS / SpecFlow.Rider

SpecFlow support for both ReSharper and Rider
MIT License
30 stars 18 forks source link

Wrong tableId to code in GetCodedTableId. Type HasCustomAttribute, tableId CustomAttribute #208

Closed eterekhin closed 9 months ago

eterekhin commented 10 months ago

Could you please take a look at this DEXP?

https://youtrack.jetbrains.com/issue/DEXP-754471/Wrong-tableId-to-code-in-GetCodedTableId.-Type-HasCustomAttribute-tableId-CustomAttribute

Socolin commented 10 months ago

@eterekhin Do you have any more information to share, like a stacktrace ? I cannot see any information on this ticket except the title, is it normal ?

eterekhin commented 9 months ago

Hey! Sorry, I've attached the stack trace. Looks like the problem is here. The issue here is that you can't obtain CustomAttributes from IMetadataCustomAttribute. Empty collection is returned and the foreach body after the if statement seems to be never executed

     at JetBrains.Diagnostics.LogEx.Error(ILog this, String message)
     at JetBrains.Util.Logging.Logger.LogError(String message) 
     at JetBrains.Util.Logging.Logger.Fail(String messageText)
     at JetBrains.Util.Logging.Logger.Fail(String format, Object[] args)
     at JetBrains.Metadata.Access.ILReader.CodedTokenTables.GetCodedTableId(EncodedTokenType type, MetadataTableId tableId) 
     at JetBrains.Metadata.Access.ILReader.CodedTokenTables.TokenToRawToken(MetadataToken token, MetadataTokenType targetFormat)
     at JetBrains.Metadata.Access.ILReader.ILReaderMetadataAccess.SearchInTable(MetadataTableId table, MetadataToken targetToken, MetadataTokenType targetStorageFormat, Int32 skipBytes, MetadataTokenType[] skipTokenTypes)
     at JetBrains.Metadata.Access.ILReader.MetadataAccessBase.GetCustomAttributes(MetadataToken parentToken) in GetCustomAttributes.il:line IL_0000 mvid 7C07
     at JetBrains.Metadata.EditAndContinue.EncMetadataAccessEx.GetCustomAttributesTypeNames(IMetadataAssembly metadataAssembly, MetadataToken ownerToken)
     at JetBrains.Metadata.Reader.Impl.MetadataEntity.get_CustomAttributesTypeNames()
     at ReSharperPlugin.SpecflowRiderPlugin.Caching.StepsDefinitions.ScopeAttributeUtil.GetScopesFromAttributes(ICollection`1 attributeInstances)
     at ReSharperPlugin.SpecflowRiderPlugin.Caching.StepsDefinitions.AssemblyStepDefinitions.AssemblyStepDefinitionCache.<>c__DisplayClass11_0.<Build>b__0(IPsiAssembly _, IPsiAssemblyFile _, IMetadataAssembly metadataAssembly)
     at JetBrains.ReSharper.Psi.Impl.reflection2.AssemblyFileLoaderZoned.PsiAssemblyFileLoader.InvokeProcessorAndReturn(IPsiAssemblyFile assemblyFile, IPsiAssembly psiAssembly, Action`3 processor) in InvokeProcessorAndReturn.il:line IL_003C mvid DFDF
     at JetBrains.ReSharper.Psi.Impl.reflection2.AssemblyFileLoaderZoned.PsiAssemblyFileLoader.GetOrLoadAssembly(IPsiAssembly psiAssembly, Boolean shouldLoad, Action`3 processor)
     at ReSharperPlugin.SpecflowRiderPlugin.Caching.StepsDefinitions.AssemblyStepDefinitions.AssemblyStepDefinitionCache.Build(IPsiAssembly assembly)
Socolin commented 9 months ago

Should be fix with the next version