Open pflugs30 opened 1 year ago
Nah, that was me messing up my local build - fixing the test should be as simple as changing its expectations to match the actual.
@retailcoder but this is passing on both VS 2019, VS 2022 and on AV's VS 2022?
I think there's something about the Excel library. I don't think it's a 32/64 bit thing but rather the Excel library, need to double check what it's using.
@pflugs30 , could you grab the XML files from this path:
.\RubberduckTests\bin\Testfiles\Resolver
and zip it up and post it here? I want to do a diff on those files.
FYI I sent you an invite to the RD org; if you accept the invite you'll be an "official" contributor and will be able to label issues and get access to the RD3 private repository: feel free to look around, but note that I have a ton of local changes yet to be pushed there.
@pflugs30 , could you grab the XML files from this path:
.\RubberduckTests\bin\Testfiles\Resolver
and zip it up and post it here? I want to do a diff on those files.
Sorry for the delay... I'm having trouble getting the files uploaded to Github for some weird reason. If they won't go up soon, then I'll try another method.
FYI I sent you an invite to the RD org; if you accept the invite you'll be an "official" contributor and will be able to label issues and get access to the RD3 private repository: feel free to look around, but note that I have a ton of local changes yet to be pushed there.
Thank you very much! I'm happy to be a part of the team. I'm looking forward to contributing, particularly with unit testing. I think you may have known that already... 😏
@pflugs30 , could you grab the XML files from this path:
.\RubberduckTests\bin\Testfiles\Resolver
and zip it up and post it here? I want to do a diff on those files.
Here's a link to the files. I'm not sure why Github isn't working... https://file.io/HcdmSmVHc6ct
Here are the files! They finally uploaded... Resolver.zip
Unfortunately they seem to be 100% identical. Will have to look somewhere else.
@bclothier I'm running the tests again on a fresh VM with a clean VS2022 install and NO installation of MS Office of any kind. With only 4 GB RAM, the tests may take a while, so I'll send an update in a bit. The good news is the builds went super smooth! :-)
Yup, same failure on the VM.
Would any system or VS diagnostic information be helpful?
I think I'd be more interested in knowing how it arrived to the Worksheet
instead of the _Worksheet
.
If I go up through the ParentDeclaration
, it describes the _Worksheet
as a ClassModule
; there is no mention of the Worksheet
anywhere in the chain.
This is what I see when describing both (ran from immediate window while in break mode in file RubberduckTests\Symbols\SelectedDeclarationProviderTests.cs
at line 839:
?state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "Worksheet").First()
(ClassModule) Public "Worksheet" As "Worksheet" | {L1C1}
Accessibility: Public
Annotations: Count = 0
AsTypeContext: null
AsTypeDeclaration: (ClassModule) Public "Worksheet" As "Worksheet" | {L1C1}
AsTypeIsBaseType: false
AsTypeName: "Worksheet"
AsTypeNameWithoutArrayDesignator: "Worksheet"
Attributes: Count = 1
AttributesPassContext: null
ComponentName: "Worksheet"
Context: null
CustomFolder: "Excel"
DeclarationType: ClassModule
DefaultMember: null
DescriptionString: ""
FullAsTypeName: "EXCEL.EXE;Excel.Worksheet"
HasDefaultInstanceVariable: The function evaluation requires all threads to run.
HasPredeclaredId: The function evaluation requires all threads to run.
HasTypeHint: false
IdentifierName: "Worksheet"
ImplementedInterfaces: {System.Linq.Enumerable.WhereEnumerableIterator<Rubberduck.Parsing.Symbols.ClassModuleDeclaration>}
IsArray: false
IsControl: false
IsEnumeratorMember: false
IsExposed: true
IsExtensible: The function evaluation requires all threads to run.
IsGlobalClassModule: false
IsInterface: false
IsObject: true
IsObjectArray: false
IsObjectOrObjectArray: true
IsSelfAssigned: false
IsTypeSpecified: false
IsUndeclared: false
IsUserDefined: false
IsUserInterface: false
IsWithEvents: true
Members: Count = 162
ParentDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ParentScope: "VBE"
ParentScopeDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ProjectDisplayName: 'state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "Worksheet").First().ProjectDisplayName' threw an exception of type 'System.NullReferenceException'
ProjectId: "External2003575673"
ProjectName: "Excel"
QualifiedModuleName: {EXCEL.EXE;Excel.Worksheet}
QualifiedName: {EXCEL.EXE;Excel.Worksheet.Worksheet}
QualifiedSelection: {EXCEL.EXE;Excel.Worksheet L1C1}
References: Count = 1
Scope: "EXCEL.EXE;Excel.Worksheet"
Selection: {L1C1}
Subtypes: Count = 0
SupertypeNames: Count = 2
Supertypes: Count = 2
TypeHint: null
_annotations: Count = 0
_asTypeDeclaration: (ClassModule) Public "Worksheet" As "Worksheet" | {L1C1}
_hasPredeclaredId: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isExposed: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=true, IsValueFaulted=false, Value=true
_isExtensible: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isGlobal: false
_isGlobalSyncObject: {object}
_members: Count = 162
_neverArray: {Rubberduck.Parsing.Symbols.DeclarationType[18]}
_references: Count = 1
_subtypes: Count = 0
_supertypeNames: Count = 2
_supertypes: Count = 2
?state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "_Worksheet").First()
(ClassModule) Public "_Worksheet" As "_Worksheet" | {L1C1}
Accessibility: Public
Annotations: Count = 0
AsTypeContext: null
AsTypeDeclaration: (ClassModule) Public "_Worksheet" As "_Worksheet" | {L1C1}
AsTypeIsBaseType: false
AsTypeName: "_Worksheet"
AsTypeNameWithoutArrayDesignator: "_Worksheet"
Attributes: Count = 0
AttributesPassContext: null
ComponentName: "_Worksheet"
Context: null
CustomFolder: "Excel"
DeclarationType: ClassModule
DefaultMember: null
DescriptionString: ""
FullAsTypeName: "EXCEL.EXE;Excel._Worksheet"
HasDefaultInstanceVariable: The function evaluation requires all threads to run.
HasPredeclaredId: The function evaluation requires all threads to run.
HasTypeHint: false
IdentifierName: "_Worksheet"
ImplementedInterfaces: {System.Linq.Enumerable.WhereEnumerableIterator<Rubberduck.Parsing.Symbols.ClassModuleDeclaration>}
IsArray: false
IsControl: false
IsEnumeratorMember: false
IsExposed: The function evaluation requires all threads to run.
IsExtensible: The function evaluation requires all threads to run.
IsGlobalClassModule: false
IsInterface: true
IsObject: true
IsObjectArray: false
IsObjectOrObjectArray: true
IsSelfAssigned: false
IsTypeSpecified: false
IsUndeclared: false
IsUserDefined: false
IsUserInterface: false
IsWithEvents: false
Members: Count = 145
ParentDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ParentScope: "VBE"
ParentScopeDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ProjectDisplayName: 'state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "_Worksheet").First().ProjectDisplayName' threw an exception of type 'System.NullReferenceException'
ProjectId: "External2003575673"
ProjectName: "Excel"
QualifiedModuleName: {EXCEL.EXE;Excel._Worksheet}
QualifiedName: {EXCEL.EXE;Excel._Worksheet._Worksheet}
QualifiedSelection: {EXCEL.EXE;Excel._Worksheet L1C1}
References: Count = 0
Scope: "EXCEL.EXE;Excel._Worksheet"
Selection: {L1C1}
Subtypes: Count = 1
SupertypeNames: Count = 0
Supertypes: Count = 0
TypeHint: null
_annotations: Count = 0
_asTypeDeclaration: (ClassModule) Public "_Worksheet" As "_Worksheet" | {L1C1}
_hasPredeclaredId: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isExposed: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isExtensible: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isGlobal: false
_isGlobalSyncObject: {object}
_members: Count = 145
_neverArray: {Rubberduck.Parsing.Symbols.DeclarationType[18]}
_references: Count = 0
_subtypes: Count = 1
_supertypeNames: Count = 0
_supertypes: Count = 0
Here's what I get:
?state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "Worksheet").First()
(ClassModule) Public "Worksheet" As "Worksheet" | {L1C1}
Accessibility: Public
Annotations: Count = 0
AsTypeContext: null
AsTypeDeclaration: (ClassModule) Public "Worksheet" As "Worksheet" | {L1C1}
AsTypeIsBaseType: false
AsTypeName: "Worksheet"
AsTypeNameWithoutArrayDesignator: "Worksheet"
Attributes: Count = 1
AttributesPassContext: null
ComponentName: "Worksheet"
Context: null
CustomFolder: "Excel"
DeclarationType: ClassModule
DefaultMember: null
DescriptionString: ""
FullAsTypeName: "EXCEL.EXE;Excel.Worksheet"
HasDefaultInstanceVariable: The function evaluation requires all threads to run.
HasPredeclaredId: The function evaluation requires all threads to run.
HasTypeHint: false
IdentifierName: "Worksheet"
ImplementedInterfaces: {System.Linq.Enumerable.WhereEnumerableIterator<Rubberduck.Parsing.Symbols.ClassModuleDeclaration>}
IsArray: false
IsControl: false
IsEnumeratorMember: false
IsExposed: true
IsExtensible: The function evaluation requires all threads to run.
IsGlobalClassModule: false
IsInterface: false
IsObject: true
IsObjectArray: false
IsObjectOrObjectArray: true
IsSelfAssigned: false
IsTypeSpecified: false
IsUndeclared: false
IsUserDefined: false
IsUserInterface: false
IsWithEvents: true
Members: Count = 162
ParentDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ParentScope: "VBE"
ParentScopeDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ProjectDisplayName: 'state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "Worksheet").First().ProjectDisplayName' threw an exception of type 'System.NullReferenceException'
ProjectId: "External2003575673"
ProjectName: "Excel"
QualifiedModuleName: {EXCEL.EXE;Excel.Worksheet}
QualifiedName: {EXCEL.EXE;Excel.Worksheet.Worksheet}
QualifiedSelection: {EXCEL.EXE;Excel.Worksheet L1C1}
References: Count = 1
Scope: "EXCEL.EXE;Excel.Worksheet"
Selection: {L1C1}
Subtypes: Count = 0
SupertypeNames: Count = 2
Supertypes: Count = 2
TypeHint: null
_annotations: Count = 0
_asTypeDeclaration: (ClassModule) Public "Worksheet" As "Worksheet" | {L1C1}
_hasPredeclaredId: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isExposed: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=true, IsValueFaulted=false, Value=true
_isExtensible: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isGlobal: false
_isGlobalSyncObject: {object}
_members: Count = 162
_neverArray: {Rubberduck.Parsing.Symbols.DeclarationType[18]}
_references: Count = 1
_subtypes: Count = 0
_supertypeNames: Count = 2
_supertypes: Count = 2
?state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "_Worksheet").First()
(ClassModule) Public "_Worksheet" As "_Worksheet" | {L1C1}
Accessibility: Public
Annotations: Count = 0
AsTypeContext: null
AsTypeDeclaration: (ClassModule) Public "_Worksheet" As "_Worksheet" | {L1C1}
AsTypeIsBaseType: false
AsTypeName: "_Worksheet"
AsTypeNameWithoutArrayDesignator: "_Worksheet"
Attributes: Count = 0
AttributesPassContext: null
ComponentName: "_Worksheet"
Context: null
CustomFolder: "Excel"
DeclarationType: ClassModule
DefaultMember: null
DescriptionString: ""
FullAsTypeName: "EXCEL.EXE;Excel._Worksheet"
HasDefaultInstanceVariable: The function evaluation requires all threads to run.
HasPredeclaredId: The function evaluation requires all threads to run.
HasTypeHint: false
IdentifierName: "_Worksheet"
ImplementedInterfaces: {System.Linq.Enumerable.WhereEnumerableIterator<Rubberduck.Parsing.Symbols.ClassModuleDeclaration>}
IsArray: false
IsControl: false
IsEnumeratorMember: false
IsExposed: The function evaluation requires all threads to run.
IsExtensible: The function evaluation requires all threads to run.
IsGlobalClassModule: false
IsInterface: true
IsObject: true
IsObjectArray: false
IsObjectOrObjectArray: true
IsSelfAssigned: false
IsTypeSpecified: false
IsUndeclared: false
IsUserDefined: false
IsUserInterface: false
IsWithEvents: false
Members: Count = 145
ParentDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ParentScope: "VBE"
ParentScopeDeclaration: (Project) Implicit "Excel" As "Excel" | {L1C1}
ProjectDisplayName: 'state.DeclarationFinder.DeclarationsWithType(DeclarationType.ClassModule).Where(x=>x.ComponentName == "_Worksheet").First().ProjectDisplayName' threw an exception of type 'System.NullReferenceException'
ProjectId: "External2003575673"
ProjectName: "Excel"
QualifiedModuleName: {EXCEL.EXE;Excel._Worksheet}
QualifiedName: {EXCEL.EXE;Excel._Worksheet._Worksheet}
QualifiedSelection: {EXCEL.EXE;Excel._Worksheet L1C1}
References: Count = 0
Scope: "EXCEL.EXE;Excel._Worksheet"
Selection: {L1C1}
Subtypes: Count = 1
SupertypeNames: Count = 0
Supertypes: Count = 0
TypeHint: null
_annotations: Count = 0
_asTypeDeclaration: (ClassModule) Public "_Worksheet" As "_Worksheet" | {L1C1}
_hasPredeclaredId: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isExposed: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isExtensible: ThreadSafetyMode=ExecutionAndPublication, IsValueCreated=false, IsValueFaulted=false, Value=false
_isGlobal: false
_isGlobalSyncObject: {object}
_members: Count = 145
_neverArray: {Rubberduck.Parsing.Symbols.DeclarationType[18]}
_references: Count = 0
_subtypes: Count = 1
_supertypeNames: Count = 0
_supertypes: Count = 0
They appear to be identical. But it does establish that in both cases, there's both a _Worksheet
and Worksheet
declarations. That seem to suggest that the resolver isn't consistently selecting the same one under all conditions. Thoughts, @retailcoder or @MDoerner ?
Looking at the history here: https://github.com/rubberduck-vba/Rubberduck/commit/862ed33a6e7c0307e98a81f0956206164bc9a27b
It looks like the qualified member calls in are resolving to the underscored/hidden interface/class, and unqualified ones resolve to the non-underscored type - it was probably breaking some inspection, and treating them like one and the same basically fixed the symptoms. I'd pragmatically just make the test pass by tweaking its expectations, and then there's perhaps an underlying resolver issue with inconsistent resolution of qualified member calls vs unqualified ones, but we are working around it.
Well, it sounds like getting the test to pass on my machine may cause it to break in AppVeyor, right, @bclothier?
Hm, perhaps the best thing to do would be to mark it as ignored... could be just a matter of ordering of the declarations, assuming a .FirstOrDefault somewhere in the resolution.
It does sound like a replay of what I went through in my own local back when I tried to build it in VS2022.
Well, it sounds like getting the test to pass on my machine may cause it to break in AppVeyor, right, @bclothier?
Yes, it did break AV originally and it fails on both VMs with 2019 and 2022, respectively.
I'm in favor of marking it ignored until we can establish what's really going with this. It has the markings of a heisenbug which will take a while to figure out....
Works for me! I'd prefer to get working on the mocking initiative, anyway... ;-)
While working on #6063, I encountered a single failing test:
When I debug through the test, I see the following:
So, the
expected
Scope and ParentScope areEXCEL.EXE;Excel._Worksheet.Paste"
and theactual
Scope and ParentScope areEXCEL.EXE;Excel.Worksheet.Paste"
. I haven't explored these tests too much. Is there any chance this issue is related to 64-bit vs 32-bit? Could it be related to particular versions of Excel installed on the development machine?Originally posted by @pflugs30 in https://github.com/rubberduck-vba/Rubberduck/issues/6063#issuecomment-1368085235