Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Forums
  3. C # Client Error Get GetAssociationView

C # client error get GetAssociationView

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By Ingvar , 31 May, 2020
Forums
Gurux.DLMS

I trying to interrogate a C # device by a client. I setted startup parameters - COM port, password.
Immediately after starting, after several requests, an error falls out. Judging by the code, this happens when execute method GetAssociation. Gurux Server-simulator is read normally (port 4061).
At the same time, I am interrogating the same device with a C ++ client - reading is done there normally. What can be wrong?
Log C#:
TX: 10:23:46 7E A0 07 03 03 93 8C 11 7E
RX: 10:23:46 7E A0 20 03 03 73 F0 2E 81 80 14 05 02 00 80 06 02 00 80 07 04 00 00 00 01 08 04 00 00 00 01 CE 6A 7E
TX: 10:23:46 7E A0 44 03 03 10 65 94 E6 E6 00 60 36 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 0A 80 08 33 33 33 33 33 33 33 33 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 0F 0E FF FF 3E 1A 7E
RX: 10:23:46 7E A0 37 03 03 30 EF CA E6 E7 00 61 29 A1 09 06 07 60 85 74 05 08 01 01 A2 03 02 01 00 A3 05 A1 03 02 01 00 BE 10 04 0E 08 00 06 5F 1F 04 00 00 08 0E 00 AC 00 07 BE 8D 7E
TX: 10:23:48 7E A0 19 03 03 32 EC C8 E6 E6 00 C0 01 C1 00 0F 00 00 28 00 00 FF 02 00 91 53 7E
RX: 10:23:48 7E A0 23 03 03 52 B6 3B E6 E7 00 2E 15 30 0E 00 00 00 1C D9 AD 77 A0 47 4E 85 4C 85 84 86 DD C1 34 5E C4 EB 7E
TX: 10:23:48 7E A0 07 03 03 53 80 D7 7E
RX: 10:23:48 7E A0 07 03 03 73 82 F6 7E
Erroon in Widnow:
Standard: DLMS
Invalid Command.
System.ArgumentException: Invalid Command.
в Gurux.DLMS.Reader.GXDLMSReader.ReadDLMSPacket(Byte[] data, GXReplyData reply) в d:\Project\MS4\MainProjects\Gurux.DLMS.Net-master\Gurux.DLMS.Client.Example.Net\GXDLMSReader.cs:line 1036
в Gurux.DLMS.Reader.GXDLMSReader.ReadDataBlock(Byte[] data, GXReplyData reply) в d:\Project\MainProjects\Gurux.DLMS.Net-master\Gurux.DLMS.Client.Example.Net\GXDLMSReader.cs:line 1083
в Gurux.DLMS.Reader.GXDLMSReader.GetAssociationView(String outputFile) в d:\Project\MainProjects\Gurux.DLMS.Net-master\Gurux.DLMS.Client.Example.Net\GXDLMSReader.cs:line 597
в Gurux.DLMS.Reader.GXDLMSReader.ReadAll(String outputFile) в d:\Project\MainProjects\Gurux.DLMS.Net-master\Gurux.DLMS.Client.Example.Net\GXDLMSReader.cs:line 94
в Gurux.DLMS.Client.Example.Program.Main(String[] args) в d:\Project\MainProjects\Gurux.DLMS.Net-master\Gurux.DLMS.Client.Example.Net\Program.cs:line 138

Profile picture for user Kurumi

Kurumi

6 years ago

Hi Ingvar,

Hi Ingvar,

I'm sorry. We have broken this on the last released version. Get the latest version.

BR,

Mikko

Ingvar

6 years ago

It's works now.

It's works now.
There is still a problem. For some reason, Description is not formed - Invalid is displayed. If I understand in code correctly, OBIS is not loading from the OBISCodes.txt file
What can be wrong?
I start with empty -d parameters (DLMS mode)

Profile picture for user Kurumi

Kurumi

6 years ago

Hi,

Hi,

What OBIS code is causing problems? You must define correct sub standard. Ex:
-d India

BR,
Mikko

Ingvar

6 years ago

Considered Association,

Considered Association, Scales, Units. I want to save this in xml so that later it will be easier to debug the display of the read variables.
I call the method:
MyGXDLMSObjectCollectiond.Save ("output.txt", null);
The file is saved.
Then I try to download it:
GXDLMSObjectCollection LoadCollection = GXDLMSObjectCollection.Load ("output.txt");
An error appears while reading.
What can be wrong?
File:
https://drive.google.com/file/d/178N4NJUxfBBcfbKNyUt22q-dC4aqIcEI/view?…

Profile picture for user Kurumi

Kurumi

6 years ago

Hi Ingvar,

Hi Ingvar,

Please, don't paste images. They are compressed and on your PC it looks good, but I can't read it or you if you try in different PC.

I can't access this link. You haven't given access rights to it.

BR,
Mikko

Ingvar

6 years ago

Sorry - I did not check.

Sorry - I did not check.
Image removed. Corrected the link.
https://drive.google.com/file/d/178N4NJUxfBBcfbKNyUt22q-dC4aqIcEI/view?…

Profile picture for user Kurumi

Kurumi

6 years ago

Hi,

Hi,

Can you try to run this with client example? Add -o parameter and check is description correct.
Where should be no any reason why the description is not set.

BR,
Mikko

Ingvar

6 years ago

I d'not understand. What

I d'not understand. What should I see as a result in the client?
I will explain. My task is to get GXDLMSObjectCollection using the load from the generated file (so that you do not have to read data from the device each time, when debugging a GUI my application). It can be done? Calling the Load method as I pointed out leads to an error.

Profile picture for user Kurumi

