Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object reference not set to an instance of an object when trying to apply colorization #1678

Closed
cyberlunacy opened this issue Nov 19, 2024 · 19 comments
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@cyberlunacy
Copy link

cyberlunacy commented Nov 19, 2024

I did search and didnt find anything based on the error i am seeing.
Full log attached where you can search for the error also.
OneMore.log

# Problem to Solve

When attempting to use the Colorizer, regardless of code style selected, i receive the following error
Object reference not set to an instance of an object

# To Reproduce

Steps to reproduce the behavior:

  1. In OneNote highlight a text to colorize - for me its SQL
  2. Click Alt+C
  3. Scroll down to 'SQL' (but doesnt matter which one you select)
  4. See error

# Expected Behavior

OneMore Should colorize the highlighted text as intended per prior builds formatting to the Code style selected.

# Screenshots

image

# Environment (if applicable)

  • Windows 11 23H2
  • OneNote Version: Microsoft® OneNote® for Microsoft 365 MSO (Version 2410 Build 16.0.18129.20100) 64-bit
  • OneMore Version: Version 6.6.1 with OneNote 16.0.18129.20116

# Additional Context

I have uninstalled and reinstalled latest OneMore and still no luck.
OneMore 6.6.0 did the same thing
OneMore 6.5.2 works but re-introduced the extreme when colorizing any amount of text on a large OneNote file/note

01|12:26:51.353| OnBeginShutdown(custom[])
01|12:26:51.353| ..shutting down UI
01|12:26:51.357| ..OnDisconnection(RemoveMode:ext_dm_HostShutdown,custom:[])
01|12:26:51.357| ..disposing 5 streams
01|12:26:51.357| ..closing log

01|12:27:54.208| Starting dllhost 41232, 3696 Mhz, 32 MB, en-US/en-US, v6.5.2, OneNote 15.0, Office 16.0, 2024-11-19 12:27
01|12:27:54.211| ..Windows 11 Professional, Version 23H2, Build 22621, 64 bit
01|12:27:54.222| ..C:\Program Files\Microsoft Office\root\Office16\ONENOTE.EXE (16.0.18129.20116)
01|12:27:54.236| ..OnConnection(ConnectionMode:ext_cm_Startup,custom[1:Int32])
01|12:27:54.237| ..OneAddInsUpdate(custom[])
01|12:27:55.022| ..building ribbon
01|12:27:55.024| ..building ribbon colorizer commands
01|12:27:55.197| ..building ribbon groups
01|12:27:55.198| ..building context menu
01|12:27:55.281| ..OnStartupComplete(custom[])
01|12:27:55.283| ..starting command service
01|12:27:55.283| ..starting reminder service
01|12:27:55.285| ..starting navigation service
03|12:27:55.371| ..defined 52 hotkeys for input locale 1033
01|12:27:55.818| ..starting hashtag service, Ready
01|12:27:55.818| ..ready
07|12:27:55.822| hashtag service waiting, Ready
03|12:27:55.824| Running command UpdateCommand
18|12:28:03.688| Running command ChooseColorizerCommand
16|12:28:07.468| ..Running command ColorizeCommand
18|12:29:32.621| Running command ChooseColorizerCommand
16|12:29:34.058| ..Running command ColorizeCommand
07|12:30:43.830| hashtag service scanned 64 pages, updating 0, in 44912ms

@cyberlunacy cyberlunacy added bug Something isn't working unread I have seen it or had time to refine it yet labels Nov 19, 2024
@stevencohn
Copy link
Owner

Do you have the example SQL text?

@stevencohn stevencohn added no-repro Cannot reproduce and removed unread I have seen it or had time to refine it yet labels Nov 19, 2024
@cyberlunacy
Copy link
Author

cyberlunacy commented Nov 19, 2024

Hi Steven

Anything will do it but here are a few (remember it doesnt matter what i choose in the context menu the error is always the same.)
SQL is just my usual use case.
I am using the stock OneNote setup, im not using special fonts or anything, OneMore is the only thing i use in it.

update stockunit
set locationid = 2
where stocknumber = 63601

delete from PRODUCTSTOCKLEVELSET
delete from PRODUCTSTOCKLEVELSETDETAIL

or even longer ones.

DELETE FROM PRODUCTSTOCK P WHERE P.MFRID || P.PARTNUMBER IN (SELECT PRODUCTSTOCK.MFRID || PRODUCTSTOCK.PARTNUMBER AS MERGED FROM PRODUCTSTOCK LEFT JOIN PRODUCTLOCATION ON PRODUCTSTOCK.MFRID = PRODUCTLOCATION.MFRID AND PRODUCTSTOCK.PARTNUMBER = PRODUCTLOCATION.PARTNUMBER WHERE (STOCKLEVEL1 <> 0 OR STOCKLEVEL1 IS NULL) AND (STOCKLEVEL2 <> 0 OR STOCKLEVEL2 IS NULL) AND (STOCKLEVEL3 <> 0 OR STOCKLEVEL3 IS NULL) AND (STOCKLEVEL4 <> 0 OR STOCKLEVEL4 IS NULL) AND (ONHANDAVAILABLEQUANTITY = 0 OR ONHANDAVAILABLEQUANTITY IS NULL))

