Gauge deployment : Unit convertion issue

Gauge for WPF Forum

Posted 13 years ago by 7Alpha7
Version: 11.1.0541
Avatar
Hello,

I am deploying my project on a computer with no WPF components installed.

At first I tried the deployed project with still WPF Studio installed. It worked.
Then I uninstalled the Actipro product and xcopy the required assemblies on the bin directory.
The project ran but I got then an exception on some Gauge controls :

"Impossible to convert the '0%' string of the 'Y' attribute into an object of type 'ActiproSoftware.windows.Unit'. Error at the 'textBlock' object on the XAML file"

The XAML file is this one and extracted from the Actipro samples :

<UserControl.Resources>
        <!-- Converters -->
        <shared:PercentageConverter x:Key="PercentageConverter" />
        <local:AdditionConverter x:Key="AdditionConverter" />
    </UserControl.Resources>
    
        <gauge:ToggleSwitch x:Name="buttonSwitch" IsChecked="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SwitchType="Flat" IsThreeState="True">
            <gauge:ToggleSwitch.BackgroundGeometry>
                <Geometry>M 1,0 L 2,0 L 3,1 L 3,2 L 2,3 L 1,3 L 0,2 L 0,1 Z</Geometry>
            </gauge:ToggleSwitch.BackgroundGeometry>
            <gauge:ToggleSwitch.RimGeometry>
                <Geometry>M 1,0 L 2,0 L 3,1 L 3,2 L 2,3 L 1,3 L 0,2 L 0,1 Z</Geometry>
            </gauge:ToggleSwitch.RimGeometry>

            <gauge:ToggleSwitch.Items>
                <TextBlock x:Name="textBlock" gauge:ToggleSwitch.Y="0%" Text="" FontWeight="Bold"
                                    Foreground="Green" FontSize="10" />
        </gauge:ToggleSwitch.Items>
        </gauge:ToggleSwitch>
so I tried to change the '0%' string to '0' to see. But I got the same exception :

"Impossible to convert the '0' string of the 'Y' attribute into an object of type 'ActiproSoftware.windows.Unit'. Error at the 'textBlock' object on the XAML file"

So, I tried to use this simple ToggleSwitch on a simple project, an exe with a single form with an ElementHost hosting the switch, with the same 'O%' attribute. Once deployed on the same directory of my project with the trouble, it worked like a charm.

Do you have an idea of what I shall do ? I don't understand why it could not work with the previous scenario.

Comments (3)

Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hello,

It's possible that your assembly references are bad or are loading conflicting versions. Make sure your project references both the Gauge and Shared assemblies, as the TypeConverter for the Unit type is in Shared. If that doesn't help, you can probably use Sysinternals Process Explorer to see the location and version of the Gauge and Shared assemblies that are loaded by your application.


Actipro Software Support

Posted 13 years ago by 7Alpha7
Avatar
I don't think it's a version conflict case. I had copied all the needed assemblies (Shared also), and had checked all references in my project.

Today I tried with the 11.1.0540 release, I was previously with the 10.2.0531 one. I changed all the references of my project and did the same to the xcopy folder. The result was the same.

In fact it happens everywhere a XAML attribute carries a string that has to be converted to percentage unit.

What is amazing is that if I deploy a simple form displaying all the Gauges that have troubles with the other exe, in the bin directory of that exe, it works. If I put a button making a copy of such a form open in the exe that have troubles, it fails.

It drives me crazy. At least it seems it has nothing to do with the Actipro lib. I will try the SysInternal trick.
Posted 13 years ago by 7Alpha7
Avatar
Finally I solved the problem, which was rather tricky. I tried to figure out what was the difference between the two cases that has to do with assemblies, and I only found one :

In my app, at init time I check the dll contained in the bin directory for specific items discovery. The assemblies checked are only loaded in memory passing an array of byte from a file stream targeted to the dll, so that (I imagined) I don't disturb the assembly load process by the application, in case I check a dll that could be loaded later by the application.

In spite of that, it happens that in a way I don't understand, the .net AppDomain is confused by the operation, since it does those kind of errors even though it does not throw any kind of exception regarding the loading of assemblies.

As soon as I take care of letting the assemblies loaded by the application out of the check process, everything goes fine.
The latest build of this product (v24.1.2) was released 1 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.