rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.91k stars 299 forks source link

Resolver Error after update to 2.5.2 from 2.5.1 #5782

Closed hecon5 closed 2 years ago

hecon5 commented 3 years ago

Rubberduck version information Works: Version 2.5.1.5557 DOES NOT Work: 2.5.2.5906 DOES NOT Work: 2.5.2.5927-pre OS: Microsoft Windows NT 10.0.18363.0, x64 Host Product: Microsoft Office x64 Host Version: 16.0.13127.21506 Host Executable: MSACCESS.EXE

Description After upgrading to 2.5.2.5907 or latest, I get a "resolver error" upon compiling for some Access Databases. No other changes were made to the database, database compiles fine, and compiling does not show any errors. Simpler databases seem to work, but not all.

The log includes two files I tried to parse: one that failed (first one), and the second one that "succeeded" but both seem to have similar exceptions being thrown when I looked at the log, and I'm not encouraged by the other file's failure to know it actually worked. I tried recompiling, rebuilding, compact and repair, etc. all to no avail.

To Reproduce Steps to reproduce the behavior:

  1. Uninstall 2.5.1
  2. Install 2.5.2.n
  3. Restart Office and machine (for good measure)
  4. Reopen same file and click "refresh".
  5. Receive utterly ambiguous "resolver error" with a mouse-over tip "resolver error. click to refresh".
  6. Click compile (5-12 times).
  7. Restart Access.
  8. Receive same error.
  9. Downgrade to 2.5.1
  10. Open Access, click "refresh".
  11. Receive "ready" note.

Expected behavior The file to be parsed correctly.

Screenshots image

image

Logfile RubberduckLog-failed.txt RubberduckLog-Worked.txt

Additional context The log shows that for databases where it "works", that version checking seems to be ok, which happens early on. If not, it doesn't.

2021-05-18 10:11:39.2286;INFO-2.5.2.5906;Rubberduck.UI.Command.VersionCheckCommand;Executing version check...;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentModuleCommand was registered with id 49634;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.CodePaneRefactorRenameCommand was registered with id 49495;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorEncapsulateFieldCommand was registered with id 49600;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorExtractMethodCommand was registered with id 49616;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.Refactorings.RefactorMoveCloserToUsageCommand was registered with id 49615;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.CodeExplorerCommand was registered with id 49598;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ExportAllCommand was registered with id 49556;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.FindSymbolCommand was registered with id 49559;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.IndentCurrentProcedureCommand was registered with id 49558;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.InspectionResultsCommand was registered with id 49537;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.ReparseCommand was registered with id 49567;
2021-05-18 10:11:39.3739;TRACE-2.5.2.5906;Rubberduck.Common.Hotkeys.Hotkey;Hotkey for the associated command Rubberduck.UI.Command.ComCommands.TestExplorerCommand was registered with id 49487;
2021-05-18 10:11:49.7832;DEBUG-2.5.2.5906;Rubberduck.UI.Command.MenuItems.CommandBars.AppCommandBarBase;(1290922) Executing click handler for commandbar item 'Pending', hash code 18373927;
2021-05-18 10:11:49.8307;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.ParseCoordinator;Parsing run started. (thread 14).;
2021-05-18 10:11:49.8307;INFO-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState (1) is invoking StateChanged (Started);

Versus a failed file:

2021-05-18 10:13:36.7619;INFO-2.5.2.5906;Rubberduck.UI.Command.VersionCheckCommand;Executing version check...;
2021-05-18 10:13:36.8981;TRACE-2.5.2.5906;Rubberduck.VBEditor.WindowsApi.SubclassManager;Subclassed hWnd 0x00030E76 as CodePane.;
2021-05-18 10:13:37.1053;INFO-2.5.2.5906;Rubberduck.UI.Command.MenuItems.CommandBars.AppCommandBarBase;System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Rubberduck.UI.Command.MenuItems.CommandBars.RubberduckCommandBar.<OnSelectionChange>d__9.MoveNext() in C:\projects\rubberduck\Rubberduck.Core\UI\Command\MenuItems\CommandBars\RubberduckCommandBar.cs:line 82;System.Threading.Tasks.TaskCanceledException: A task was canceled.
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Rubberduck.UI.Command.MenuItems.CommandBars.RubberduckCommandBar.<OnSelectionChange>d__9.MoveNext() in C:\projects\rubberduck\Rubberduck.Core\UI\Command\MenuItems\CommandBars\RubberduckCommandBar.cs:line 82
2021-05-18 10:13:54.0735;DEBUG-2.5.2.5906;Rubberduck.UI.Command.MenuItems.CommandBars.AppCommandBarBase;(62329248) Executing click handler for commandbar item 'Pending', hash code 54417155;
2021-05-18 10:13:54.1812;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.ParseCoordinator;Parsing run started. (thread 14).;
2021-05-18 10:13:54.1812;INFO-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState (1) is invoking StateChanged (Started);
retailcoder commented 3 years ago