@stevencohn
Copy link
Owner

Does it work from the OneMore Colorize menu, not the Alt+C dialog?
Or have you tried adding the Colorize menu to the right-click context menu via OneMore Settings?

@cyberlunacy
Copy link
Author

cyberlunacy commented Nov 19, 2024

Ah good point, i dont use that and forgot it was there.
It does work, but causes large sets of unselected data to be highlighted as lime green.
I have to Select All then set the Text Highlight to No Highlight in OneNote
(though i only selected like 2 short lines of text to colorize)

Odd thing i updated from the long lag in 6.5.2 (after reverting to the older version) directly to 6.6.1 and the long lag still exists.
uninstalled then clean install with 6.6.0 - and the long lag is still there while using the OneMore Ribbon Menu.
Where the right click menu is quick to fail. - the long lag was fixed a while back if i recall, not sure why its still there.

image

@cyberlunacy
Copy link
Author

cyberlunacy commented Nov 19, 2024

And now the Top ribbon menu stopped highlighting everything in lime green and is faster once i selected all and set the OneNote font highlight to No Color.
weird. But this has historically come and gone, it does it at random times. (the green)

@cyberlunacy
Copy link
Author

Knowing what the error actually means, its saying something in code it pointing to something that doesn't exist some where.
When uninstalling, is there a config file or reg key that i should clean out somewhere that might be holding on to a rogue setting, or a setting that changed in code but not in config ?
When uninstalling it does remove the Program Files\River folder but i dont know where else it may be storing files, such as the log, which remains even after uninstall/reinstall.

@stevencohn
Copy link
Owner

Correct assessment but the actual missing reference is unclear. There's really nothing to clear out.

What's odd is that the ChooseColorizerCommand that displays the dialog window is just a thin wrapper that calls ColorizeCommand. And you've said that calling Colorize directly does work.

So, at the moment, I don't have enough information to reproduce this and might only be able to provide a debug version of OneMore with extended logging. I've never seen this fail in this way so the Colorize command doesn't have much logging at the moment.

@cyberlunacy
Copy link
Author

cyberlunacy commented Nov 20, 2024

I dont know if it matters but the settings>colorize menu option (screen below) to enable or disable languages in the doesn't work either in the Alt+C menu, it displays all whether you select all or none, though the ribbon bar button it does.
I would gladly take a debug exe and send the logs.

I actually think i pasted the wrong log entry previously, this is where its failing.

01|01:18:51.194| Starting dllhost 12588, 3696 Mhz, 32 MB, en-US/en-US, v6.6.1, OneNote 15.0, Office 16.0, 2024-11-20 13:18
01|01:18:51.196| ..Windows 11 Professional, Version 23H2, Build 22621, 64 bit
01|01:18:51.203| ..C:\Program Files\Microsoft Office\root\Office16\ONENOTE.EXE (16.0.18129.20158)
01|01:18:51.216| ..OnConnection(ConnectionMode:ext_cm_Startup,custom[1:Int32])
01|01:18:51.216| ..OneAddInsUpdate(custom[])
01|01:18:51.634| ..building ribbon
01|01:18:51.637| ..building ribbon colorizer commands
01|01:18:51.787| ..building ribbon groups
01|01:18:51.789| ..building context menu
01|01:18:51.870| ..OnStartupComplete(custom[])
01|01:18:51.873| ..starting command service
01|01:18:51.873| ..starting reminder service
01|01:18:51.874| ..starting navigation service
03|01:18:51.958| ..defined 52 hotkeys for input locale 1033
01|01:18:52.044| ..starting hashtag service, Ready
01|01:18:52.045| ..ready
07|01:18:52.047| hashtag service waiting, Ready
04|01:18:52.050| Running command UpdateCommand
10|01:18:59.901| Running command ChooseColorizerCommand
10|01:19:01.923| Error running command ChooseColorizerCommand
10|01:19:01.923| System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: River.OneMoreAddIn
StackTrace: at River.OneMoreAddIn.Commands.ChooseColorizerCommand.d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at River.OneMoreAddIn.CommandFactory.d__6.MoveNext()
TargetSite: [River.OneMoreAddIn] River.OneMoreAddIn.Commands.ChooseColorizerCommand+d__2::MoveNext()

image

@stevencohn
Copy link
Owner

stevencohn commented Nov 20, 2024

