Skip to content
This repository was archived by the owner on Feb 24, 2024. It is now read-only.

Check if TwinCAT project is pinned #9

Merged
merged 2 commits into from
Nov 15, 2020
Merged

Check if TwinCAT project is pinned #9

merged 2 commits into from
Nov 15, 2020

Conversation

Beidendorfer
Copy link
Contributor

If it is a pinned version, check if this Version is available otherwise close the solution

Bug fixed: First set the SilentMode and then try to open the Remote Manager
otherwise the remoteManger can show a MessageBox

If it is a pinned version, check if this Version is available otherwise close the solution

Bug fixed: First set the SilentMode and then try to open the Remote Manager
otherwise the remoteManger can show a MessageBox
@@ -14,7 +14,7 @@ namespace TcUnit.TcUnit_Runner
/// </summary>
class AutomationInterface
{
private ITcSysManager10 sysManager = null;
private ITcSysManager13 sysManager = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is ITcSysManager13 also available in TwinCAT 4020? (TcUnit supports > 4020.0).
Is there anything specific that needs 13 that 10 doesn't have?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if ITcSysManager13 is available in TwinCAT 4020.
I do not have version 4020.0 for validation

In 13 you can read out via the SysManger interface whether the version is pinned.

In the current version ITcSysManager13 and sysManager.TcVersionFixed is not used.
can therefore be removed and remain on ITcSysManager10.
public bool TcPinnedVersion { get { return sysManager.TcVersionFixed; } }

Why is sysManager.TcVersionFixed not used? I would like to post something about the general procedure below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It has to work with 4020.0, and it has to be validated to work with 4020.0 (as it does now). You can get 4020.0 from the Beckhoff support, or download it via this link: https://www.beckhoff.com/forms/twincat3/warenkorb.aspx?lg=en&title=TC31-Full-Setup.3.1.4020.0&version=3.1.4020.0

{
get
{
return sysManager.TcVersionFixed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... why do we need the rest of the code (with XML-parsing and everything, GetPinnedVersionXML) if the sysmanager already provides this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I come back why XML parser (only needs ITcSysManager10) and not SysManger.TcVersionFixed (requires ITcSysManager13)

The ITcSysManager interface only works if the project is loaded.
But the check has to take place before loading. Therefore I could not use SysManger.TcVersionFixed.

If I tried to load a pinned project with a version which is not available, the RemoteManger automatically ( silentMode = true)
loaded the last version. (no matter if pinned or not)
and automatically upgraded my pinned version to the last version.

At the end of the unit test my project was still pinned, but on the wrong version

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean that we will never use the SysManager.TcVersionFixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have to go to version 4020.0 and check the interface ITcSysManager13.

I assume that it does not work. This would mean we cannot use SysManager.TcVersionFixed from the interface ITcSysManager13

@Beidendorfer
Copy link
Contributor Author

In this test the project is pinned and a version 4022.29 is not available
The programme is aborted.

2020-10-02 07:31:46 - TcUnit-Runner build: 0.9.2.0
2020-10-02 07:31:46 - TcUnit-Runner build date: 25/10/2020
2020-10-02 07:31:46 - Visual Studio solution path: C:\Git_Repos\Unit Test\CM_CylinderModul_UnitTest.sln
2020-10-02 07:31:46 -
2020-10-02 07:31:46 - In TwinCAT project file, found TwinCAT version 3.1.4022.29
2020-10-02 07:31:46 - In Visual Studio solution file, found visual studio version 15.0
2020-10-02 07:31:46 - Version is pinned: True
2020-10-02 07:31:46 - Trying to load the Visual Studio Development Tools Environment (DTE) version 'TcXaeShell.DTE.15.0' ...
2020-10-02 07:32:06 - ...SUCCESSFUL!
2020-10-02 07:32:21 - Using the TwinCAT remote manager to load TwinCAT version '3.1.4022.29'...
2020-10-02 07:32:22 - Project has a pinned Version : 3.1.4022.29
2020-10-02 07:32:23 - the pinned TC Version is not available

2020-10-02 07:32:23 - ERROR: Error loading VS DTE. Is the correct version of Visual Studio and TwinCAT installed? Is the TcUnit-Runner running with administrator privileges?
2020-10-02 07:32:23 - Exiting application...<

In this test the project is pinned and a version 4022.30 is available
The programme runs correct

2020-10-02 07:33:57 - TcUnit-Runner build: 0.9.2.0
2020-10-02 07:33:57 - TcUnit-Runner build date: 25/10/2020
2020-10-02 07:33:57 - Visual Studio solution path: C:\Git_Repos\Unit Test\CM_CylinderModul_UnitTest.sln
2020-10-02 07:33:57 -
2020-10-02 07:33:57 - In TwinCAT project file, found TwinCAT version 3.1.4022.30
2020-10-02 07:33:57 - In Visual Studio solution file, found visual studio version 15.0
2020-10-02 07:33:57 - Version is pinned: True
2020-10-02 07:33:57 - Trying to load the Visual Studio Development Tools Environment (DTE) version 'TcXaeShell.DTE.15.0' ...
2020-10-02 07:34:17 - ...SUCCESSFUL!
2020-10-02 07:34:35 - Using the TwinCAT remote manager to load TwinCAT version '3.1.4022.30'...
2020-10-02 07:34:35 - Project has a pinned Version : 3.1.4022.30
2020-10-02 07:34:36 - the pinned TC Version is available
2020-10-02 07:34:57 - load TwinCAT version

2020-10-02 07:36:24 - No task name provided. Assuming only one task exists
2020-10-02 07:36:25 - Found task with name 'PlcTask'
2020-10-02 07:37:22 - Setting target NetId to '127.0.0.1.1.1'
2020-10-02 07:37:22 - Enabling boot project and setting BootProjectAutostart on 127.0.0.1.1.1
2020-10-02 07:38:16 - Waiting for results from TcUnit...
2020-10-02 07:38:26 - ... got 1 report lines so far.
2020-10-02 07:38:37 - ... got 178 report lines so far.
2020-10-02 07:38:48 - ... got 456 report lines so far.
2020-10-02 07:38:49 - All results from TcUnit obtained
2020-10-02 07:39:00 - Done collecting TC results
2020-10-02 07:39:00 - Writing xUnit XML file to C:\Git_Repos\Unit Test\TcUnit_xUnit_results.xml
2020-10-02 07:39:00 - Closing the Visual Studio Development Tools Environment (DTE)...
2020-10-02 07:39:20 - Exiting application...
<

In this test the project is not pinned and a version 4022.29 is not available
The programme runs correct with Version 4022.32

2020-10-02 07:47:45 - TcUnit-Runner build: 0.9.2.0
2020-10-02 07:47:45 - TcUnit-Runner build date: 25/10/2020
2020-10-02 07:47:45 - Visual Studio solution path: C:\Git_Repos\Unit Test\CM_CylinderModul_UnitTest.sln
2020-10-02 07:47:45 -
2020-10-02 07:47:45 - In TwinCAT project file, found TwinCAT version 3.1.4022.29
2020-10-02 07:47:45 - In Visual Studio solution file, found visual studio version 15.0
2020-10-02 07:47:45 - Version is pinned: False
2020-10-02 07:47:45 - Trying to load the Visual Studio Development Tools Environment (DTE) version 'TcXaeShell.DTE.15.0' ...
2020-10-02 07:48:08 - ...SUCCESSFUL!
2020-10-02 07:48:21 - Using the TwinCAT remote manager to load TwinCAT version '3.1.4022.29'...
2020-10-02 07:48:35 - Load TwinCAT version: 3.1.4022.32

2020-10-02 07:49:55 - No task name provided. Assuming only one task exists
2020-10-02 07:49:56 - Found task with name 'PlcTask'
2020-10-02 07:50:46 - Setting target NetId to '127.0.0.1.1.1'
2020-10-02 07:50:46 - Enabling boot project and setting BootProjectAutostart on 127.0.0.1.1.1
2020-10-02 07:51:37 - Waiting for results from TcUnit...
2020-10-02 07:51:47 - ... got 1 report lines so far.
2020-10-02 07:51:57 - ... got 198 report lines so far.
2020-10-02 07:52:08 - ... got 456 report lines so far.
2020-10-02 07:52:09 - All results from TcUnit obtained
2020-10-02 07:52:20 - Done collecting TC results
2020-10-02 07:52:20 - Writing xUnit XML file to C:\Git_Repos\Unit Test\TcUnit_xUnit_results.xml
2020-10-02 07:52:20 - Closing the Visual Studio Development Tools Environment (DTE)...
2020-10-02 07:52:40 - Exiting application...
<

@Beidendorfer
Copy link
Contributor Author

What is the best way to continue? @sagatowski What is your recommendation.

@sagatowski
Copy link
Member

In this test the project is pinned and a version 4022.29 is not available
The programme is aborted.

2020-10-02 07:31:46 - TcUnit-Runner build: 0.9.2.0
2020-10-02 07:31:46 - TcUnit-Runner build date: 25/10/2020
2020-10-02 07:31:46 - Visual Studio solution path: C:\Git_Repos\Unit Test\CM_CylinderModul_UnitTest.sln
2020-10-02 07:31:46 -
2020-10-02 07:31:46 - In TwinCAT project file, found TwinCAT version 3.1.4022.29
2020-10-02 07:31:46 - In Visual Studio solution file, found visual studio version 15.0
2020-10-02 07:31:46 - Version is pinned: True
2020-10-02 07:31:46 - Trying to load the Visual Studio Development Tools Environment (DTE) version 'TcXaeShell.DTE.15.0' ...
2020-10-02 07:32:06 - ...SUCCESSFUL!
2020-10-02 07:32:21 - Using the TwinCAT remote manager to load TwinCAT version '3.1.4022.29'...
2020-10-02 07:32:22 - Project has a pinned Version : 3.1.4022.29
2020-10-02 07:32:23 - the pinned TC Version is not available

2020-10-02 07:32:23 - ERROR: Error loading VS DTE. Is the correct version of Visual Studio and TwinCAT installed? Is the TcUnit-Runner running with administrator privileges?
2020-10-02 07:32:23 - Exiting application...<

In this test the project is pinned and a version 4022.30 is available
The programme runs correct

2020-10-02 07:33:57 - TcUnit-Runner build: 0.9.2.0
2020-10-02 07:33:57 - TcUnit-Runner build date: 25/10/2020
2020-10-02 07:33:57 - Visual Studio solution path: C:\Git_Repos\Unit Test\CM_CylinderModul_UnitTest.sln
2020-10-02 07:33:57 -
2020-10-02 07:33:57 - In TwinCAT project file, found TwinCAT version 3.1.4022.30
2020-10-02 07:33:57 - In Visual Studio solution file, found visual studio version 15.0
2020-10-02 07:33:57 - Version is pinned: True
2020-10-02 07:33:57 - Trying to load the Visual Studio Development Tools Environment (DTE) version 'TcXaeShell.DTE.15.0' ...
2020-10-02 07:34:17 - ...SUCCESSFUL!
2020-10-02 07:34:35 - Using the TwinCAT remote manager to load TwinCAT version '3.1.4022.30'...
2020-10-02 07:34:35 - Project has a pinned Version : 3.1.4022.30
2020-10-02 07:34:36 - the pinned TC Version is available
2020-10-02 07:34:57 - load TwinCAT version

2020-10-02 07:36:24 - No task name provided. Assuming only one task exists
2020-10-02 07:36:25 - Found task with name 'PlcTask'
2020-10-02 07:37:22 - Setting target NetId to '127.0.0.1.1.1'
2020-10-02 07:37:22 - Enabling boot project and setting BootProjectAutostart on 127.0.0.1.1.1
2020-10-02 07:38:16 - Waiting for results from TcUnit...
2020-10-02 07:38:26 - ... got 1 report lines so far.
2020-10-02 07:38:37 - ... got 178 report lines so far.
2020-10-02 07:38:48 - ... got 456 report lines so far.
2020-10-02 07:38:49 - All results from TcUnit obtained
2020-10-02 07:39:00 - Done collecting TC results
2020-10-02 07:39:00 - Writing xUnit XML file to C:\Git_Repos\Unit Test\TcUnit_xUnit_results.xml
2020-10-02 07:39:00 - Closing the Visual Studio Development Tools Environment (DTE)...
2020-10-02 07:39:20 - Exiting application...
<

In this test the project is not pinned and a version 4022.29 is not available
The programme runs correct with Version 4022.32

2020-10-02 07:47:45 - TcUnit-Runner build: 0.9.2.0
2020-10-02 07:47:45 - TcUnit-Runner build date: 25/10/2020
2020-10-02 07:47:45 - Visual Studio solution path: C:\Git_Repos\Unit Test\CM_CylinderModul_UnitTest.sln
2020-10-02 07:47:45 -
2020-10-02 07:47:45 - In TwinCAT project file, found TwinCAT version 3.1.4022.29
2020-10-02 07:47:45 - In Visual Studio solution file, found visual studio version 15.0
2020-10-02 07:47:45 - Version is pinned: False
2020-10-02 07:47:45 - Trying to load the Visual Studio Development Tools Environment (DTE) version 'TcXaeShell.DTE.15.0' ...
2020-10-02 07:48:08 - ...SUCCESSFUL!
2020-10-02 07:48:21 - Using the TwinCAT remote manager to load TwinCAT version '3.1.4022.29'...
2020-10-02 07:48:35 - Load TwinCAT version: 3.1.4022.32

2020-10-02 07:49:55 - No task name provided. Assuming only one task exists
2020-10-02 07:49:56 - Found task with name 'PlcTask'
2020-10-02 07:50:46 - Setting target NetId to '127.0.0.1.1.1'
2020-10-02 07:50:46 - Enabling boot project and setting BootProjectAutostart on 127.0.0.1.1.1
2020-10-02 07:51:37 - Waiting for results from TcUnit...
2020-10-02 07:51:47 - ... got 1 report lines so far.
2020-10-02 07:51:57 - ... got 198 report lines so far.
2020-10-02 07:52:08 - ... got 456 report lines so far.
2020-10-02 07:52:09 - All results from TcUnit obtained
2020-10-02 07:52:20 - Done collecting TC results
2020-10-02 07:52:20 - Writing xUnit XML file to C:\Git_Repos\Unit Test\TcUnit_xUnit_results.xml
2020-10-02 07:52:20 - Closing the Visual Studio Development Tools Environment (DTE)...
2020-10-02 07:52:40 - Exiting application...
<

Looks good @Beidendorfer !

@sagatowski
Copy link
Member

What is the best way to continue? @sagatowski What is your recommendation.

@Beidendorfer Just update the code according to the comments above! I will do some internal testing and then I will merge your changes to the main. Thanks a lot!

@sagatowski
Copy link
Member

Hi @Beidendorfer, impressive work! I'll look at this now.

@sagatowski
Copy link
Member

@Beidendorfer, I tried to compile the program but I get several compile-errors.
Did you forget to push some changes?
image

@sagatowski
Copy link
Member

@Beidendorfer It seems there was just one questionmark too much in the code. I've removed it and now it compiles.

@sagatowski sagatowski changed the title Read if Project is a pinned Version. Check if TwinCAT project is pinned Nov 15, 2020
sagatowski added a commit that referenced this pull request Nov 15, 2020
@sagatowski sagatowski merged commit 0389a65 into tcunit:master Nov 15, 2020
@sagatowski
Copy link
Member

@Beidendorfer Thanks for your contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants