03-01-2024 10:38 AM
I got a SW project from another developer and now I am doing commissioning of the station. However, when I want to edit the HMI window, it either doesn't load at all or loads incorrectly.
See screenshots of what the project looks like in CPS and what it looks like in the station when I do the deployment.
A window that cannot be opened displays a description of the error:
Object reference not set to an instance of an object.
Source: VisiWinNET.Smart.Core
StackTrace: at VisiWinNET.Smart.Design.SFCHostLoader.PerformLoad(IDesignerSerializationManager designerSerializationManager)
I tried to update the HMI NXRD file but with no success.
Solved! Go to Solution.
03-01-2024 11:01 AM - edited 03-01-2024 11:02 AM
Looks like the HMI components are not found or cannot be loaded at design time.
Updating the NXRD file was a good idea. Just to make sure: Have you used an HMI version matching the CpStudio version? (Only the first two places are relevant, patches are compatible. e.g. CpStudio 5.8.x works with HMI 5.8.y)
Is your project (including the Std folder) located on a local drive? I have seen this problem (or at least a similar one) when projects were located on a network drive.
Next you could check some files in the <Station>\Hmi folder:
The file OpCon.HMI.Modulo.csproj contains reference paths from the Hmi folder to the dll files in the Std\Hmi_Vx_y looking like this:
<Reference Include="OpCon.HMI.Interfaces">
<HintPath>..\..\Std\Hmi_V5_8\OpCon.HMI.Interfaces.dll</HintPath>
<CopyLocal>True</CopyLocal>
</Reference>
The red path has to be correct (especially the version). The paths are automatically adapted when updating a project to a later CpStudio version, so they should usually be correct, but when using Source Code Control systems and not committing everything, the files can be inconsistent.
In the same folder, check the file VisiWinNETSmart.config. It also contains information about the HMI files:
<Assemblies>
<Assembly alias="OpCon.HMI.Modulo.Forms" assembly="OpCon.HMI.Modulo.Forms, Version=5.8.0.0, Culture=neutral, PublicKeyToken=4241dc8872ae9833" />
<Assembly alias="OpCon.HMI.Modulo.StdWindows" assembly="OpCon.HMI.Modulo.StdWindows, Version=5.8.0.0, Culture=neutral, PublicKeyToken=4241dc8872ae9833" />
<Assembly alias="OpCon.HMI.Modulo.Shared" assembly="OpCon.HMI.Modulo.Shared, Version=5.8.0.0, Culture=neutral, PublicKeyToken=4241dc8872ae9833" />
</Assemblies>
Again, the red versions should be automatically adapted when converting a project.
Apart from that, we have had issues with files that were downloaded from an untrusted source (Internet, SharePoint, other shared storages). Usually I would think that this also causes errors on the target system, but who knows... A solution for this problem is described in this answer: Solved: Re: HMI Html View - Missing DLL file (WebViewLoader2) (bosch.com)
03-01-2024 12:14 PM
Yes, the versions are the same. CPS is V5.6.2, HMI is 5.6.0.18, so the first two numbers match.
Yes, SW project including the Std is stored locally on my computer.
BUT
OpCon.HMI.Modulo.csproj contained <HintPath>..\..\Std\Hmi_V5_8\OpCon.HMI.Interfaces.dll</HintPath>
VisiWinNETSmart.config contained Version=5.8.0.0.
I edited the files in notepad and fixed the version number and it works like a charm. Thank you.
03-01-2024 01:18 PM
OK, this probably means that someone has opened the project with CpStudio 5.8 and later reverted the changes except in these files.