Visio version issue

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

Visio version issue
 
Subscribe
ManualMaster Development




Posts: 41
Joined: 2007-05-25
I've noticed that in Visio, I couldn't activate my custom ribbon tab. After quite big investigation I've found that the problem is that in my AddinModule instance, HostVersion is "16,0". Please notice the comma character as a separator. I've discovered that in AddinModule you are using GetMajorHostVersion method which parse this date by looking a dot character '.'. Because of this, it returns 0 as a major version instead of 16 which is a cause of problem with activating a ribbon tab.
Other applications, like Word and Excel works good. I'm not sure if the problem is how AddinExpress get the Visio version (if there is a bug) or maybe Visio recently changed a version format. But for sure now AddinExpress cannot parse it correctly. Moreover this problem occured on several computer and also in my users' machines.

As a temporary fix I invoke this function at the AddinModule startup:

private void FixVisioVersion()
{
    try
    {
         var prop = typeof(ADXAddinModule).GetField("hostVersion", System.Reflection.BindingFlags.NonPublic
                              | System.Reflection.BindingFlags.Instance |
                                System.Reflection.BindingFlags.Public);
         prop.SetValue(this, HostVersion.Replace(",", "."));
    }
    catch (Exception e)
    {
         Log.ErrorException("FixVisioVersion", e);
    }
            
}


I hope that you can fix this problem in the better way. If you need more info, please let me know.
Regards,
ManualMaster Development
Posted 24 Jan, 2023 03:02:12 Top
Andrei Smolin


Add-in Express team


Posts: 18515
Joined: 2006-05-11
Hello,

We haven't been reported about such an issue. Actually, Add-in Express don't use comma or dot, it uses System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator. Can you check Control Panel | Region | Formats tab | Addintional Settings | Numbers tab | Decimal symbol on the affected machine? Will the issue go away if you restart the machine?

If this doesn't help what Windows build are you using? Is it 32bit or 64bit? Please provide the same info about Office: build and bitness.

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 25 Jan, 2023 04:13:06 Top
ManualMaster Development




Posts: 41
Joined: 2007-05-25
Thanks for the response.

I've made a bigger investigation and I've found the problem. You are right that in your version parsing code you use NumberDecimalSeparator. Visio version is using this character so in theory everything is good. But the problem is that after we open visio, in our code we override CultureInfo.CurrentCulture to the specific language (for example user in our application has choosen English language, so we set CUrrentCultrue to English). And this is a cause of the problem. Visio version you hold in hostVersion field has been "generated" with the initial CultureInfo setting but later it has been changed and NumberDecimalSeparator is different now so parsing fails.

I'm not sure if you can and plan to do anything with this (I'm not sure if we should treat this as a bug in AddinExpress or specific use case in our application). But for now I will leave my workaround where I replace comma to dot.

Thanks,
Roman
Regards,
ManualMaster Development
Posted 25 Jan, 2023 08:04:02 Top
Andrei Smolin


Add-in Express team


Posts: 18515
Joined: 2006-05-11
Hello Roman,

ManualMaster Development writes:
ut the problem is that after we open visio, in our code we override CultureInfo.CurrentCulture to the specific language (for example user in our application has choosen English language, so we set CUrrentCultrue to English).


This looks like a valid concern and we would be willing to fix the issue.

Could you create a sample add-in project changing the culture in the Click event of a test Ribbon button (actually, any other event will do) so that I could reproduce this issue?

Regards from Poland (GMT+1),

Andrei Smolin
Add-in Express Team Leader
Posted 27 Jan, 2023 09:15:58 Top