I have a Blazor server side app where my screen freezed on executing a specific code. As I inspected on the Browser side I found the Error: WebSocket closed with status code: 1006 (no reason given). (Both on Chrome and Firefox)
This error I am getting the first time, after I executed following code on the related razor cs page: The client calls the method "ReadVariables" on button click. If the method is called first time after opening the page (once=true), the function AGL4.NCK_Symbolic_LoadGUD is executed, afterwards the function "AGL4.NCK_Symbolic_GetNCKDataRWByBTSSItem". In this case the method gives its outputs correctly,everything fine.
But if the same method is called the second time, the AGL4.NCK_Symbolic_LoadGUD is not executed, just the AGL4.NCK_Symbolic_GetNCKDataRWByBTSSItem. As you see I pass the output root_handle from the first function over the variable root_handle_2 to the second function. Exactly on executing the line abc: (last line) the screen is freezing.
I don't know if the error is related to this point, but the worst thing is I cannot find the root cause.
public AGL4.NckNodeHandle root_handle_2 ;
public bool once = true;
public void ReadVariables(int p_conn_nr)
{
int res = AGL4.AGL40_SUCCESS;
if (once == true)
{
AGL4.NckNodeHandle root_handle = new AGL4.NckNodeHandle();
res = AGL4.NCK_Symbolic_LoadGUD(p_conn_nr, ref root_handle);
root_handle_2 = root_handle;
once = false;
}
int variables_count = TagService.GUD_VAR_names.Count;
//prepare list of variables to read
AGL4.NckDataRW[] data_rws = new AGL4.NckDataRW[variables_count];
using (StreamWriter sw = File.AppendText(error_path))
for (int i = 0; i < variables_count; ++i)
{
data_rws[i] = new AGL4.NckDataRW();
string variable = TagService.GUD_VAR_names[i];
int error_position = 0;
abc: res = AGL4.NCK_Symbolic_GetNCKDataRWByBTSSItem(root_handle_2, variable, ref data_rws[i], ref error_position); // when once=false (at the second execution of the method) exactly at this point the screen is freezing and I get this error. I get no error on code side.
}
}