Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Applications/ConsoleReferenceClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ public static async Task Main(string[] args)
// override logfile
if (logFile != null)
{
#pragma warning disable CS0618 // Type or member is obsolete
string logFilePath = config.TraceConfiguration.OutputFilePath;
string filename = Path.GetFileNameWithoutExtension(logFilePath);
config.TraceConfiguration.OutputFilePath = logFilePath.Replace(
Expand All @@ -333,7 +334,6 @@ public static async Task Main(string[] args)
StringComparison.Ordinal
);
config.TraceConfiguration.DeleteOnLoad = true;
#pragma warning disable CS0618 // Type or member is obsolete
config.TraceConfiguration.ApplySettings();
#pragma warning restore CS0618 // Type or member is obsolete
}
Expand Down
4 changes: 4 additions & 0 deletions Applications/ConsoleReferenceServer/ConsoleUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,9 @@ public void ConfigureLogging(
LogLevel fileLevel = LogLevel.Information;

// switch for Trace/Verbose output
#pragma warning disable CS0618 // Type or member is obsolete
int traceMasks = configuration.TraceConfiguration.TraceMasks;
#pragma warning restore CS0618 // Type or member is obsolete
if ((traceMasks &
~(
Utils.TraceMasks.Information |
Expand All @@ -165,7 +167,9 @@ public void ConfigureLogging(
// add file logging if configured
if (logFile)
{
#pragma warning disable CS0618 // Type or member is obsolete
string outputFilePath = configuration.TraceConfiguration.OutputFilePath;
#pragma warning restore CS0618 // Type or member is obsolete
if (!string.IsNullOrWhiteSpace(outputFilePath))
{
loggerConfiguration.WriteTo.File(
Expand Down
2 changes: 2 additions & 0 deletions Applications/ConsoleReferenceServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,15 @@ public static async Task<int> Main(string[] args)
if (shadowConfig)
{
Console.WriteLine("Using shadow configuration.");
#pragma warning disable CS0618 // Type or member is obsolete
string shadowPath = Directory
.GetParent(
Path.GetDirectoryName(
Utils.ReplaceSpecialFolderNames(server.Configuration.TraceConfiguration.OutputFilePath)
)
)
.FullName;
#pragma warning restore CS0618 // Type or member is obsolete
string shadowFilePath = Path.Combine(
shadowPath,
Path.GetFileName(server.Configuration.SourceFilePath)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1081,21 +1081,27 @@ public IApplicationConfigurationBuilderClientOptions SetClientOperationLimits(
public IApplicationConfigurationBuilderTraceConfiguration SetOutputFilePath(
string outputFilePath)
{
#pragma warning disable CS0618 // Type or member is obsolete
ApplicationConfiguration.TraceConfiguration.OutputFilePath = outputFilePath;
#pragma warning restore CS0618 // Type or member is obsolete
return this;
}

/// <inheritdoc/>
public IApplicationConfigurationBuilderTraceConfiguration SetDeleteOnLoad(bool deleteOnLoad)
{
#pragma warning disable CS0618 // Type or member is obsolete
ApplicationConfiguration.TraceConfiguration.DeleteOnLoad = deleteOnLoad;
#pragma warning restore CS0618 // Type or member is obsolete
return this;
}

/// <inheritdoc/>
public IApplicationConfigurationBuilderTraceConfiguration SetTraceMasks(int traceMasks)
{
#pragma warning disable CS0618 // Type or member is obsolete
ApplicationConfiguration.TraceConfiguration.TraceMasks = traceMasks;
#pragma warning restore CS0618 // Type or member is obsolete
return this;
}

Expand Down
2 changes: 2 additions & 0 deletions Libraries/Opc.Ua.Configuration/ApplicationInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ public IApplicationConfigurationBuilderTypes Build(string applicationUri, string
ApplicationType = ApplicationType,
ApplicationUri = applicationUri,
ProductUri = productUri,
#pragma warning disable CS0618 // Type or member is obsolete
TraceConfiguration = new TraceConfiguration { TraceMasks = Utils.TraceMasks.None },
#pragma warning restore CS0618 // Type or member is obsolete
TransportQuotas = new TransportQuotas()
};

Expand Down
3 changes: 1 addition & 2 deletions Libraries/Opc.Ua.Server/Server/StandardServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2884,10 +2884,9 @@ await Configuration.CertificateValidator.UpdateAsync(
ct: cancellationToken).ConfigureAwait(false);

// update trace configuration.
#pragma warning disable CS0618 // Type or member is obsolete
Configuration.TraceConfiguration = configuration.TraceConfiguration ??
new TraceConfiguration();

#pragma warning disable CS0618 // Type or member is obsolete
Configuration.TraceConfiguration.ApplySettings();
#pragma warning restore CS0618 // Type or member is obsolete
}
Expand Down
3 changes: 3 additions & 0 deletions Stack/Opc.Ua.Core/Schema/ApplicationConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ public ApplicationConfiguration(ApplicationConfiguration template)
DisableHiResClock = template.DisableHiResClock;
CertificateValidator = template.CertificateValidator;
TransportQuotas = template.TransportQuotas;
#pragma warning disable CS0618 // Type or member is obsolete
TraceConfiguration = template.TraceConfiguration;
#pragma warning restore CS0618 // Type or member is obsolete
m_extensions = template.m_extensions;
m_extensionObjects = template.m_extensionObjects;
SourceFilePath = template.SourceFilePath;
Expand Down Expand Up @@ -240,6 +242,7 @@ public XmlElementCollection Extensions
/// </summary>
/// <value>The trace configuration.</value>
[DataMember(IsRequired = false, EmitDefaultValue = false, Order = 11)]
[Obsolete("Use ITelemetryContext and ILogger-based diagnostics instead.")]
Comment thread
marcschier marked this conversation as resolved.
Resolved
public TraceConfiguration TraceConfiguration { get; set; }

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,12 @@ public static async Task<ApplicationConfiguration> LoadAsync(
if (configuration != null)
{
// should not be here but need to preserve old behavior.
#pragma warning disable CS0618 // Type or member is obsolete
if (applyTraceSettings && configuration.TraceConfiguration != null)
{
#pragma warning disable CS0618 // Type or member is obsolete
configuration.TraceConfiguration.ApplySettings();
#pragma warning restore CS0618 // Type or member is obsolete
}
#pragma warning restore CS0618 // Type or member is obsolete

configuration.SecurityConfiguration.CertificatePasswordProvider
= certificatePasswordProvider;
Expand Down
Comment thread
marcschier marked this conversation as resolved.
Resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/* ========================================================================
* Copyright (c) 2005-2025 The OPC Foundation, Inc. All rights reserved.
*
* OPC Foundation MIT License 1.00
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
* The complete license agreement can be found here:
* http://opcfoundation.org/License/MIT/1.00/
* ======================================================================*/

using System;
using System.Reflection;
using NUnit.Framework;

namespace Opc.Ua.Core.Tests.Stack.Schema
{
/// <summary>
/// Tests for obsolete application configuration schema members.
/// </summary>
[TestFixture]
[Category("ApplicationConfiguration")]
[SetCulture("en-us")]
[SetUICulture("en-us")]
[Parallelizable]
public class ApplicationConfigurationObsoleteTests
{
[Test]
public void TraceConfigurationPropertyIsObsolete()
{
PropertyInfo traceConfigurationProperty = typeof(ApplicationConfiguration)
.GetProperty("TraceConfiguration");

Assert.That(traceConfigurationProperty, Is.Not.Null);

ObsoleteAttribute obsoleteAttribute =
traceConfigurationProperty.GetCustomAttribute<ObsoleteAttribute>();

Assert.That(obsoleteAttribute, Is.Not.Null);
Assert.That(
obsoleteAttribute.Message,
Is.EqualTo("Use ITelemetryContext and ILogger-based diagnostics instead."));
}
}
}
2 changes: 2 additions & 0 deletions Tests/Opc.Ua.Gds.Tests/GlobalDiscoveryTestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,10 @@ public async Task DisconnectClientAsync()

public string ReadLogFile()
Comment thread
marcschier marked this conversation as resolved.
Resolved
{
#pragma warning disable CS0618 // Type or member is obsolete
return File.ReadAllText(
Utils.ReplaceSpecialFolderNames(Configuration.TraceConfiguration.OutputFilePath));
#pragma warning restore CS0618 // Type or member is obsolete
}

private async Task ApplyNewApplicationInstanceCertificateAsync(
Expand Down
2 changes: 2 additions & 0 deletions Tests/Opc.Ua.Gds.Tests/ServerConfigurationPushTestClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,10 @@ public async Task DisconnectClientAsync()

public string ReadLogFile()
Comment thread
marcschier marked this conversation as resolved.
Resolved
{
#pragma warning disable CS0618 // Type or member is obsolete
return File.ReadAllText(
Utils.ReplaceSpecialFolderNames(Config.TraceConfiguration.OutputFilePath));
#pragma warning restore CS0618 // Type or member is obsolete
}

private void CertificateValidator_CertificateValidation(
Expand Down
Loading