Skip to content

Commit e1ba802

Browse files
committed
Merge branch 'develop'
2 parents 2338e8a + efbb235 commit e1ba802

9 files changed

Lines changed: 364 additions & 224 deletions

File tree

ASCOM.Utilities/ASCOM.Utilities/Log.cs

Lines changed: 99 additions & 63 deletions
Large diffs are not rendered by default.

ASCOM.Utilities/ASCOM.Utilities/TraceLogger.cs

Lines changed: 171 additions & 153 deletions
Large diffs are not rendered by default.

Diagnostics/ASCOM Diagnostics/DiagnosticsForm.cs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ private Timer ASCOMTimer
220220

221221
#endregion
222222

223-
#region Initialisation, Form load and overall process
223+
#region Initialisation and form load
224224

225225
/// <summary>
226226
/// Diagnostics form initiator
@@ -290,11 +290,16 @@ private void DiagnosticsForm_Load(object sender, EventArgs e)
290290
}
291291
}
292292

293+
#endregion
294+
295+
#region Main Diagnostics test process
296+
293297
private void RunDiagnostics(object sender, EventArgs e)
294298
{
295299
string ASCOMPath;
296300
string ApplicationPath = "Path Not Set!";
297301
string SuccessMessage;
302+
DateTime startTime = DateTime.Now;
298303

299304
try
300305
{
@@ -445,8 +450,9 @@ private void RunDiagnostics(object sender, EventArgs e)
445450
// Log the enabled / disabled state of the traceLogger mutex mechanic
446451
try
447452
{
448-
TL.LogMessage("Environment", $"TraceLogger is {(Utilities.Global.GetBool(USE_TRACELOGGER_MUTEX, USE_TRACELOGGER_MUTEX_DEFAULT) ? "" : "not ")}using the Mutex mechanic");
453+
TL.LogMessage("Environment", $"TraceLogger is using the {(Utilities.Global.GetBool(USE_TRACELOGGER_MUTEX, USE_TRACELOGGER_MUTEX_DEFAULT) ? "Mutex" : "lock()")} mechanic");
449454
TL.LogMessage("Environment", $"TraceLogger debug is {(Utilities.Global.GetBool(TRACELOGGER_DEBUG, TRACELOGGER_DEBUG_DEFAULT) ? "enabled" : "disabled")}.");
455+
TL.LogMessage("Environment", $".NET component use logging is {(Utilities.Global.GetBool(DOTNET35_COMPONENT_USE_LOGGING, DOTNET35_COMPONENT_USE_LOGGING_DEFAULT) ? "enabled" : "disabled")}.");
450456
TL.LogMessage("", "");
451457
}
452458
catch (Exception ex)
@@ -455,6 +461,8 @@ private void RunDiagnostics(object sender, EventArgs e)
455461
}
456462

457463
LastLogFile = TL.LogFileName;
464+
465+
// Run diagnostic tests
458466
try
459467
{
460468
try
@@ -917,6 +925,8 @@ private void RunDiagnostics(object sender, EventArgs e)
917925
}
918926
transform = null;
919927

928+
TL.BlankLine();
929+
TL.LogMessage("Diagnostics", $"Time for diagnostics run: {DateTime.Now.Subtract(startTime):mm\\:ss\\.fff}");
920930
TL.BlankLine();
921931
TL.LogMessage("Diagnostics", SuccessMessage);
922932
TL.Enabled = false;

Help/ASCOMDeveloper.content

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Topics>
3-
<Topic id="7d9253c2-fdfd-4c0d-8225-a96bddb49731" visible="True" isDefault="true" title="ASCOM Platform 7.1 Update 2" tocTitle="Introduction" />
3+
<Topic id="7d9253c2-fdfd-4c0d-8225-a96bddb49731" visible="True" isDefault="true" isSelected="true" title="ASCOM Platform 7.1 Update 3" tocTitle="Introduction" />
44
<Topic id="6cdc126a-3b1a-4a55-836f-aaf704740a33" visible="True" title="Introduction - ASCOM Platform 7 For Developers" tocTitle="Introduction - Developers" />
55
<Topic id="174fff87-9bd7-442e-98e1-9fe2ac09bac6" visible="True" />
66
<Topic id="3d17234a-c873-4f65-af0f-52f182081a44" visible="True" title="ASCOM Platform for .NET Developers" />
77
<Topic id="bfd53b69-9f13-489b-9a98-50c60d2a633b" visible="True" isExpanded="true" title="Version History">
8-
<Topic id="Version_7.1.3" visible="True" isSelected="true" />
8+
<Topic id="Version_7.1.3" visible="True" />
99
<Topic id="Version_7.1.2" visible="True" />
1010
<Topic id="1d9c9d1e-1980-45a6-b7f9-4f4bcb752b80" visible="True" title="Version 7.1 Update 1" />
1111
<Topic id="1cff238c-4522-4730-ae94-a82f9666654e" visible="True" title="Version 7.1" />

Help/Version History/Version 7.1 Update 2.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ here <link xlink:href="7d9253c2-fdfd-4c0d-8225-a96bddb49731#PreReqs70">Platform
1616
* Alpaca Dynamic Driver log files are now named ASCOM.DynamicDriver... rather than ASCOM.AlpacaSim...
1717
* Update checker messages now refer to 'Updates' rather than 'Service Packs'.
1818

19-
2019
## Issues Fixed in 7.1 Update 2 - For Everyone
2120
* Fixed an issue, introduced in Platform 7.1, that caused drivers that use ASCOM COM objects to fail in some environments, including Windows ARM 64bit.
2221
The issue also caused the 64bit Platform installer validation test to report a -1073741819 error.

Help/Version History/Version 7.1 Update 3.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,31 @@ In line with previous Platform installers, Platform 7.1 Update 3 is a cumulative
1111
Platform releases and service packs. The Platform environment pre-requisites are listed
1212
here <link xlink:href="7d9253c2-fdfd-4c0d-8225-a96bddb49731#PreReqs70">Platform Prerequisites</link>.
1313

14+
## Changes in 7.1 Update 3 - For Everyone
15+
* Logging is now more reliable and slightly faster.
16+
* A new option has been added to the Diagnostics application (`Use TraceLogger mutex synchronisation`) so you can revert to previous
17+
logging behaviour if necessary.
18+
1419
## Issues Fixed in 7.1 Update 3 - For Everyone
15-
* Fixed - TraceLogger occasionally threw `ProfilePersistenceException - Timed out waiting for TraceLogger mutex` exceptions.
20+
* Fixed - Widely reported issues where TraceLogger returned `ProfilePersistenceException - Timed out waiting for TraceLogger mutex` exceptions
21+
causing many clients and drivers to fail. This issue first appeared in Platform 7.1 Update 2.
22+
23+
## Changes in 7.1 Update 3 - For Developers
24+
* The default locking mechanic in TraceLogger has been changed to use an instance local lock() instead of a global mutex.
25+
* Since its introduction in 2009, TraceLogger has used a global Windows mutex to synchronise writing to log files.
26+
The impact was that only one log message could be written at a time across all instances of TraceLogger and all applications.
27+
* The default locking mechanic has been changed to an instance local lock() because this is sufficient to protect the file being written and allows concurrent writing of log files.
28+
* It is strongly recommended that the new default lock() synchronisation is used as it is faster and does not cause application issues due to mutex timeouts.
29+
* A new TraceLogger property <codeEntityReference linkText="TraceLogger.UseMutexSynchronisation">P:ASCOM.Utilities.TraceLogger.UseMutexSynchronisation</codeEntityReference>
30+
has been added so the original global mutex synchronisation can be re-enabled if required for use cases where logging synchronisation between processes is required.
31+
* A new option has been added to the Diagnostics application that enables end-users to revert all ASCOM TraceLogger activity to the original
32+
global mutex synchronisation without requiring code changes.
33+
34+
## Issues Fixed in 7.1 Update 3 - For Developers
35+
* None
36+
37+
## Breaking Changes (For Developers) in Platform 7.1 Update 3
38+
* None are expected, but developers should be aware of the change to the default locking mechanic in TraceLogger described above.
1639

17-
## Changes in 7.1 Update 2
40+
## Changes in the previous update
1841
See this link for changes and fixes in <link xlink:href="Version_7.1.2">Platform 7.1 Update 2</link>.

Installer/MasterPlatformVersion.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
7
22
1
33
3
4-
Release
4+
3
55

66
The first line of this file must contain the major Platform version number
77
The second line of this file must contain the minor Platform version number

PlatformUnitTests/PlatformUnitTests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<Compile Include="ComDeviceStateTests.cs" />
4747
<Compile Include="Properties\AssemblyInfo.cs" />
4848
<Compile Include="SwitchAsync.cs" />
49+
<Compile Include="TraceLoggerTests.cs" />
4950
<Compile Include="Utilities.Util EdgeCaseTests.cs" />
5051
</ItemGroup>
5152
<ItemGroup>
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
using ASCOM.Utilities;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using Xunit;
8+
using Xunit.Abstractions;
9+
10+
namespace PlatformUnitTests
11+
{
12+
public class TraceLoggerTests
13+
{
14+
private readonly ITestOutputHelper output;
15+
16+
public TraceLoggerTests(ITestOutputHelper output)
17+
{
18+
this.output = output;
19+
}
20+
21+
[Fact]
22+
public void UseMutexSynchronisationDefault()
23+
{
24+
TraceLogger TL = new TraceLogger();
25+
Assert.False(TraceLogger.UseMutexSynchronisation);
26+
output.WriteLine($"UseMutexSynchronisation: {TraceLogger.UseMutexSynchronisation}");
27+
}
28+
29+
[Fact]
30+
public void UseMutexSynchronisationFalse()
31+
{
32+
TraceLogger TL = new TraceLogger("","UseMutexSynchronisationFalse");
33+
TL.Enabled= true;
34+
TraceLogger.UseMutexSynchronisation = false;
35+
36+
TL.LogMessage("", $"UseMutexSynchronisation is {TraceLogger.UseMutexSynchronisation}");
37+
Assert.False(TraceLogger.UseMutexSynchronisation);
38+
TL.Dispose();
39+
}
40+
41+
[Fact]
42+
public void UseMutexSynchronisationTrue()
43+
{
44+
TraceLogger TL = new TraceLogger("", "UseMutexSynchronisationTrue");
45+
TL.Enabled = true;
46+
TraceLogger.UseMutexSynchronisation = true;
47+
48+
TL.LogMessage("", $"UseMutexSynchronisation is {TraceLogger.UseMutexSynchronisation}");
49+
Assert.True(TraceLogger.UseMutexSynchronisation);
50+
TL.Dispose();
51+
}
52+
}
53+
}

0 commit comments

Comments
 (0)