Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
5 changes: 5 additions & 0 deletions Samples/Client.Net4/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ static void Main()
{
ExceptionDlg.Show(m_telemetry, application.ApplicationName, e);
}
finally
{
// ApplicationInstance is only IAsyncDisposable, and Main is synchronous
application.DisposeAsync().AsTask().GetAwaiter().GetResult();
}
}
}
}
4 changes: 2 additions & 2 deletions Samples/Client.Net4/UA Sample Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions">
<Version>10.0.10</Version>
<Version>10.0.11</Version>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Console">
<Version>10.0.10</Version>
<Version>10.0.11</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Bindings.Https">
<Version>2.0.0-preview.2</Version>
Expand Down
8 changes: 4 additions & 4 deletions Samples/ClientControls.Net4/ClientUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,15 @@ public static async Task<string> GetAttributeDisplayTextAsync(ISession session,
/// <returns>
/// The references found. Null if an error occurred.
/// </returns>
public static Task<List<ReferenceDescription>> BrowseAsync(ISession session, List<BrowseDescription> nodesToBrowse, bool throwOnError, CancellationToken ct = default)
public static Task<List<ReferenceDescription>> BrowseAsync(ISession session, IReadOnlyList<BrowseDescription> nodesToBrowse, bool throwOnError, CancellationToken ct = default)
{
return BrowseAsync(session, null, nodesToBrowse, throwOnError, ct);
}

/// <summary>
/// Browses the address space and returns the references found.
/// </summary>
public static async Task<List<ReferenceDescription>> BrowseAsync(ISession session, ViewDescription view, List<BrowseDescription> nodesToBrowse, bool throwOnError, CancellationToken ct = default)
public static async Task<List<ReferenceDescription>> BrowseAsync(ISession session, ViewDescription view, IReadOnlyList<BrowseDescription> nodesToBrowse, bool throwOnError, CancellationToken ct = default)
{
try
{
Expand All @@ -338,7 +338,7 @@ public static async Task<List<ReferenceDescription>> BrowseAsync(ISession sessio
null,
view,
0,
nodesToBrowse,
nodesToBrowse.ToArrayOf(),
ct);

var results = response.Results.ToList();
Expand Down Expand Up @@ -1075,7 +1075,7 @@ private static async Task UpdateInstanceDescriptionsAsync(ISession session, List

if (!(instance.DataType).IsNull)
{
instance.BuiltInType = TypeInfo.GetBuiltInType(instance.DataType, session.TypeTree);
instance.BuiltInType = await TypeInfo.GetBuiltInTypeAsync(instance.DataType, session.TypeTree, ct);
instance.DataTypeDisplayText = await session.NodeCache.GetDisplayTextAsync(instance.DataType, ct);

if (instance.ValueRank >= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private async Task SetValueAsync(Variant value, CancellationToken ct = default)
XmlEncoder encoder = new XmlEncoder(new XmlQualifiedName("Value", Namespaces.OpcUaXsd), writer, m_session.MessageContext);
#pragma warning restore CA2000
Variant valueToEncode = m_value;
encoder.WriteVariant("Value", ref valueToEncode);
encoder.WriteVariant("Value", in valueToEncode);
writer.Close();

ValueTB.Text = buffer.ToString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public void DisplayEvent(EventFieldList e)
/// <summary>
/// Sets the filter to edit.
/// </summary>
public void DisplayEvent(List<Variant> fields)
public void DisplayEvent(IList<Variant> fields)
{
if (m_filter != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ public void GetBrowsePathFromNodeState(
NodeId rootId,
NodeState parent,
RelativePath parentPath,
List<BrowsePath> browsePaths)
IList<BrowsePath> browsePaths)
{
List<BaseInstanceState> children = new List<BaseInstanceState>();
parent.GetChildren(context, children);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public void GetBrowsePathFromNodeState(
NodeId rootId,
NodeState parent,
RelativePath parentPath,
List<BrowsePath> browsePaths)
IList<BrowsePath> browsePaths)
{
List<BaseInstanceState> children = new List<BaseInstanceState>();
parent.GetChildren(context, children);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ private async Task UpdateFilterAsync(CancellationToken ct = default)
m_filter.Fields = fields;
}

private void AddDefaultFilter(List<FilterDeclarationField> fields, string browsePath, bool displayInList)
private void AddDefaultFilter(IList<FilterDeclarationField> fields, string browsePath, bool displayInList)
{
FilterDeclarationField field = new FilterDeclarationField();
field.InstanceDeclaration = new InstanceDeclaration();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public ViewEventDetailsDlg()
/// <summary>
/// Shows all fields for the current condition.
/// </summary>
public bool ShowDialog(FilterDeclaration filter, List<Variant> fields)
public bool ShowDialog(FilterDeclaration filter, IList<Variant> fields)
{
// fill in dialog.
for (int ii = 0; ii < filter.Fields.Count; ii++)
Expand Down
2 changes: 1 addition & 1 deletion Samples/ClientControls.Net4/Common/EventListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ public async Task ConditionRefreshAsync(CancellationToken ct = default)
/// <summary>
/// Returns the currently selected event at the specified index (null index is not valid).
/// </summary>
public List<Variant> GetSelectedEvent(int index)
public IList<Variant> GetSelectedEvent(int index)
{
if (EventsLV.SelectedItems.Count > index)
{
Expand Down
20 changes: 8 additions & 12 deletions Samples/ClientControls.Net4/Common/FilterDeclaration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,8 @@ public class TypeDeclaration
/// <summary>
/// The fully inhierited list of instance declarations for the type.
/// </summary>
#pragma warning disable CA1002 // Justification: sample public API shape is preserved by design.
#pragma warning disable CA1051 // Justification: sample public API shape is preserved by design.
public List<InstanceDeclaration> Declarations;
#pragma warning restore CA1002
public IList<InstanceDeclaration> Declarations;
#pragma warning restore CA1051
}

Expand All @@ -73,7 +71,7 @@ public class InstanceDeclaration
/// The browse path to the instance declaration.
/// </summary>
#pragma warning disable CA1051 // Justification: sample public API shape is preserved by design.
public List<QualifiedName> BrowsePath;
public IList<QualifiedName> BrowsePath;
#pragma warning restore CA1051

/// <summary>
Expand Down Expand Up @@ -339,7 +337,7 @@ public FilterDeclaration(FilterDeclaration declaration)
public EventFilter GetFilter()
{
EventFilter filter = new EventFilter();
filter.SelectClauses = GetSelectClause();
filter.SelectClauses = GetSelectClause().ToArrayOf();
filter.WhereClause = GetWhereClause();
return filter;
}
Expand Down Expand Up @@ -419,7 +417,7 @@ public void AddSimpleField(QualifiedName[] browseNames, NodeClass nodeClass, Bui
/// <summary>
/// Returns the select clause defined by the filter declaration.
/// </summary>
public List<SimpleAttributeOperand> GetSelectClause()
public IList<SimpleAttributeOperand> GetSelectClause()
{
List<SimpleAttributeOperand> selectClause = new List<SimpleAttributeOperand>();

Expand All @@ -435,7 +433,7 @@ public List<SimpleAttributeOperand> GetSelectClause()
operand = new SimpleAttributeOperand();
operand.TypeDefinitionId = field.InstanceDeclaration.RootTypeId;
operand.AttributeId = (field.InstanceDeclaration.NodeClass == NodeClass.Object) ? Attributes.NodeId : Attributes.Value;
operand.BrowsePath = field.InstanceDeclaration.BrowsePath;
operand.BrowsePath = field.InstanceDeclaration.BrowsePath.ToArrayOf();
selectClause.Add(operand);
}
}
Expand All @@ -460,7 +458,7 @@ public ContentFilter GetWhereClause()
SimpleAttributeOperand operand1 = new SimpleAttributeOperand();
operand1.TypeDefinitionId = field.InstanceDeclaration.RootTypeId;
operand1.AttributeId = (field.InstanceDeclaration.NodeClass == NodeClass.Object) ? Attributes.NodeId : Attributes.Value;
operand1.BrowsePath = field.InstanceDeclaration.BrowsePath;
operand1.BrowsePath = field.InstanceDeclaration.BrowsePath.ToArrayOf();

LiteralOperand operand2 = new LiteralOperand();
operand2.Value = field.FilterValue;
Expand All @@ -476,7 +474,7 @@ public ContentFilter GetWhereClause()
/// <summary>
/// Returns the value for the specified browse name.
/// </summary>
public T GetValue<T>(QualifiedName browseName, List<Variant> fields, T defaultValue)
public T GetValue<T>(QualifiedName browseName, IList<Variant> fields, T defaultValue)
{
if (fields == null || fields.Count == 0)
{
Expand Down Expand Up @@ -521,10 +519,8 @@ public T GetValue<T>(QualifiedName browseName, List<Variant> fields, T defaultVa
/// <summary>
/// The list of declarations for the fields.
/// </summary>
#pragma warning disable CA1002 // Justification: sample public API shape is preserved by design.
#pragma warning disable CA1051 // Justification: sample public API shape is preserved by design.
public List<FilterDeclarationField> Fields;
#pragma warning restore CA1002
public IList<FilterDeclarationField> Fields;
#pragma warning restore CA1051
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -624,10 +624,10 @@ private static byte[] ParseByteString(string text)

// Strip common separators and prefixes so both "0x0A, 0x0B" and "0A0B" work.
string cleaned = text
.Replace("0x", String.Empty)
.Replace("0X", String.Empty)
.Replace(",", String.Empty)
.Replace("-", String.Empty);
.Replace("0x", String.Empty, StringComparison.Ordinal)
.Replace("0X", String.Empty, StringComparison.Ordinal)
.Replace(",", String.Empty, StringComparison.Ordinal)
.Replace("-", String.Empty, StringComparison.Ordinal);

var hexOnly = new StringBuilder(cleaned.Length);

Expand Down
6 changes: 2 additions & 4 deletions Samples/ClientControls.Net4/Configuration/SelectUrlsCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,16 @@ public SelectUrlsCtrl()
#region Private Fields
private event EventHandler m_UrlsChanged;
private ITelemetryContext m_telemetry;
private List<Uri> m_urls;
private IList<Uri> m_urls;
#endregion

#region Public Interface
/// <summary>
/// The list of urls.
/// </summary>
[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Hidden)]
#pragma warning disable CA1002 // Justification: sample public API shape is preserved by design.
#pragma warning disable CA2227 // Justification: sample public API shape is preserved by design.
public List<Uri> Urls
#pragma warning restore CA1002
public IList<Uri> Urls
#pragma warning restore CA2227
{
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ private void BuildEndpointDescription()
#endregion

#region Public Interface
public List<EndpointDescription> AvailableEnpoints
public IList<EndpointDescription> AvailableEnpoints
{
get { return m_availableEndpoints; }
}
Expand Down
2 changes: 1 addition & 1 deletion Samples/ClientControls.Net4/UA Client Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Console">
<Version>10.0.10</Version>
<Version>10.0.11</Version>
</PackageReference>
<PackageReference Include="OPCFoundation.NetStandard.Opc.Ua.Core">
<Version>2.0.0-preview.2</Version>
Expand Down
5 changes: 3 additions & 2 deletions Samples/Controls.Net4/Common/ArgumentListCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ public async Task<bool> UpdateAsync(Session session, NodeId methodId, bool input
/// <summary>
/// Returns the argument values
/// </summary>
public List<Variant> GetValues()
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1024:Use properties where appropriate", Justification = "Each call reads the list view and builds a new list, and the matching setter is asynchronous.")]
public IList<Variant> GetValues()
{
List<Variant> values = new List<Variant>();

Expand All @@ -157,7 +158,7 @@ public List<Variant> GetValues()
/// <summary>
/// Updates the argument values.
/// </summary>
public async Task SetValuesAsync(List<Variant> values, CancellationToken ct = default)
public async Task SetValuesAsync(IList<Variant> values, CancellationToken ct = default)
{
int ii = 0;

Expand Down
4 changes: 2 additions & 2 deletions Samples/Controls.Net4/Common/CallMethodDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ private async void OkBTN_ClickAsync(object sender, EventArgs e)
{
try
{
List<Variant> inputArguments = InputArgumentsCTRL.GetValues();
IList<Variant> inputArguments = InputArgumentsCTRL.GetValues();

CallMethodRequest request = new CallMethodRequest();

request.ObjectId = m_objectId;
request.MethodId = m_methodId;
request.InputArguments = inputArguments;
request.InputArguments = inputArguments.ToArrayOf();

List<CallMethodRequest> requests = new List<CallMethodRequest>();
requests.Add(request);
Expand Down
12 changes: 5 additions & 7 deletions Samples/Controls.Net4/Common/DataValueListCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ public void Clear()
/// <summary>
/// Sets the nodes in the control.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1002:Do not expose generic lists", Justification = "Sample code preserves existing public API and behavior.")]
public async Task InitializeAsync(
Session session,
List<ReadValueId> valueIds,
List<DataValue> values,
List<ServiceResult> results,
IList<ReadValueId> valueIds,
IList<DataValue> values,
IList<ServiceResult> results,
CancellationToken ct = default)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Expand Down Expand Up @@ -139,11 +138,10 @@ public async Task InitializeAsync(
/// <summary>
/// Sets the nodes in the control.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1002:Do not expose generic lists", Justification = "Sample code preserves existing public API and behavior.")]
public async Task InitializeAsync(
Session session,
List<WriteValue> values,
List<ServiceResult> results,
IList<WriteValue> values,
IList<ServiceResult> results,
CancellationToken ct = default)
{
if (session == null) throw new ArgumentNullException(nameof(session));
Expand Down
2 changes: 1 addition & 1 deletion Samples/Controls.Net4/Common/FindNodeDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public FindNodeDlg()
/// <summary>
/// Displays the dialog.
/// </summary>
public List<NodeId> ShowDialog(Session session, NodeId startNodeId)
public IList<NodeId> ShowDialog(Session session, NodeId startNodeId)
{
m_session = session;

Expand Down
6 changes: 3 additions & 3 deletions Samples/Controls.Net4/Common/NodeListCtrl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public NodeListCtrl()

#region Private Fields
private Session m_session;
private List<NodeId> m_nodeIds;
private IList<NodeId> m_nodeIds;
private NodeClass m_nodeClassMask;

/// <summary>
Expand All @@ -80,7 +80,7 @@ public void Clear()
/// <summary>
/// Sets the nodes in the control.
/// </summary>
public async Task InitializeAsync(Session session, List<NodeId> nodeIds, NodeClass nodeClassMask, ITelemetryContext telemetry, CancellationToken ct = default)
public async Task InitializeAsync(Session session, IList<NodeId> nodeIds, NodeClass nodeClassMask, ITelemetryContext telemetry, CancellationToken ct = default)
{
if (session == null) throw new ArgumentNullException(nameof(session));

Expand Down Expand Up @@ -174,7 +174,7 @@ public async Task AddNodeIdAsync(ExpandedNodeId nodeId, CancellationToken ct = d
/// <summary>
/// Returns the node ids in the control.
/// </summary>
public List<NodeId> GetNodeIds()
public IList<NodeId> GetNodeIds()
{
List<NodeId> nodeIds = new List<NodeId>();

Expand Down
4 changes: 2 additions & 2 deletions Samples/Controls.Net4/Common/SelectNodesDlg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ public SelectNodesDlg()
/// <summary>
/// Displays the dialog.
/// </summary>
public async Task<List<NodeId>> ShowDialogAsync(
public async Task<IList<NodeId>> ShowDialogAsync(
Session session,
BrowseViewType browseView,
List<NodeId> nodesIds,
IList<NodeId> nodesIds,
NodeClass nodeClassMask,
ITelemetryContext telemetry,
CancellationToken ct = default)
Expand Down
Loading
Loading