Comments (18)
Hi!
Please share a couple of further details about your target setup:
- operating system
- installed dotnet framework
- installed twincat version
In addition please activate the logging putting the logging description in the repo near to the twincat function (I will pick for you the correct path) and try to trigger a call.
If no line of log appears you probably have to remotely debugging the twincat library.
BR,
FB
from beckhoffhttpclient.
For activating the logfile copy this file in the same folder as the exe C:/twincat/functions/unofficial/BeckhoffHttpClient
.
from beckhoffhttpclient.
Nice!
I'm happy to help you.
And thank you for helping me improving the library for the whole community.
I think the real cause was that the older client I used initially in this library became obsolete and may have worked in system where the whole engineering was installed.
I sadly completely leaved the development with plc so I may be not so up-to-date.
Best regards,
FB
from beckhoffhttpclient.
Hello, thanks as always for the quick reply, appreciate it!
My target setup:
- Operating system: Windows 11
- dotnet v4.0
- twincat v3.1.4024.32
The logging file was added in the same folder as TFU001 but there were no logs generated
Thanks,
KK
from beckhoffhttpclient.
Hi,
I think something avoid the software to run, we just need to find out what it is.
Are you sure you're running win 11 and dotnet 4.0? I think that's almost impossible since 4.8 get delivered out-of-the-box. Could you please make sure that you have at least 4.6+. Maybe you can start the exe manually. You should see at least a process that starts or an error and a new logfile created.
Did you just deploy your twincat example project on your target machine? Please, make sure you don't use the hot update just applying online changes. In order to deploy the library you need to activate configuration and restart to run mode once at least.
Could you please share your topology and ads ports in use? If you are using some complex topology you may have to override the ams net ID and the ads port (if different from 851) in the library call.
If all these ideas do not lead to further advices related to the problem I suppose we have to set a breakpoint and remotely debug the target through the library.
Best regards,
FB
from beckhoffhttpclient.
Hello!
Sorry about the confusion with dotnet, I double checked the release value under the v4.0 folder and I do have v4.8. (thought v4.0 meant version 4.0).
I've successfully generated a logfile after executing the program (that does not carry the call out successfully, I will post it below)
I've activated configuration and restarted before entering run mode.
Thank you for your patience! genuinely appreciate it.
KK
from beckhoffhttpclient.
[15.09. 09:15:35.750] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 09:15:35.769] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 09:15:35.769] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 09:15:35.788] DEBUG - Program+<OnExecute>d__33.MoveNext - Url: https://dog.ceo/api/breeds/image/random
[15.09. 09:15:35.789] DEBUG - Program+<OnExecute>d__33.MoveNext - Method: GET
[15.09. 09:15:35.796] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "api_key" : "D9C80CF1-C910-41F4-BD7B-D51B72B573AA"
[15.09. 09:15:35.796] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "Authentication" : "api_key"
[15.09. 09:15:35.797] DEBUG - Program+<OnExecute>d__33.MoveNext - Body: {}
[15.09. 09:15:35.797] DEBUG - Program+<OnExecute>d__33.MoveNext - Executing...
[15.09. 09:15:36.582] DEBUG - Program+<OnExecute>d__33.MoveNext - Response code: OK
[15.09. 09:15:36.609] DEBUG - Program+<OnExecute>d__33.MoveNext - Response content: {"message":"https:\/\/images.dog.ceo\/breeds\/collie-border\/n02106166_6437.jpg","status":"success"}
[15.09. 09:15:36.609] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting status code into Global_Variables.ResponseCode...
[15.09. 09:15:36.624] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.NullReferenceException: Object reference not set to an instance of an object.
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 09:15:36.624] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 09:16:22.133] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 09:16:22.150] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 09:16:22.150] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 09:16:22.169] DEBUG - Program+<OnExecute>d__33.MoveNext - Url: https://promise-api.azurewebsites.net/projects
[15.09. 09:16:22.169] DEBUG - Program+<OnExecute>d__33.MoveNext - Method: GET
[15.09. 09:16:22.176] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "api_key" : "D9C80CF1-C910-41F4-BD7B-D51B72B573AA"
[15.09. 09:16:22.176] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "Authentication" : "api_key"
[15.09. 09:16:22.177] DEBUG - Program+<OnExecute>d__33.MoveNext - Body: {}
[15.09. 09:16:22.177] DEBUG - Program+<OnExecute>d__33.MoveNext - Executing...
[15.09. 09:16:22.898] DEBUG - Program+<OnExecute>d__33.MoveNext - Response code: OK
[15.09. 09:16:22.899] DEBUG - Program+<OnExecute>d__33.MoveNext - Response content: [{"id":1,"owner":1,"created":"2022-09-13T22:21:26.625137Z","modified":"2022-09-13T22:21:26.625137Z","name":"Frankfurt Home","location":"Edmonton, AB","client":"Landmark Homes","description":"Frankfurt Landmark Model Home","shipping_date":"2022-09-13","erection_date":"2022-09-23","archived":false,"settings_building_code":"CA","thumbnail":"https://promise-api.azurewebsites.net/data/Frankfurt_Home/single_family_house_thumbnail.png","affiliation":1,"factory":null,"project_type":1,"project_group":null},{"id":2,"owner":1,"created":"2022-09-13T22:21:26.673320Z","modified":"2022-09-13T22:21:26.673320Z","name":"Display Demo","location":"Toronto, ON","client":"Promise Robotics","description":"Demonstration panels","shipping_date":"2022-09-13","erection_date":"2022-09-14","archived":false,"settings_building_code":"CA","thumbnail":"https://promise-api.azurewebsites.net/data/Display_Demo/demo_thumbnail_sj3r677.png","affiliation":1,"factory":null,"project_type":2,"project_group":null},{"id":3,"owner":null,"created":"2022-09-15T10:57:15.878691Z","modified":"2022-09-15T10:57:15.878691Z","name":"Niagara Home","location":"Edmonton, AB","client":"Promise Robotics","description":null,"shipping_date":"2022-10-26","erection_date":"2022-11-01","archived":false,"settings_building_code":"CA","thumbnail":"https://promise-api.azurewebsites.net/data/templates/project_type/Single%20Family%20House/thumbnail_ZhlZxsI.png","affiliation":1,"factory":null,"project_type":1,"project_group":1}]
[15.09. 09:16:22.899] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting status code into Global.ResponseCode...
[15.09. 09:16:22.928] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting json response into ...
[15.09. 09:16:22.928] ERROR - Program+<OnExecute>d__33.MoveNext - Unable to write response content parsing a json object
Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 09:16:22.934] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: name
at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<WriteArray>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 09:16:22.934] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<WriteArray>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 09:29:35.177] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 09:29:35.199] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 09:29:35.200] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 09:29:35.277] DEBUG - Program+<OnExecute>d__33.MoveNext - Url: https://dog.ceo/api/breeds/image/random
[15.09. 09:29:35.277] DEBUG - Program+<OnExecute>d__33.MoveNext - Method: GET
[15.09. 09:29:35.285] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "api_key" : "D9C80CF1-C910-41F4-BD7B-D51B72B573AA"
[15.09. 09:29:35.286] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "Authentication" : "api_key"
[15.09. 09:29:35.286] DEBUG - Program+<OnExecute>d__33.MoveNext - Body: {}
[15.09. 09:29:35.286] DEBUG - Program+<OnExecute>d__33.MoveNext - Executing...
[15.09. 09:29:35.796] DEBUG - Program+<OnExecute>d__33.MoveNext - Response code: OK
[15.09. 09:29:35.797] DEBUG - Program+<OnExecute>d__33.MoveNext - Response content: {"message":"https:\/\/images.dog.ceo\/breeds\/terrier-yorkshire\/n02094433_2053.jpg","status":"success"}
[15.09. 09:29:35.797] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting status code into Global_Variables.ResponseCode...
[15.09. 09:29:35.813] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.NullReferenceException: Object reference not set to an instance of an object.
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 09:29:35.813] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:05.072] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:28:05.088] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:28:05.088] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:28:05.111] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: name
at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:05.111] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:08.884] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:28:08.900] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:28:08.900] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:28:08.923] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: name
at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:08.923] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:09.052] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:28:09.068] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:28:09.068] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:28:09.092] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: name
at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:09.092] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:11.858] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:28:11.874] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:28:11.874] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:28:11.897] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: name
at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:28:11.897] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass3_0`1.<ReadAsync>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:29:07.190] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:29:07.207] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:29:07.207] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:29:07.227] DEBUG - Program+<OnExecute>d__33.MoveNext - Url: https://promise-api.azurewebsites.net/projects
[15.09. 13:29:07.227] DEBUG - Program+<OnExecute>d__33.MoveNext - Method: GET
[15.09. 13:29:07.235] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "api_key" : "D9C80CF1-C910-41F4-BD7B-D51B72B573AA"
[15.09. 13:29:07.235] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "Authentication" : "api_key"
[15.09. 13:29:07.236] DEBUG - Program+<OnExecute>d__33.MoveNext - Body: {}
[15.09. 13:29:07.236] DEBUG - Program+<OnExecute>d__33.MoveNext - Executing...
[15.09. 13:29:08.016] DEBUG - Program+<OnExecute>d__33.MoveNext - Response code: OK
[15.09. 13:29:08.017] DEBUG - Program+<OnExecute>d__33.MoveNext - Response content: [{"id":1,"owner":1,"created":"2022-09-13T22:21:26.625137Z","modified":"2022-09-13T22:21:26.625137Z","name":"Frankfurt Home","location":"Edmonton, AB","client":"Landmark Homes","description":"Frankfurt Landmark Model Home","shipping_date":"2022-09-13","erection_date":"2022-09-23","archived":false,"settings_building_code":"CA","thumbnail":"https://promise-api.azurewebsites.net/data/Frankfurt_Home/single_family_house_thumbnail.png","affiliation":1,"factory":null,"project_type":1,"project_group":null},{"id":2,"owner":1,"created":"2022-09-13T22:21:26.673320Z","modified":"2022-09-13T22:21:26.673320Z","name":"Display Demo","location":"Toronto, ON","client":"Promise Robotics","description":"Demonstration panels","shipping_date":"2022-09-13","erection_date":"2022-09-14","archived":false,"settings_building_code":"CA","thumbnail":"https://promise-api.azurewebsites.net/data/Display_Demo/demo_thumbnail_sj3r677.png","affiliation":1,"factory":null,"project_type":2,"project_group":null},{"id":3,"owner":null,"created":"2022-09-15T10:57:15.878691Z","modified":"2022-09-15T10:57:15.878691Z","name":"Niagara Home","location":"Edmonton, AB","client":"Promise Robotics","description":null,"shipping_date":"2022-10-26","erection_date":"2022-11-01","archived":false,"settings_building_code":"CA","thumbnail":"https://promise-api.azurewebsites.net/data/templates/project_type/Single%20Family%20House/thumbnail_ZhlZxsI.png","affiliation":1,"factory":null,"project_type":1,"project_group":1}]
[15.09. 13:29:08.017] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting status code into Global.ResponseCode...
[15.09. 13:29:08.045] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting json response into ...
[15.09. 13:29:08.045] ERROR - Program+<OnExecute>d__33.MoveNext - Unable to write response content parsing a json object
Newtonsoft.Json.JsonReaderException: Error reading JObject from JsonReader. Current JsonReader item is not an object: StartArray. Path '', line 1, position 1.
at Newtonsoft.Json.Linq.JObject.Load(JsonReader reader, JsonLoadSettings settings)
at Newtonsoft.Json.Linq.JObject.Parse(String json, JsonLoadSettings settings)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:29:08.050] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: name
at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<WriteArray>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:29:08.050] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.Ads.TcAdsClient.ReadSymbolInfo(String name)
at TwinCAT.JsonExtension.AdsClientExtensions.<WriteArray>d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:30:05.780] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:30:05.797] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:30:05.797] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:30:05.817] DEBUG - Program+<OnExecute>d__33.MoveNext - Url: https://dog.ceo/api/breeds/image/random
[15.09. 13:30:05.817] DEBUG - Program+<OnExecute>d__33.MoveNext - Method: GET
[15.09. 13:30:05.824] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "api_key" : "D9C80CF1-C910-41F4-BD7B-D51B72B573AA"
[15.09. 13:30:05.824] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "Authentication" : "api_key"
[15.09. 13:30:05.825] DEBUG - Program+<OnExecute>d__33.MoveNext - Body: {}
[15.09. 13:30:05.825] DEBUG - Program+<OnExecute>d__33.MoveNext - Executing...
[15.09. 13:30:06.367] DEBUG - Program+<OnExecute>d__33.MoveNext - Response code: OK
[15.09. 13:30:06.368] DEBUG - Program+<OnExecute>d__33.MoveNext - Response content: {"message":"https:\/\/images.dog.ceo\/breeds\/pointer-german\/n02100236_2045.jpg","status":"success"}
[15.09. 13:30:06.368] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting status code into Global_Variables.ResponseCode...
[15.09. 13:30:06.385] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.NullReferenceException: Object reference not set to an instance of an object.
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:30:06.386] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:32:27.880] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:32:27.897] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:32:27.897] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:32:27.916] DEBUG - Program+<OnExecute>d__33.MoveNext - Url: https://dog.ceo/api/breeds/image/random
[15.09. 13:32:27.916] DEBUG - Program+<OnExecute>d__33.MoveNext - Method: GET
[15.09. 13:32:27.923] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "api_key" : "D9C80CF1-C910-41F4-BD7B-D51B72B573AA"
[15.09. 13:32:27.923] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "Authentication" : "api_key"
[15.09. 13:32:27.924] DEBUG - Program+<OnExecute>d__33.MoveNext - Body: {}
[15.09. 13:32:27.924] DEBUG - Program+<OnExecute>d__33.MoveNext - Executing...
[15.09. 13:32:28.412] DEBUG - Program+<OnExecute>d__33.MoveNext - Response code: OK
[15.09. 13:32:28.413] DEBUG - Program+<OnExecute>d__33.MoveNext - Response content: {"message":"https:\/\/images.dog.ceo\/breeds\/beagle\/n02088364_14702.jpg","status":"success"}
[15.09. 13:32:28.413] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting status code into Global_Variables.ResponseCode...
[15.09. 13:32:28.429] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.NullReferenceException: Object reference not set to an instance of an object.
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:32:28.429] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:35:07.110] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[15.09. 13:35:07.127] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[15.09. 13:35:07.127] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[15.09. 13:35:07.146] DEBUG - Program+<OnExecute>d__33.MoveNext - Url: https://dog.ceo/api/breeds/image/random
[15.09. 13:35:07.146] DEBUG - Program+<OnExecute>d__33.MoveNext - Method: GET
[15.09. 13:35:07.153] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "api_key" : "D9C80CF1-C910-41F4-BD7B-D51B72B573AA"
[15.09. 13:35:07.153] DEBUG - Program+<OnExecute>d__33.MoveNext - Adding header: "Authentication" : "api_key"
[15.09. 13:35:07.154] DEBUG - Program+<OnExecute>d__33.MoveNext - Body: {}
[15.09. 13:35:07.154] DEBUG - Program+<OnExecute>d__33.MoveNext - Executing...
[15.09. 13:35:07.665] DEBUG - Program+<OnExecute>d__33.MoveNext - Response code: OK
[15.09. 13:35:07.666] DEBUG - Program+<OnExecute>d__33.MoveNext - Response content: {"message":"https:\/\/images.dog.ceo\/breeds\/havanese\/00100trPORTRAIT_00100_BURST20191222103956878_COVER.jpg","status":"success"}
[15.09. 13:35:07.666] DEBUG - Program+<OnExecute>d__33.MoveNext - Wrinting status code into Global_Variables.ResponseCode...
[15.09. 13:35:07.681] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.NullReferenceException: Object reference not set to an instance of an object.
at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[15.09. 13:35:07.681] ERROR - Program+<OnExecute>d__33.MoveNext - at TwinCAT.JsonExtension.AdsClientExtensions.<>c__DisplayClass1_0`1.<WriteAsync>b__0()
at System.Threading.Tasks.Task.Execute()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at TFU001.Program.<OnExecute>d__33.MoveNext()
from beckhoffhttpclient.
Hi!
I see several different errors. Here the list bottom up.
- 13:35 NullReferenceException while writing over the ADS -> possible cause: the variable Global_Variables.ResponseCode do not exists the driver is unable to retrieve a symbol or create an handle for it.
- 13:32 (same as above)
- 13:30 (same as above)
- 13:30 ArgumentOutOfRangeException while retrieving the symbol over ADS
- 13:28 (4 times, the same as above)
- 9:29 (same as NullReferenceException)
- 9:16 (same as ArgumentOutOfRangeException)
- 9:15 (same as NullReferenceException)
Something in your ADS seems to avoid the communication from the function to the PLC. Can you please give check please?
I will check the current reference of the library Twincat.JsonExtension in order to exclude older bugs I already fixed elsewhere.
Best regards,
FB
from beckhoffhttpclient.
Please give an update once you install the latest version. Thanks.
from beckhoffhttpclient.
Hello!
I've installed the latest version and imported the latest version of the library as well, unfortunately same issue persists. As for the ADS, I haven't configured the ADS in any way on my program so it should be the same as what it would be out of the box. I've double checked that the variable does exist as well and created a new global variables list to test as well, nothing seems to have fixed the problem, do you have any suggestions as tto what could be causing the ADS to behave abnormally?
Thanks,
KK
from beckhoffhttpclient.
Hi!
OK let's summarize the situation.
Th plc seems to be able to trigger the function, the api requests se ceded, but the function seems to be unable to write the result in the plc. Some ads errors happens, but they are so generic and not tipical.
In the new version I enhanced the error log. Could you please wipe the logfile and trigger one request?
Could you also test the ads functionality with another tool of mine: twicatadstool?
Please execute it from inside the plc and try to observe some variables.
Best regards,
FB
from beckhoffhttpclient.
Sounds good, I'll provide an update as soon as possible. Thanks!
from beckhoffhttpclient.
[17.09. 15:59:38.439] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[17.09. 15:59:38.509] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[17.09. 15:59:38.509] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[17.09. 15:59:38.510] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[17.09. 15:59:38.512] ERROR - Program+<OnExecute>d__33.MoveNext - Stack Trace:
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[17.09. 16:03:24.161] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[17.09. 16:03:24.240] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[17.09. 16:03:24.240] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[17.09. 16:03:24.241] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[17.09. 16:03:24.242] ERROR - Program+<OnExecute>d__33.MoveNext - Stack Trace:
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[17.09. 16:06:44.345] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[17.09. 16:06:44.416] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[17.09. 16:06:44.416] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[17.09. 16:06:44.417] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[17.09. 16:06:44.418] ERROR - Program+<OnExecute>d__33.MoveNext - Stack Trace:
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[17.09. 16:10:57.662] DEBUG - Program.GetOrCreateHeader - Reading header file (header.json)...
[17.09. 16:10:57.730] DEBUG - Program+<OnExecute>d__33.MoveNext - Starting API Call
[17.09. 16:10:57.730] DEBUG - Program+<OnExecute>d__33.MoveNext - Connecting to Beckhoff Port: 851 - AdsNet: ''
[17.09. 16:10:57.730] ERROR - Program+<OnExecute>d__33.MoveNext - Error while calling API: System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
System.ArgumentException: NetId is Null or Empty
Parameter name: str
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
[17.09. 16:10:57.732] ERROR - Program+<OnExecute>d__33.MoveNext - Stack Trace:
at TwinCAT.Ads.AmsNetId.TryParse(String str, AmsNetId& netId)
at TwinCAT.Ads.AmsNetId.Parse(String str)
at TFU001.Program.<OnExecute>d__33.MoveNext()
from beckhoffhttpclient.
Hello! Above is the generated logs from today, not too sure what the str
parameter in this case is. As for TwincatAdsTool
I was able to get the tree strcture of the program's data, but can not read the actual values. see attached photos.
The generated Json file is empty, I can click on variables in the tree view but no values show up on the right side.
Thanks,
KK
from beckhoffhttpclient.
Hi!
I saw another bug related to the connection, that changed in the new version.
Sorry, but I didn't have the chance to test it in my own before. I'll fix it today.
Can you then please post the log of another try?
Thanks.
FB
from beckhoffhttpclient.
Hi!
A new version is ready. Please give another try.
Thanks.
FB
from beckhoffhttpclient.
Hello FB,
The logs are shown below, the ResponseCode is now 200 after making the call and not a constant 0 so I believe this fixed the issue!
I'll map the data to DUT and test things out but it seems like it should be good to go!
Thanks for all your help and patience in this process.
Cheers,
KK
from beckhoffhttpclient.
Thanks again!
from beckhoffhttpclient.
Related Issues (15)
- Installation TFU001 on Windows CE HOT 5
- I don't get any response HOT 4
- POST application/octet-stream [Binary image data]... HOT 9
- body not valid for post request HOT 2
- No response, response and responseCode does not show change after sample program is executed HOT 4
- POST with JSON string not working HOT 2
- Use with c++ modules
- Functionality question HOT 1
- String variable 'in' too short for the VAR_IN_OUT parameter HOT 3
- Hide Console window HOT 1
- Json Array Isn't Serialized correctly or written to any array in the PLC HOT 10
- Use this Library for make notification (Pushover.net) HOT 5
- Running on a local machine HOT 3
- Cannot run: ErrorId 1799 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from beckhoffhttpclient.