Kurumi

5 years 12 months ago

Hi Ingvar,

Hi Ingvar,

I tested this with client example and descriptions are correct, not invalid. Are you sure that Something is not changed in the source code?

Are you using Gurux.DLMS.dll from nuget.org? Try with that. Is the result the same?

BR,
Mikko

Ingvar

5 years 12 months ago

Did so:

Did so:
1. I getted the latest source .Net client from GitHub
2. Compiled. I put output1.txt (rename file) in the Debug folder.
3. In Program.cs added line 56:
GXDLMSObjectCollection res12 = GXDLMSObjectCollection.Load ("output1.txt");
I launched the application - it crashed.
Am I doing the right thing? Can I load GXDLMSObjectCollection from a file like this?
Attached the file Program.cs
https://drive.google.com/file/d/1sxqCudb2QyuDKnZDcRJ8oGteWkPkzXsV/view?…

Profile picture for user Kurumi

Kurumi

5 years 12 months ago

Hi,

Hi,

Now I know the reason. All objects are sterilized as GXDLMSData, but your objects are registers, etc.

You need to save this file using GXDLMSObjectCollection.save method.
Then you can use GXDLMSObjectCollection.load to load it.

Collect data from the meter and then save it with GXDLMSObjectCollection.save.

BR,
Mikko

Ingvar

5 years 12 months ago

I do so.

That's exactly what I do.
GXDLMSObjectCollection res = reader.GetAssociation (StopToken);
res.Save ("output1.txt", null);

GetAssociation code:
public GXDLMSObjectCollection GetAssociation (System.Threading.CancellationTokenSource Token)
{
try
{
InitializeConnection ();
if (GetAssociationView (Token))
{
GetScalersAndUnits (Token);
GetProfileGenericColumns (Token);
}
}
finally
{
Close ();
}
return Client.Objects;
}

Profile picture for user Kurumi

Kurumi

5 years 12 months ago

Hi,

Hi,

Is this a real meter or simulator? OBIS codes and object types don't match.
Can you read your meter with client example and save trace to the google.

I can check the reason on Monday.

BR,
Mikko

Ingvar

5 years 12 months ago

This is a real device -

This is a real device - chinese aMeter100.
By link logs in verbose mode.
https://drive.google.com/file/d/1d82XXpID7daoVQqKChGXpb_cPGXVOfsM/view?…
If you want, I can give access through the TCP tunnel using AnyDesk.

Profile picture for user Kurumi

Kurumi

5 years 12 months ago

Hi,

Hi,

XML serializer fails with meter's null data. This is now fixed. Get the latest version.
https://www.gurux.fi/node/16091

BR,
Mikko

Ingvar

5 years 12 months ago

I downloaded and updated the

I downloaded and updated the Development folder. Rebilded. I re-read the entire file again from device. Wrote a line:
GXDLMSObjectCollection res12 = GXDLMSObjectCollection.Load ("output.txt");
The application has crashed. Read file and screenshot in application
https://drive.google.com/file/d/1j1CaTs0idpR4gecPdQ6TiLduv9-nAcbK/view?…

Profile picture for user Kurumi

Kurumi

5 years 11 months ago

Hi,

Hi,

This is improved. Get the latest version.

BR,
Mikko

Ingvar

5 years 11 months ago

Now everything is fine. One

Now everything is fine. One more question.
After I read the counter variables and received the GXDLMSObjectCollection, I need to perform a specific sorting of the elements.
So far, I've changed the protected List <GXDLMSObject> Items to public List <GXDLMSObject> Items in the GXDLMSObjectCollections.cs file and did CompareTo for GXDLMSObject. This works, but I would not want to change the standard code.
Maybe there is a better solution?

Profile picture for user Kurumi

Kurumi

5 years 11 months ago

Hi,

Hi,

GXDLMSObjectCollections is derived from IList. You can do it like this:

List<GXDLMSObject> tmp = client.Objects.ToList();
tmp.Sort();

BR,

Mikko

Ingvar

5 years 10 months ago

Found another error. Added a

Found another error. Added a line like this:
Client.Objects.Save (@ "c: \ 1 \ 1.xml", null);
Into the ReadAll method (screenshot below).
The startup line of such a client is as follows:
-h 127.0.0.1 -p 4061 -a HighGmac -C AuthenticationEncryption -t Verbose
The server is your Gurux.
If there is no output.txt file, then an error occurs on the ip4Setup object due to the fact that the IP address is Null
Screenshots
https://drive.google.com/uc?export=download&id=1LOTNj1ti6ZTfm8-R1lvDIYy…
https://drive.google.com/uc?export=download&id=1GLGZbZrZ6tF-pM_qdoqd5Td…

Profile picture for user Kurumi

Kurumi

5 years 10 months ago

Hi,

Hi,

I can't access your Goole account. Is this GXDLMSIp4Setup or GXDLMSIp6Setup?

BR,
Mikko

Ingvar

5 years 10 months ago

damn google...I am sorry.

damn google...I am sorry.
https://drive.google.com/uc?export=download&id=1LOTNj1ti6ZTfm8-R1lvDIYy…
https://drive.google.com/uc?export=download&id=1GLGZbZrZ6tF-pM_qdoqd5Td…
GXDLMSIp4Setup

Profile picture for user Kurumi

Kurumi

5 years 10 months ago

Hi,

Hi,

No worries. This is fixed and new version is released on next week.

BR,
Mikko

Ingvar

5 years 9 months ago

You have uploaded the fixed

You have uploaded the fixed version to GitHub?

Profile picture for user Kurumi

Kurumi

5 years 9 months ago

Hi,

Hi,

It's now updated.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin