Closed retailcoder closed 7 years ago
Tried the web-based inspection and got the following exception:
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=Sequence contains more than one matching element
Source=System.Core
StackTrace:
at Rubberduck.Inspections.UnassignedVariableUsageInspection.GetInspectionResults()
at RubberduckWeb.Mocks.Rubberduck.Inspections.DefaultInspector.<>c__DisplayClass2_0.<Inspect>b__3() in C:\Dev\RubberduckWeb-master\RubberduckWeb\RubberduckWeb\Mocks\DefaultInspector.cs:line 64
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
InnerException:
Seems to be caused by the Rubberduck.Inspections.UnassignedVariableUsageInspection
inspector.
Not sure if that helps :smile:.
Oh great. Are you running the 2.0.13 release build (that's the build running on the website)?
If you could repro in the actual VBE and open up a new issue with the log details (the stack trace will include more precise information), would be awesome!
I'm using whatever was in master
as of 35 minutes ago.
@robodude666 that would be the 2.0.13 code base as-released, which should repro the exception.
...interestingly, there are two lines that could possibly throw that exception in UnassignedVariableUsageInspection
:
//The parameter scoping was apparently incorrect before - need to filter for the actual function.
var lenFunction = BuiltInDeclarations.SingleOrDefault(s => s.DeclarationType == DeclarationType.Function && s.Scope.Equals("VBE7.DLL;VBA.Strings.Len"));
var lenbFunction = BuiltInDeclarations.SingleOrDefault(s => s.DeclarationType == DeclarationType.Function && s.Scope.Equals("VBE7.DLL;VBA.Strings.Len"));
Why the two instructions are identical is extremely suspicious (@comintern any ideas?), but how the heck this can throw without being caught is quite a mystery...
Gah, just noticed that's the RD-WEB repo :man_facepalming:
Fixing this may require additional tweaks to the RubberduckTests project, where the mock VBE is defined. For some reason that remains to be investigated, the mock parser on the website doesn't parse anything, and when it does, the resolver doesn't seem to correctly annotate the deserialized declarations, leading to a lot of false positives being reported, that aren't when RD runs in the actual VBE.
The RD build was updated to the latest 2.0.12 build (unreleased), and the actual deserialization work was moved to RubberduckTests.dll; that didn't fix it.