Closed koepalex closed 8 months ago
Pushed fix.
Retested, is not working fully, -
isn't escaped
#region Namespace Declarations
/// <remarks />
[System.CodeDom.Compiler.GeneratedCodeAttribute("Opc.Ua.ModelCompiler", "1.0.0.0")]
public static partial class Namespaces
{
/// <summary>
/// The URI for the alexander-koepkedeopcuacompressor namespace (.NET code namespace is 'CompressorSimulationOpcUaServer').
/// </summary>
public const string alexander-koepkedeopcuacompressor = "http://alexander-koepke.de/opcua/compressor";
/// <summary>
/// The URI for the OpcUa namespace (.NET code namespace is 'Opc.Ua').
/// </summary>
public const string OpcUa = "http://opcfoundation.org/UA/";
}
#endregion
There is also an issue with quotes in NodeId attribute when it uses string id, they are not escaped and the generator doesn't create a valid code.
Repo Steps
http://alexander-koepke.de/opcua/compressor
dotnet build/bin/Release/net8.0/Opc.Ua.ModelCompiler.dll compile -version v105 -id 42000 -d2 "MyCompressorType.NodeSet2.xml,CompressorSimulationOpcUaServer" -o2 "../shared/generated/compressor"
Observation
Generated source code for the namespace properties is invalid and therefor all references to it:
Expectation
Characters that are valid in URIs but not in C# code should be escaped, like:
Workaround
Manually editing the generated source code, to update the name of the namespace properties and all references to it.