OK, now I'm suspecting that you don't have access to your user folder. The green highlighting is not actual text highlighting but rather a background effect from OneNote indicating that the content was updated by a different user. Are you running OneNote as an administrator or some oddly permissioned user account? Do not run OneNote as admin.

The OneMore Settings should be stored here: %appdata%\OneMore\Settings.xml, which would translate to something like C:\users\<username>\appdata\Roaming\OneMore\Settings.xml. Do you have permission to create/modify that file? You can even try to rename it or delete it and then restart OneNote and let OneMore recreate it for you.

@cyberlunacy
Copy link
Author

oh yeah i have full access, I'm in there for work stuff all the time, just one specific folder for our program.

I'll just uninstall, nuke that folder if its still there, then reinstall, i never really messed with any settings in the App.

@cyberlunacy
Copy link
Author

cyberlunacy commented Nov 20, 2024

Same error after renaming the folder and using Atl+C
switched to different hotkey, same
same issue with the alt-c menu showing all entries when selecting only SQL in the settings.

attached are my config files (the original ones)

@cyberlunacy
Copy link
Author

cyberlunacy commented Nov 20, 2024

OK, now I'm suspecting that you don't have access to your user folder. The green highlighting is not actual text highlighting but rather a background effect from OneNote indicating that the content was updated by a different user. Are you running OneNote as an administrator or some oddly permissioned user account? Do not run OneNote as admin.

The OneMore Settings should be stored here: %appdata%\OneMore\Settings.xml, which would translate to something like C:\users\<username>\appdata\Roaming\OneMore\Settings.xml. Do you have permission to create/modify that file? You can even try to rename it or delete it and then restart OneNote and let OneMore recreate it for you.

I am running one note under my Work O365 account where my PC is a local user.
I'm 99% sure the last update triggered this, just never pointed that out.

and yes create/modify/delete all accessible. No issues .

Remoted into the office PC which is 100% domained with the same O365 account and it works
BUT, its still OneMore 5.8.4 and not prompting to update. I just never paid attention that it wasnt saying there was an update.
I clicked check and it prompted but im not updating that yet.

So big version difference.

@stevencohn
Copy link
Owner

I deleted the Zip you attached in case it contained any sensitive information. I didn't see anything out of the ordinary in there though. Looks like you did customize the Colorize language settings.

@cyberlunacy
Copy link
Author

thanks.

If you mean the selectable code languages, yes, that was me playing around, and honestly not until this started really caring what was in the menu, but also realizing the keyboard shortcut menu doesn't update with the visible code languages like the main menu. (as a result of this or by nature i'm not sure)

I'll update my office pc to the latest if you can tell me where i can get 5.8.4 again lol - or where i can grab a debug exe, i'm game for what ever you wanna do.

@stevencohn
Copy link
Owner

You should be able to get to older version on the Releases page, or directly from a URL such as https://github.com/stevencohn/OneMore/releases/tag/5.8.4 - just change the last part with the desired version number.

Give me a couple of days to whip up a debug version. I'll post it here.

@tridian-tn
Copy link

Is the Alt-C error the same as the one that was fixed in #1660 ?

@stevencohn
Copy link
Owner

stevencohn commented Nov 22, 2024

Maybe that's why I can't reproduce it!! Doh. I think you may be right @tridian-tn. I don't know how I could have forgotten that so quickly. Thanks.

@cyberlunacy, I'm attaching a temporary TEST version of the main OneMore DLL. You can copy it into your Program Files folder. First, rename the old one to save it. Then copy the new one into "C:\Program Files\River\OneMoreAddin"

River.OneMoreAddIn.dll.zip

This is NOT a released version. This is provided only as a proof-of-concept that this solves the problem. If so, I'll mark this ticket as a duplicate of 1660.

@cyberlunacy
Copy link
Author

cyberlunacy commented Nov 22, 2024

BINGO! that was it!
Though there is some timed lag there which isnt nearly as bad as past builds.
No matter 1 line of SQL or 10, or ctrl + select many sets of SQL its exactly the same amount of time to commit the changes/colorization.
its 7~8 seconds.
I would assume more SQL = more time, but this is not the case, more SQL / less sql = same time to commit.

You all are great, i really do appreciate ya ! I will await the next release.

@stevencohn
Copy link
Owner

Glad it fixed it.

I have done extensive performance testing. Loading a page is very quick, as is updating the page content. The biggest hit to performance is when OneMore asks OneNote to save the updated page. The larger or more complex the page, the longer it takes. Big tables or many tables make a page complex. Lots of images, handwritten content, and drawn objects make a page very large.

Closing this as a duplicate of #1660.

@stevencohn stevencohn added duplicate This issue or pull request already exists and removed no-repro Cannot reproduce labels Nov 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants