Closed daFreeMan closed 3 years ago
Failed to get host document Quarterly Report.Form_GenQuarterlyRpt;System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.
I don't think it's a bug with the quick-fix.
Ok the exceptions are unrelated, but there is something about escapes being ...escaped:
Failed to get host document Quarterly Report.Form_GenQuarterlyRpt;System.Runtime.InteropServices.InvalidComObjectException: COM object that has been separated from its underlying RCW cannot be used.
May well have been a one-off issue. After closing Access, reopening, parsing and applying the quick fix, I've not seen a recurrence of that in the log.
I noted it as an exception because I came across it and wasn't sure if it was related or not.
I have investigated this. The error is not in our code, but in the COM interop library or even the VBE API itself.
The problem is that string literals do not properly round-trip when exporting an imported component. In the reexported file, backslashes in front of most other characters are missing. Exceptions seem to be the backslash itself, r
and n
.
Since there does not seem to be a way to round-trip a single backslash followed by most characters, I think we will not be able to fix this.
Rubberduck version information The info below can be copy-paste-completed from the first lines of Rubberduck's log or the About box:
Description Selecting the
Adjust attribute value(s) | Selected occurrence
quick fix for the noted inspection does not actually apply the fix. The problem lies in the literal string text\\server or \share
where the\
before\share
seems to be treated as an escape code instead of part of the literal string and is dropped in the comparison routine to see if the two match.To Reproduce Steps to reproduce the behavior:
Parse the project
Select the quick fix to correct the attribute value
Parse the project
The inspection remains. See this log file: RubberduckLog.txt
Change the annotation to read:
Parse the project
Execute the quick fix
The inspection result is no longer listed. See this log file (Note, it's a continuation of the log above, so ignore the initial part): RubberduckLog.txt
Expected behavior Since the
'@Description
text is a literal string, it should be treated as such, and any occurrences of\
should be escaped with a leading\
to avoid them being treated as escape codes.Screenshots N/A
Logfile Above
Additional context With the
@Description
containing the string\\server or \share
, exporting the module to a.bas
file shows theVB_Description
attribute with\\server or share
, hence my substitution ofthe
for the\
- I needed to make sure it was quite distinct.Also note that there are quite a number of:
and at least one
errors/warnings reported in the log. I do not know if they're related or not