eeschema: netclasses get lost at copying between different instances

Description

If copying portions of a schematic-sheet into a schematic-sheet from a different project (copying between different eeschema-instances) the assigned netclasses are not preserved.

All pasted nets (in the receiving schematic) get the netclass default. This is not dependend if there is already a netclass (with correct netclass-name) name defined in the receiving schematic-project.

As the copy-past-mechanic seems to be based entirely on readable ASCII-text I have pasted some schematic-parts into an text-editor and there is no mention of netclasses anywhere. So it seems the copy-past-mechanism currently doesn't support the netclass-feature at all?

Steps to reproduce

  1. start kicad, open attached project netclass_source_project, open schematic
  2. click the nets in the first column, observe: all have a netclass assigned
  3. select the resistors + nets from the first column, copy (CTRL+C)
  4. start another kicad-instance (parallel running), open attached project netclass_destination_project_empty
  5. look into schematic setup->project->net classes: observe: two netclasses are predefined
  6. close schematic setup-dialog
  7. paste the schematic-portion from step 3)
  8. observe: all pasted nets have the netclass set to default

netclass.zip

KiCad Version

Application: KiCad Schematic Editor (64-bit)

Version: (6.0.0-rc1-120-ge56e61ffb5), release build

Libraries:
	wxWidgets 3.1.5

Platform: Windows 10 (build 19042), 64-bit edition, 64 bit, Little endian, wxMSW

	wxWidgets: 3.1.5 (wchar_t,wx containers)
	Boost: 1.76.0
	OCC: 7.5.0
	Curl: 7.78.0-DEV
	ngspice: 35
	Compiler: Visual C++ 1929 without C++ ABI

Build settings:
	KICAD_USE_OCC=ON
	KICAD_SPICE=ON