Exception in Adxwsbcls.TadxTheme.InitThemeColor

Add-in Express™ Support Service
That's what is more important than anything else

Exception in Adxwsbcls.TadxTheme.InitThemeColor
 
Tim Smet




Posts: 36
Joined: 2015-10-06
Hi,

We recently switched to the most recent version of addin express (about a month ago so version 9.0.1650) and did not really change anything about our addin besides rebuilding against latest version 9.0.1650. And we released our new version of our addin.

In the code we wrote specifically for the addin almost all functions are encapsulated in a Try / Except statement and logged to a log if an exception would happen. To prevent the exception from going through all the way up into word and our addins getting disabled if a sporadic error might happen.

We also have exceptional magic activated in case there is some other problem thats unhandled and it seems a certain client of ours is having a problem where it gets triggerd so it's an exception that occurs somewhere outside our added code for the addin that triggers the exception.

I don't know how the client manages to get the error but i do know this:

She is using office 2013 15.0.5059.100 32bit version.

And i managed to get a partial stacktrace the only reference i got is that the exception happens in Adxwsbcls.TadxTheme.InitThemeColor but i don't know why or how and it was not happening with the previosly build version of addin express. Other clients in the same office use a lower build of office 2013 and don't seem to have the problem.

I'm going to try to reproduce the problem on a pc in the office but i'm not certain i'll be able to i also did not look yet at what Adxwsbcls.TadxTheme.InitThemeColor does or why it might be getting unhandled exceptions on office 2013 (have not heared about office 2016 yet).

I'm already posting this to see if someone else has this problem or knows where it's comming from or if it's a known issue ...

This is the stacktrace i mannaged to get from exceptional magic

[DcsWordAddIn.dll] Adxwsbcls.TadxTheme.InitThemeColor
[DcsWordAddIn.dll] System.Classes.StdWndProc
[USER32.dll]
[USER32.dll]
[USER32.dll]
[USER32.dll]
[ntdll.dll]
[USER32.dll]
[mso.dll]
[wwlib.dll]
[wwlib.dll]
[wwlib.dll]
[wwlib.dll]
[wwlib.dll]
[wwlib.dll]
[wwlib.dll]
[wwlib.dll]
[WINWORD.EXE]
[WINWORD.EXE]
[kernel32.dll]
[ntdll.dll]
[ntdll.dll]

Registers:
EAX = 00000000  CS = 0023  EIP = 0B4D37FA  Flags = 00010282
EBX = 0C42DB80  SS = 002B  ESP = 002ED2F0    EBP = 002ED358
ECX = 00006400  DS = 002B  ESI = 00000000    FS  = 0053
EDX = 00640000  ES = 002B  EDI = 00000001    GS  = 002B

Code dump:
Code at EAX: 
Code at EBX: 70 E1 4B 0B 00 00 00 00 00 00 00 00 00 00 00 00 
Code at ECX: 
Code at EDX: B8 66 1B 0E 00 99 F5 0D 28 B6 C9 03 06 00 01 00 
Code at EIP: 8B 80 A4 00 00 00 89 83 D4 02 00 00 8B 83 10 03 
Code at ESP: 80 DB 42 0C 9A 7B 4E 0B 80 DB 42 0C C6 49 4D 0B 
Code at ESI: 
Code at EDI: 

Stack dump EAX:

Stack dump EBX:
0B4BE170 00000000 00000000 00000000 00000000 
00000000 00000000 00000008 00000000 00000000 
00000000 00000000 00000001 00000000 0B029088 
0B029098 00000000 00000000 0B4DD414 0C42DB80 

Stack dump ECX:

Stack dump EDX:
0E1B66B8 0DF59900 03C9B628 00010006 00000BF9 
0000002F 0063FB98 0000052E 0001000A 00000000 
0DC818D8 00000000 00000000 0DC81918 0DC74208 
0E1AF6D8 0E1AF478 00000000 00000000 00000000 

Stack dump EIP:
00A4808B 83890000 000002D4 0310838B 408B0000 
D8838974 B8000002 00000002 FEE7C9E8 DC8389FF 
B8000002 00000002 FEE7B9E8 E08389FF B8000002 
0000000F FEE7A9E8 E48389FF B8000002 0000000F 

Stack dump ESP:
0C42DB80 0B4E7B9A 0C42DB80 0B4D49C6 0B4D4A4E 
0C42DB80 0C42DB80 0B4D35B2 002ED360 0B4C7E53 
00000000 0C28FE70 0B4D9B5A 03900E90 0C28FE70 
0B251D8F 002ED33C 0AF8B604 002ED358 002ED404 

Stack dump ESI:

Stack dump EDI:


PS on a side note we have been getting calls from customers complaining their office 2016 is very unstable, and some of the clients started having problems at time they started using the new addin build against latest addin express, i'm not saying it's related just yet as we are still investigating and making sure it's not due to the new addin express version by letting them use an old version of our addin where the sole diffrence is that it's build agains another version of addin express. Unfortunatly i don't have any stacktrace from that but i thought i should mention it already. If we do have more info and confirmations their word does not crash using the previous version (build against older addin express version i'll open a new topic to discuss about)
Posted 23 Aug, 2018 09:33:06 Top
Andrei Smolin


Add-in Express team


Posts: 15595
Joined: 2006-05-11
Hello Tim,

We don't think that this method is responsible for that exception. Still, you may want to wrap the code of this method in a try/except block to check this.

Is this issue reproducible on a simple add-in showing a form in the same region?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 28 Aug, 2018 06:08:59 Top
Tim Smet




Posts: 36
Joined: 2015-10-06
Hi Andrei,

The function Adxwsbcls.TadxTheme.InitThemeColor is from addin express itselve, we did not write it. I also find it weird that it might be responsible for the problem as all it does is getting some color values or setting some.

I noticed the function gets called whenever a new document is opened or created basically whenever a new word window for a document is created. But if i'm to believe the stackstrace it can be called from a certain WM message as well but i have not been able to reproduce that.

Currently with the client having the problem we went back to our word addin version using previous version of addin express.

I also am unable to trigger this problem on office 2016 and i have not had the time to test on a office 2013 in the office yet. But i'm not sure i'll be able to reproduce.

The client seems to get the error at random times so i'm not sure how to trigger it myselve.

We do have a subscription for the addinexpress source code so i can try to put a try except statement inside it and see if it still happens with the client and perhaps log the exception somewhere to be certain it is caused by addin express new build but i have my doubts as well.

I'll let you know once i know more, the word crashing problem in office 2016 i already slightly mentioned is a worse problem than this. Currently our addin build aganst older version of addin express does not seem to exhibit the problem. (Word crashed 3-4 times a day using our addin build against latest version when being tested with the addin build against older addin express version the clients suffering the problem did not have a crash since we placed the old version build against old addin express version back yet. I also have not been able to reproduce this yet.
Posted 28 Aug, 2018 06:52:01 Top
Andrei Smolin


Add-in Express team


Posts: 15595
Joined: 2006-05-11
Hello Tim,

Please wrap the code of TAdxTheme.Initialize in a try/except block. Also, wrap the code of TadxWDContainerPane.WndProc in this way:

procedure TadxForm.WndProc(var Msg: TMessage);
try

except
  on e: Exception do ShowMessage('WndProc error: ' + e.Message + ' msg='+ IntToStr(Msg.Msg))
end;


Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 29 Aug, 2018 09:23:44 Top
Ronald Siekman




Posts: 39
Joined: 2008-12-17
Hi Andrei,

I have the same problem.
Your suggestion does not work.
I am still searching for a solution.

Greetings,

Ronald
Posted 30 Aug, 2018 10:09:00 Top
Tim Smet




Posts: 36
Joined: 2015-10-06
Hey Ronald,

When you say you have same problem do you mean word 2016 (/ 2013 ?) crashing randomly or some reference about the same exception as in the topic title ? And that the try / except statements did not solve the issue for crashing problem ?

Only wondering as initally started the topic with the info i had from an exception i had cought, but the word 2016 crashing problem i have no data at all besides entries in the windows event log about word crashing

Also we had placed a version of our addin version build against older addin express version in 3 client's offices and none of the people had a crash during a whole week, while many other offices (with multple clients) as well those 3 offices with multiple clients did have crashes of office 2016 when using our addin build agains latest addin expres.

i'm starting to think the new addin express version might be the cause, i can't find any other correlation between the testings as the sole diffrence in our addin we release was addin express version used to be build against.