The version check is a red herring; it fires asynchronously at startup, and both logs have it:

2021-05-18 10:11:39.2286;INFO-2.5.2.5906;Rubberduck.UI.Command.VersionCheckCommand;Executing version check...;
2021-05-18 10:13:36.7619;INFO-2.5.2.5906;Rubberduck.UI.Command.VersionCheckCommand;Executing version check...;

Looking at the failed log, there is a parser error in Form_frmAddNewFAN on the [ token at line 18, column 16, and various other similar errors in other form modules. From the parser stack trace it looks like the culprit is inside the Boolean expression of an If statement, inside a Sub procedure; these [ tokens are making both parser passes (CodePaneCode and AttributesCode passes) fail.

From the logs though, it appears both "failed" and "worked" runs were written by the 2.5.2.5906 build. The "failed" log seems to end with Rubberduck being manually shut down after the parsing run completed in 67.992074 seconds, with all references resolved in 27.923 seconds. Arguably a lot, but then SLL prediction mode is failing in several places, which is slowing it down:

2021-05-18 10:15:02.0732;TRACE-2.5.2.5906;Rubberduck.Parsing.VBA.ReferenceManagement.IdentifierReferenceResolver;Setting current scope: Form_Timer (Procedure) in thread 22;
2021-05-18 10:15:02.0889;TRACE-2.5.2.5906;Rubberduck.Parsing.VBA.ReferenceManagement.IdentifierReferenceResolver;Current scope is now Form_Timer in thread 22;
2021-05-18 10:15:02.0889;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.ReferenceManagement.ReferenceResolveRunnerBase;Binding resolution done for component 'HDC Product Database Front End.Form__frmSplashPage' in 45ms (thread 22);
2021-05-18 10:15:02.1027;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;Module 'Form__frmSplashPage' state is changing to 'Ready' (thread 22);
2021-05-18 10:15:02.1027;INFO-2.5.2.5906;Rubberduck.Parsing.Common.ParsingStageTimer;Resolved references in 27923ms.;
2021-05-18 10:15:02.1448;INFO-2.5.2.5906;Rubberduck.Parsing.Common.ParsingStageTimer;Determined module to module references in 28ms.;
2021-05-18 10:15:02.1652;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.ParseCoordinator;Parsing run got canceled. (thread 14).;
2021-05-18 10:15:02.1652;INFO-2.5.2.5906;Rubberduck.Parsing.VBA.ParseCoordinator;Parsing run finished after 67.992074s. (thread 14).;
2021-05-18 10:15:11.7476;INFO-2.5.2.5906;Rubberduck._Extension;Rubberduck is shutting down.;

In clsAdpTrigger (line 94 column 43) where a Name token is tripping up the parser; there's a similar one in clsDbSharedImage (line 416 column 20); clsDevMode fails SLL at L298C47 where \r\n is unexpected (this is weird, is there an encoding issue here?), and modJsonConverter is failing to parse with an unexpected End Function token at line 1038 (column 1) in the code pane pass, and once more at line 1039 in the attributes pass - but these parser errors all appear to be eliminated when the parser retries with the slower but more precise LL mode:

2021-05-18 10:11:59.8399;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;Module 'clsAdpTrigger' state is changing to 'Parsed' (thread 14);
...
2021-05-18 10:12:00.0295;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;Module 'clsDevMode' state is changing to 'Parsed' (thread 14);
2021-05-18 10:12:00.0295;INFO-2.5.2.5906;Rubberduck.Parsing.Common.ParsingStageTimer;Parsed user modules in 8548ms.;
2021-05-18 10:12:00.0295;INFO-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;RubberduckParserState (4) is invoking StateChanged (Parsed);

Removing the offending tokens (looks like there are a number of square-bracketed identifiers in there) could help speed up the actual parsing performance for this project, but then these happen further down the line (still in the "worked" log... surprisingly), and are much more worrying (the COM / .NET interop is breaking here for some reason... this is never good):

2021-05-18 10:12:04.5717;INFO-2.5.2.5906;Rubberduck.VBEditor.SafeComWrappers.SafeComWrapper`1;Failed to get host document MSAccessVCS.Form_frmVCSInstall;System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Microsoft.Office.Interop.Access._Application.get_CurrentProject()
   at Rubberduck.VBEditor.SafeComWrappers.VBA.AccessApp.GetDocument(QualifiedModuleName moduleName) in C:\projects\rubberduck\Rubberduck.VBEditor.VBA\SafeComWrappers\Application\AccessApp.cs:line 37

Meanwhile the "failed" logs are showing the same SLL parser failures, but then this happens:

2021-05-18 10:14:33.4474;ERROR-2.5.2.5906;Rubberduck.Parsing.VBA.ReferenceManagement.ReferenceResolveRunnerBase;Exception thrown on resolving those modules: 'HDC Product Database Front End.Form_frmAddEditHistoricalProduct,HDC Product Database Front End.Form_frmAddEditProductSSB,HDC Product Database Front End.Form_frmAddEditProfessionalServiceBudget,HDC Product Database Front End.Form_frmAddEditPurchasesBudget,HDC Product Database Front End.Form_frmAddEditSectionBudget,HDC Product Database Front End.Form_frmAddEditTravelBudget,HDC Product Database Front End.Form_frmAddEditWorkByDistrictsBudget,HDC Product Database Front End.Form_frmAddNewActivity,HDC Product Database Front End.Form_frmAddNewActivityWorkType,HDC Product Database Front End.Form_frmAddNewAsset,HDC Product Database Front End.Form_frmAddNewFAN,HDC Product Database Front End.Form_frmAddNewFWI,HDC Product Database Front End.Form_frmAddNewFYProduct,HDC Product Database Front End.Form_frmAddNewHistoricalSection,HDC Product Database Front End.Form_frmAddNewLC,HDC Product Database Front End.Form_frmAddNewMIPR,HDC Product Database Front End.Form_frmAddNewOWI,HDC Product Database Front End.Form_frmAddNewPCRemark,HDC Product Database Front End.Form_frmAddNewProduct,HDC Product Database Front End.Form_frmAddNewPurchaseAction,HDC Product Database Front End.Form_frmAddNewPurchaseActionNote,HDC Product Database Front End.Form_frmAddNewPurchaseMerchant,HDC Product Database Front End.Form_frmAddNewPurchasePlannedItem,HDC Product Database Front End.Form_frmAddNewSSBExecutionTrackingNote,HDC Product Database Front End.Form_frmCalendar,HDC Product Database Front End.Form_frmConvertTextToVBAText,HDC Product Database Front End.Form_frmEditActivity,HDC Product Database Front End.Form_frmEditAsset,HDC Product Database Front End.Form_frmEditCompletedProduct,HDC Product Database Front End.Form_frmEditEmployee,HDC Product Database Front End.Form_frmEditEmployeePDTRole,HDC Product Database Front End.Form_frmEditEmployeeRole,HDC Product Database Front End.Form_frmEditFAN,HDC Product Database Front End.Form_frmEditFWI,HDC Product Database Front End.Form_frmEditFYProduct,HDC Product Database Front End.Form_frmEditHours,HDC Product Database Front End.Form_frmEditLC,HDC Product Database Front End.Form_frmEditMilestone,HDC Product Database Front End.Form_frmEditMIPR,HDC Product Database Front End.Form_frmEditOWI,HDC Product Database Front End.Form_frmEditPCRemark,HDC Product Database Front End.Form_frmEditPDT,HDC Product Database Front End.Form_frmEditProduct,HDC Product Database Front End.Form_frmEditTaskDetail,HDC Product Database Front End.Form_frmEditTasks,HDC Product Database Front End.Form_frmFYRollover,HDC Product Database Front End.Form_frmFYSSBBudget-Beta,HDC Product Database Front End.Form_frmGapAnalysis,HDC Product Database Front End.Form_frmPasswordEntry,HDC Product Database Front End.Form_frmPCproduct_currentFY,HDC Product Database Front End.Form_frmProductDetails,HDC Product Database Front End.Form_frmProductDetailsSSB,HDC Product Database Front End.Form_frmSSBExecutionTracking,HDC Product Database Front End.Form_frmSSBExecutionTracking_scopedSections,HDC Product Database Front End.Form_frmtargetchanger,HDC Product Database Front End.Form_frmVersionEdit,HDC Product Database Front End.Form_frmVersionViewAll,HDC Product Database Front End.Form_frmViewActivities,HDC Product Database Front End.Form_frmViewAssets,HDC Product Database Front End.Form_frmViewClosedProducts,HDC Product Database Front End.Form_frmViewCompletedProducts,HDC Product Database Front End.Form_frmViewEmployees,HDC Product Database Front End.Form_frmViewFWIDetails,HDC Product Database Front End.Form_frmViewFWIs,HDC Product Database Front End.Form_frmViewHistoricalProducts,HDC Product Database Front End.Form_frmViewLCs,HDC Product Database Front End.Form_frmViewLCsSectionDisplay,HDC Product Database Front End.Form_frmViewMilestones,HDC Product Database Front End.Form_frmViewMilestonesBySection,HDC Product Database Front End.Form_frmViewMIPRDetails,HDC Product Database Front End.Form_frmViewMIPRs,HDC Product Database Front End.Form_frmViewOWIDetails,HDC Product Database Front End.Form_frmViewOWIs,HDC Product Database Front End.Form_frmViewPCRemarks,HDC Product Database Front End.Form_frmViewProductFinancialSummary,HDC Product Database Front End.Form_frmViewProductsByBranch,HDC Product Database Front End.Form_frmViewProductsByBranch_sectionDetail,HDC Product Database Front End.Form_frmViewProductsBySection,HDC Product Database Front End.Form_frmViewProductsOfActivity,HDC Product Database Front End.Form_frmViewProfessionalServicesBudget,HDC Product Database Front End.Form_frmViewPurchaseActionDetails,HDC Product Database Front End.Form_frmViewPurchaseActionTracker,HDC Product Database Front End.Form_frmViewPurchasePlannedItems,HDC Product Database Front End.Form_frmViewPurchasesBudget,HDC Product Database Front End.Form_frmViewSSBExecutionTrackingNotes,HDC Product Database Front End.Form_sfrmAddEditProductSSB_scopedSections,HDC Product Database Front End.Form_sfrmListActivityWorkTypes,HDC Product Database Front End.Form_sfrmListEmployeeRoles,HDC Product Database Front End.Form_sfrmListFANsExisting,HDC Product Database Front End.Form_sfrmListFANsOfFWI,HDC Product Database Front End.Form_sfrmListFANsOfMIPR,HDC Product Database Front End.Form_sfrmListFYProducts,HDC Product Database Front End.Form_sfrmListHistoricalSection,HDC Product Database Front End.Form_sfrmListLCs,HDC Product Database Front End.Form_sfrmListOWIs,HDC Product Database Front End.Form_sfrmListProductFinancialDetails,HDC Product Database Front End.Form_sfrmListProductPurchasePlannedItems,HDC Product Database Front End.Form_sfrmListPurchaseActionNotes,HDC Product Database Front End.Form_sfrmListPurchasePlannedItems,HDC Product Database Front End.Form_sfrmSelectActivityForAddEditProduct,HDC Product Database Front End.Form_sfrmSelectFYProductForWIorLC,HDC Product Database Front End.Form_sfrmViewMilestones,HDC Product Database Front End.Form__frmSplashPage,HDC Product Database Front End.Form__frmswitchboard,HDC Product Database Front End.Form__frmSwitchboardAdministrative,HDC Product Database Front End.Form__frmSwitchboardHomePage,HDC Product Database Front End.Form__frmSwitchboardPA,HDC Product Database Front End.Form__frmSwitchboardPC,HDC Product Database Front End.Form__frmSwitchboardPurchasing,HDC Product Database Front End.Form__frmSwitchboardReports,HDC Product Database Front End.Form__frmSwitchboardRP,HDC Product Database Front End.Form__frmSwitchboardSSB,HDC Product Database Front End.clsFormEventHandler,HDC Product Database Front End.clsSHA256,HDC Product Database Front End.modAddinTest,HDC Product Database Front End.modDatabaseTargeting,HDC Product Database Front End.modFormBuilding,HDC Product Database Front End.modFormTools,HDC Product Database Front End.modFYBudget,HDC Product Database Front End.modInitialization,HDC Product Database Front End.modLogTools,HDC Product Database Front End.modPermissions,HDC Product Database Front End.modPRBRoutines,HDC Product Database Front End.modProductStates,HDC Product Database Front End.modQueryTools,HDC Product Database Front End.modSigningTools,HDC Product Database Front End.modSSBHours,HDC Product Database Front End.modTableTools,HDC Product Database Front End.modThemeMapping,HDC Product Database Front End.modVersion,HDC Product Database Front End.modVersionAdmin,HDC Product Database Front End.SQLTools,HDC Product Database Front End.Report_rptHDCFYCapabilityBySection,HDC Product Database Front End.Report_rptHDCFYProgramSummary,HDC Product Database Front End.Report_rptHDCFYWorkResourcedAndExpendedByCustomer,HDC Product Database Front End.Report_rptHDCFYWorkResourcedAndExpendedByProductType,HDC Product Database Front End.Report_rptMilestoneByDate,HDC Product Database Front End.Report_rptPCproduct_currentFY,HDC Product Database Front End.Report_rptPRBLineItemReview,HDC Product Database Front End.Report_rptPurchaseActionStatus,HDC Product Database Front End.Report_rptPurchaseActionStatus_ContractingDetails,HDC Product Database Front End.Report_rptPurchaseActionStatus_CreditCardDetails' (thread 14).;
System.NotSupportedException: Unexpected context type Rubberduck.Parsing.Grammar.VBAParser+AddOpContext
   at Rubberduck.Parsing.Binding.TypeBindingContext.BuildTree(Declaration module, Declaration parent, IParseTree expression, IBoundExpression withBlockVariable, StatementResolutionContext statementContext, Boolean requiresLetCoercion, Boolean isLetAssignment) in C:\projects\rubberduck\Rubberduck.Parsing\Binding\TypeBindingContext.cs:line 35
   at Rubberduck.Parsing.Binding.TypeBindingContext.Resolve(Declaration module, Declaration parent, IParseTree expression, IBoundExpression withBlockVariable, StatementResolutionContext statementContext, Boolean requiresLetCoercion, Boolean isLetAssignment) in C:\projects\rubberduck\Rubberduck.Parsing\Binding\TypeBindingContext.cs:line 20
   at Rubberduck.Parsing.Binding.BindingService.ResolveType(Declaration module, Declaration parent, ParserRuleContext expression) in C:\projects\rubberduck\Rubberduck.Parsing\Binding\BindingService.cs:line 49
   at Rubberduck.Parsing.VBA.ReferenceManagement.CompilationPasses.TypeHierarchyPass.AddImplementedInterface(Declaration potentialClassModule) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ReferenceManagement\CompilationPasses\TypeHierarchyPass.cs:line 54
   at Rubberduck.Parsing.VBA.ReferenceManagement.CompilationPasses.TypeHierarchyPass.Execute(IReadOnlyCollection`1 modules) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ReferenceManagement\CompilationPasses\TypeHierarchyPass.cs:line 39
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Rubberduck.Parsing.VBA.ReferenceManagement.ReferenceResolveRunnerBase.ExecuteCompilationPasses(IReadOnlyCollection`1 modules, CancellationToken token) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ReferenceManagement\ReferenceResolveRunnerBase.cs:line 151
2021-05-18 10:14:33.4474;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;Module 'Form_frmAddEditHistoricalProduct' state is changing to 'ResolverError' (thread 14);
2021-05-18 10:14:33.4615;DEBUG-2.5.2.5906;Rubberduck.Parsing.VBA.RubberduckParserState;Module 'Form_frmEditFAN' state is changing to 'ResolverError' (thread 14);

I wonder if the spaces in the VBA Project name couldn't be a problem? It looks like the project name is HDC Product Database Front End, but the resolver error appears to be caused by an unexpected + operator (exactly where is a bit hard to tell at that stage though).

It would probably be helpful to see the code-behind of some of these forms, if you can share it (assuming the resolver issue can be reproduced with a small project that only includes that code... can it?).

hecon5 commented 3 years ago

@retailcoder, yes, both logs are from the same RD Version to see if it was something I was missing.

I did not manually stop RD at any point; I saw the manual shutdown note, and was perplexed at this, as I didn't do it.

I'll take a look at those mentioned modules/code and see if they have any obvious code at those locations. We do use [] for some code, sometimes where we shouldn't (Tempvars most commonly) sometimes where it should be irrelevant (Comment text, or strings, etc.).

Looking at the failed log, there is a parser error in Form_frmAddNewFAN on the [ token at line 18, column 16,

Relevant code function; note that nothing changed in this section pre/post 2.5.2 update.

Form_frmAddNewFAN: 

Private Sub Form_Activate()

    [TempVars]![tempFypidForWIorLC] = ""
    If ([TempVars]![tempFwiidforAddNewFAN]) = "" Then
    Else
        Me.FWISelection = [TempVars]![tempFwiidforAddNewFAN]
    End If
    If ([TempVars]![tempMipridforAddNewFAN]) = "" Then
    Else
        Me.MIPRSelection = [TempVars]![tempMipridforAddNewFAN]
    End If
    Call filterExistingFANs

End Sub

I'll change the project name to something without spaces, but I hope that's not an issue, as it seems limiting that I can't use spaces for the name.

hecon5 commented 3 years ago

Changing project name to one without spaces makes no difference.

I'll now attempt to isolate a few code modules and recompile those specific forms.

hecon5 commented 3 years ago

Ok, I severed out a few modules and forms that cause issue; but in an isolated environment, they parse just fine.

Just for fun, I added a ton of spaces to the project name in this newly shrunk version, and it parses just fine, too.

I'm stumped; literally no change was made to my code base and 2.5.2 won't compile on my larger project.

hecon5 commented 3 years ago

RubberduckLog.txt RubberduckLog-SingleForm.txt

Uploaded a few logs for the single form; note that I ran parse numerous times, and they all succeeded ("Ready" was shown).

retailcoder commented 3 years ago

Thanks for looking into reproducing this issue!

I hope that's not an issue, as it seems limiting that I can't use spaces for the name.

It very likely isn't, but since the project's name is a programmatic identifier, it is somewhat expected to adhere to the language specifications as far as identifier names are concerned - note that this has nothing to do with the host document's file name, which is entirely independent of the (Name) property of the VBProject. I would 100% recommend keeping the (Name) property of any VBA project object a valid programmatic identifier name (PascalCased), regardless of whether it works or not with spaces.

Also thanks for sharing some of the code, it does explain the SLL parser failures / slower parse times (but not the resolver error). Note that the "empty If block" inspection will be flagging these conditionals, accordingly recommending to invert the conditions and remove the Else blocks (a quick-fix can do that automatically).

The resolver error involves an unexpected + operator somewhere... but then that + operator parsed just fine and it looks like it's just the type hierarchy resolver / binding service being confused about what it's looking at. If it wasn't of that message about an unexpected + operator I'd write it off as an unlucky COM interop hiccup issue... @MDoerner might have a more insightful idea of what's going on here.

hecon5 commented 3 years ago

Thanks for the tip about the name; fair point on that, and I'll discuss with the prior owner/manager of the code base (I inherited it), on changing it, and if it's going to cause compatibility/linking headaches if we change it willy nilly.

Yes; it does show an issue with the empty if block; it does show that error, and we've resolved a large number of others with similar issues; but being this is inherited, and it 'was' working, I'm trying to only revamp things that are actively broken or need other work while we adapt this code base.

If I find any other clues, I'll share them; but for now, I need to go back to 2.5.1.

retailcoder commented 3 years ago

Several changes were made between 2.5.1 and 2.5.2 regarding default member resolution; Rubberduck is digging deeper and resolving more implicit and late-bound code than before, but apparently something broke somewhere.

TypeBindingContext.cs was last modified 2019-08-18, so almost exactly a whole year before 2.5.1; the fact that the stack trace includes TypeHierarchyPass.AddImplementedInterface (last modified 2020-09-30, about a month after 2.5.1) could be a clue.

Perhaps all that needs to happen is to wrap the ResolveType call into a try...catch block / log the exception and just merrily move on... but it's hard to tell if that would be an appropriate "fix" without being able to reproduce the problem locally.

https://github.com/rubberduck-vba/Rubberduck/blob/51f2d139faf7c245b96e09bcd31b4424491dc186/Rubberduck.Parsing/VBA/ReferenceManagement/CompilationPasses/TypeHierarchyPass.cs#L51-L64

The exception is being thrown here, where the type of expression is an unexpected AddOpContext (an addition operation expression):

https://github.com/rubberduck-vba/Rubberduck/blob/51f2d139faf7c245b96e09bcd31b4424491dc186/Rubberduck.Parsing/Binding/TypeBindingContext.cs#L24-L37

Being able to break here on that throw statement while attached to your ACCESS.EXE process (or while resolving any other code that enters the same execution path) would help us determine whether there's an oversight and we shouldn't be throwing here given an AddOpContext (but then what of every other expression types?), or whether execution should have branched elsewhere earlier and not even attempt to resolve this particular expression.

hecon5 commented 3 years ago

I did some more digging, and I'm reasonably sure that the + operator it's screaming about comes from a message box declaration where we're declaring the msgbox buttons settings and using more than one option. image

From the same form as before, in here we've set the msgbox to yes/no (vbYesNo), and the "information" exclamation (vbinformation), and set "no" as default (vbdefaultbutton2).

frmAddNewFan
MsgBox("Some dumb text", vbYesNo + vbInformation + vbDefaultButton2, "A TITLE!")

Why this fails when compiled with the full program but not when it's standalone is still befuddling me. I even added all the same references to the limited file to no avail.

bclothier commented 3 years ago

As a quick test to confirm... in your original project, change the + to Or operator and see if this makes a difference.

hecon5 commented 3 years ago

To confirm, you're saying change to the following? There's nigh 200 instances of this, and it's how almost every instance I've seen online for msgboxes declared where using more than one "button option", not to mention Microsoft's own examples.

MsgBox("Some dumb text", vbYesNo OR vbInformation OR vbDefaultButton2, "A TITLE!")
bclothier commented 3 years ago

Microsoft's examples is not... exemplary.

Or is actually the correct operator to use in those cases. However, it has the same results as long you don't accidentally add same flag. But the real point here is to test whether the use of + operator is in fact the issue or not. It might not be necessary to replace all; if the logs has one less incident that would be a sign that it's really a problem relating to that operator or if we need to look somewhere. Alternatively, use a copy and F & R all Msgbox using + and then test.

hecon5 commented 3 years ago

Fair point; I'll give that a shot and retry.

MDoerner commented 3 years ago

Given where the error occurs, this should not have anything to do with the + in the message boxes. Actually, I think it is not related to the code at all. My best guess at the moment is that there are some funky base type names in the internal type library. However, I will have to investigate a bit in order to see whether I can reproduce this in Access. This would also explain why there was no problem before since we only started to pull those base types from the type lib after 2.5.1

Is there anything special about how those Access forms and reports are set up?

hecon5 commented 3 years ago

Nothing "special", they open one at a time, some use macros, but they don't do anything fancy, no dynamic mapping of buttons or controls, etc.. The "fanciest thing" that some do is to utilize TempVars.

hecon5 commented 3 years ago

Hi, wanted to check up on this, is there anything I can do to help troubleshoot this, or provide more information? This breaks 2.5.2 for me.

I just tried to build with the latest, and it continues to persist.

Vogel612 commented 3 years ago

@hecon5 Max is basically the person to ask about the resolver around these parts. He diagnosed the problem to be in a feature that was introduced in 2.5.2 which is required for more advanced capabilities for Rubberduck.

Unfortuntately most of the folks working on RD have been somewhat inactive recently (what with the pandemic and this basically being a hobby for all involved), so until someone can locally reproduce the issue with a development build (and write a corresponding failing unit test) this is currently not working.

The easiest fix for you is probably going to be to downgrade to 2.5.1 until the issue is closed with a fix :)

hecon5 commented 3 years ago

That's what I've done (downgrade); just wondered if there was something I could do to help. 2.5.1 is still way better than nothing; just wanted to take advantage of some of the speed and other features that have been boosted since.

Thanks for the reply!

MDoerner commented 3 years ago

I might have look at this some time next week. Even if we cannot reproduce the issue directly, I think we might be able to get this working by being a bit more permissive or flexible. Bailing out entirely seems a bit excessive.

MDoerner commented 2 years ago

We have just merged a PR that should stop the failed supertype resolution from aborting the entire processing. Instead, we log a warning.

It would be great if you could have a look whether you can use RD with this again. It would even be greater if you could tell us what the supertype is that failed to resolve; it should be in the corresponding warning in the log.

hecon5 commented 2 years ago

Thanks! I'll give it a go in the next few days!

hecon5 commented 2 years ago

Well, it looks like it worked! I received no alerts or warning notices when I run it now. I opened up the log and searched for WARN. I posted some log warnings, and some traces for the warning as best I can tell, as well as any contextual info I see. If needed, I can post the whole log, but it's huge (length wise, not size wise), so didn't want to post too much and post gibberish/useless data for you to comb through.

Version 2.5.2.5994 OS: Microsoft Windows NT 10.0.18363.0, x64 Host Product: Microsoft Office x64 Host Version: 16.0.13801.20960 Host Executable: MSACCESS.EXE

Here's some extracted log bits with WARN levels.

2021-10-11 08:30:07.4067;INFO-2.5.2.5994;Rubberduck.Parsing.Common.ParsingStageTimer;Added supertypes for document modules in 7ms.;
2021-10-11 08:30:07.4267;WARN-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.CompilationPasses.TypeHierarchyPass;Failed to resolve interface _Report_rptPCproduct_currentFY.;

(This goes on for just about every form) Then this:

 2021-10-11 08:30:09.2385;WARN-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.CompilationPasses.TypeAnnotationPass;Failed to resolve type EventStatusEnum;
(numerous copies followed by this)
2021-10-11 08:30:09.2475;WARN-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.CompilationPasses.TypeAnnotationPass;Failed to resolve type EventReasonEnum;

A while later:

2021-10-11 08:30:10.8157;TRACE-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.IdentifierReferenceResolver;Current scope is now expendedLabel_Click in thread 104;
2021-10-11 08:30:10.8157;DEBUG-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.ReferenceResolveRunnerBase;Binding resolution done for component 'HDCProductDatabaseFrontEnd.Form_frmEditAsset' in 1239ms (thread 88);
2021-10-11 08:30:10.8157;TRACE-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.IdentifierReferenceResolver;Current scope is now Setup in thread 89;
2021-10-11 08:30:10.8157;WARN-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.IdentifierReferen

...

2021-10-11 08:30:15.4691;TRACE-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.IdentifierReferenceResolver;Current scope is now ConvertToIso in thread 99;
2021-10-11 08:30:15.4691;WARN-2.5.2.5994;Rubberduck.Parsing.VBA.ReferenceManagement.IdentifierReferenceResolver;Type Context: Failed to resolve Object. Binding as much as we can.;
MDoerner commented 2 years ago

Thanks for sharing this. The thing causing the errors before is quite definitely the occurrence of a supertype name ending in a dot, which probably a bug when reading the supertypes.

MDoerner commented 2 years ago

I have created the follow-up issue #5881 for the strange supertype names. Since resolving now no longer bails out and finished properly, I close this issue.