Beckhoff / TF6000_ADS_DOTNET_V5_Samples

Sample code for the Version 6.X series of the TwinCAT ADS .NET Packages
https://infosys.beckhoff.com/content/1033/tc3_ads.net/9407515403.html?id=6770980177009971601
BSD Zero Clause License
37 stars 15 forks source link

symbolFactory.ClearTypes() does not clear the types #26

Closed drvic10k closed 2 years ago

drvic10k commented 2 years ago

as far as I understood from debugging the code, the problem seems to be in NamespaceCollection<T> There you have private Dictionary<string, T> allTypes = new Dictionary<string, T>((IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase);

and in NamespaceCollection you add to InnerAllTypes, which points to this private field

but symbolFactory.ClearTypes() calls ICollection<INamespace<IDataType>>.Clear() and leaves this private field in the original state, so although the interfaces are cleared, the types are not

RalfHeitmann commented 2 years ago

Good point. This will be fixed in Beckhoff.TwinCAT.Ads > 6.0.178 (future release)