we are still doing investigations and trying to reproduce the problem.

One client said she had the word crashing thing while not being at the pc, she went to grab a drink and when she came back to word had crashed.

I still have no direct evidence to blame the new version but it's a rather weird thing that the issue went away with clients in 3 offices when placing our old addin version back (build against old addin express).

I added the try / except statements today but we have not released it yet / tested with the clients having the word 2013 problem nor with clients having the office 2016 crashing problems

edit:
here's a sample from the eventlog entry but it does not give any more clues / information
Naam van toepassing met fout: WINWORD.EXE, versie: 16.0.10325.20082, tijdstempel: 0x5b524509
Naam van module met fout: KERNELBASE.dll, versie: 10.0.17134.137, tijdstempel: 0x16722c9d
Uitzonderingscode: 0x0eedfade
Foutmarge: 0x0010db92
Id van proces met fout: 0x285c
Starttijd van toepassing met fout: 0x01d4393800d0e805
Pad naar toepassing met fout: C:Program Files (x86)Microsoft OfficeRootOffice16WINWORD.EXE
Pad naar module met fout: C:WINDOWSSystem32KERNELBASE.dll
Rapport-id: 6461faa9-5395-42b6-a75a-f7334665fbc5
Volledige pakketnaam met fout: 
Relatieve toepassings-id van pakket met fout:


according to answer on this topic https://stackoverflow.com/questions/16602756/strange-0x0eedfade-exception-in-delphi-multi-thread-program 0x0eedfade is a delphi exception and the crash in word probably occurs because it's an unhandled exception somewhere

i'll try compiling with range checking on on monday to see if tells me something
Posted 30 Aug, 2018 11:57:14 Top
Ronald Siekman




Posts: 39
Joined: 2008-12-17
Hi Tim,

I have the same exception as in the topic title in Outlook 2016 and I also think that
the new add-in express version is the problem. The previous version works just fine.
I think it has something to do with High DPI support and theming.
Posted 31 Aug, 2018 02:32:16 Top
Tim Smet




Posts: 36
Joined: 2015-10-06
Ronald did you find a way to trigger the exception on purpose or is it also random at times, as i have not been able to find a way to trigger it on purpose on pc's in the office?

I also wonder, if you get the exception not while debugging and you don't catch it using try / except does your word 2016 crash (and reopen) then if it happens ? Just wondering as i like to know if the word 2016 crashes using our addin and latest addin express are perhaps the same cause or if it's another problem
Posted 31 Aug, 2018 03:18:58 Top
Ronald Siekman




Posts: 39
Joined: 2008-12-17
I can't reproduce it myself, but I have a colleague who can reproduce
the problem. In Outlook after creating a meeting request and then switch back to mail he gets a AV.
My temporary fix is a try except in adxWSbcls.

procedure TadxThemeChanged.WndProc(var Message: TMessage);
begin
inherited;

try
if ((Message.Msg = WM_MSO_BROADCASTCHANGE) and ((Message.WParam = $48) or (Message.WParam = $76)) ) or (Message.Msg = WM_SYSCOLORCHANGE) or (Message.Msg = WM_SETTINGCHANGE) then begin
if Assigned(FAdxTheme) then
FAdxTheme.DoThemeChanged;
end;
except
end;
end;

It looks like that it works for now.
The problem is not really solved, maybe Andre has a better solution in the future.
Not all the users have this problem. It could be a combination of a Microsoft Office and a Windows update.
Posted 31 Aug, 2018 04:55:56 Top
Tim Smet




Posts: 36
Joined: 2015-10-06
Hi ronald,

thanks for this answer, it seems the initial stacktrace i posted was correct then a wndproc + themecolor thing.

I also know how to generate a wm_settingchange it usually happens if you change some settings in control panel and usually you see the windows taskbar refreshing (it's icons) then.

the WM_MSO_BROADCASTCHANGE i don't know but i did find some info on stackoverflow saying ms office apps broadcast it to other top level windows but i don't know when. It said it was used internally.

I'll mess around a bit on monday and perhaps even create some program to broadcast those wm_messages around on purpose to see if i can trigger the word crash and / or the exception (if it's related to the same problem).

It will also help andrei diagnose the problem i think
Posted 31 Aug, 2018 06:29:44 Top