diff --git a/.github/scripts/run-with-timeout.ps1 b/.github/scripts/run-with-timeout.ps1
new file mode 100644
index 000000000..cfbf13e33
--- /dev/null
+++ b/.github/scripts/run-with-timeout.ps1
@@ -0,0 +1,253 @@
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory = $true)]
+ [ValidateNotNullOrEmpty()]
+ [string]$FilePath,
+
+ [ValidateRange(1, 86400)]
+ [int]$TimeoutSeconds = 600,
+
+ [ValidateRange(1, 16)]
+ [int]$ProcessCount = 1,
+
+ [ValidateNotNullOrEmpty()]
+ [string]$DiagnosticsDirectory = "test-diagnostics",
+
+ [ValidateNotNullOrEmpty()]
+ [string]$Label = [System.IO.Path]::GetFileNameWithoutExtension($FilePath),
+
+ [string]$ProcessArguments = ""
+)
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = "Stop"
+
+if (-not ("RunWithTimeout.NativeMethods" -as [type])) {
+ Add-Type -TypeDefinition @"
+namespace RunWithTimeout
+{
+ using System;
+ using System.Runtime.InteropServices;
+
+ public static class NativeMethods
+ {
+ [DllImport("kernel32.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool IsWow64Process(
+ IntPtr processHandle,
+ [MarshalAs(UnmanagedType.Bool)] out bool wow64Process);
+ }
+}
+"@
+}
+
+function Stop-RunningProcess {
+ param(
+ [Parameter(Mandatory = $true)]
+ [System.Diagnostics.Process]$Process
+ )
+
+ if (-not $Process.HasExited) {
+ try {
+ Stop-Process -Id $Process.Id
+ }
+ catch {
+ $Process.Refresh()
+ if (-not $Process.HasExited) {
+ throw
+ }
+ }
+ $Process.WaitForExit()
+ }
+}
+
+function Get-DumpSystemDirectory {
+ param(
+ [Parameter(Mandatory = $true)]
+ [System.Diagnostics.Process]$Process
+ )
+
+ if (-not [Environment]::Is64BitOperatingSystem) {
+ return (Join-Path $env:WINDIR "System32")
+ }
+
+ $isWow64 = $false
+ if (-not [RunWithTimeout.NativeMethods]::IsWow64Process($Process.Handle, [ref]$isWow64)) {
+ $errorCode = [Runtime.InteropServices.Marshal]::GetLastWin32Error()
+ throw "Unable to determine the architecture of process $($Process.Id) (Win32 error $errorCode)."
+ }
+
+ if ($isWow64) {
+ return (Join-Path $env:WINDIR "SysWOW64")
+ }
+
+ if (-not [Environment]::Is64BitProcess) {
+ return (Join-Path $env:WINDIR "Sysnative")
+ }
+
+ return (Join-Path $env:WINDIR "System32")
+}
+
+function Save-ProcessDump {
+ param(
+ [Parameter(Mandatory = $true)]
+ [System.Diagnostics.Process]$Process,
+
+ [Parameter(Mandatory = $true)]
+ [string]$DumpPath
+ )
+
+ $dumpProcess = $null
+ $procdump = Get-Command procdump.exe -ErrorAction SilentlyContinue
+ if ($null -ne $procdump) {
+ # A minidump contains the thread stacks and module list needed for a
+ # deadlock diagnosis without copying arbitrary process memory into CI
+ # artifacts.
+ $arguments = "-accepteula -mm $($Process.Id) `"$DumpPath`""
+ $dumpProcess = Start-Process -FilePath $procdump.Source -ArgumentList $arguments -PassThru -NoNewWindow
+ }
+ else {
+ # The dump writer must match the target process architecture. A
+ # 64-bit helper cannot reliably capture Win32 thread context, and a
+ # 32-bit helper cannot inspect a 64-bit target.
+ $systemDirectory = Get-DumpSystemDirectory -Process $Process
+ $powershell = Join-Path $systemDirectory "WindowsPowerShell\v1.0\powershell.exe"
+ $dumpScript = Join-Path $PSScriptRoot "write-minidump.ps1"
+ $arguments = "-NoLogo -NoProfile -ExecutionPolicy Bypass -File `"$dumpScript`" -ProcessId $($Process.Id) -DumpPath `"$DumpPath`""
+ $dumpProcess = Start-Process -FilePath $powershell -ArgumentList $arguments -PassThru -NoNewWindow
+ }
+
+ if (-not $dumpProcess.WaitForExit(30000)) {
+ Stop-RunningProcess -Process $dumpProcess
+ throw "Timed out while capturing dump for process $($Process.Id)."
+ }
+ $dumpProcess.WaitForExit()
+ $dumpProcess.Refresh()
+
+ if ($dumpProcess.ExitCode -ne 0) {
+ throw "Dump capture for process $($Process.Id) exited with code $($dumpProcess.ExitCode)."
+ }
+
+ if (-not (Test-Path -LiteralPath $DumpPath -PathType Leaf)) {
+ throw "Dump capture for process $($Process.Id) did not create $DumpPath."
+ }
+
+ $dumpFile = Get-Item -LiteralPath $DumpPath -ErrorAction SilentlyContinue
+ if ($null -eq $dumpFile -or $dumpFile.Length -eq 0) {
+ throw "Dump capture for process $($Process.Id) created an empty dump."
+ }
+}
+
+$resolvedFilePath = (Resolve-Path -LiteralPath $FilePath).Path
+$resolvedDiagnosticsDirectory = [System.IO.Path]::GetFullPath($DiagnosticsDirectory)
+New-Item -ItemType Directory -Path $resolvedDiagnosticsDirectory -Force | Out-Null
+
+$safeLabel = $Label -replace '[^A-Za-z0-9_.-]', '_'
+$statusPath = Join-Path $resolvedDiagnosticsDirectory "$safeLabel-status.txt"
+$startedAt = Get-Date
+@(
+ "Command: $resolvedFilePath"
+ "Arguments: $ProcessArguments"
+ "Process count: $ProcessCount"
+ "Timeout seconds: $TimeoutSeconds"
+ "Started: $($startedAt.ToString('o'))"
+) | Set-Content -LiteralPath $statusPath
+
+$processes = @()
+try {
+ for ($index = 0; $index -lt $ProcessCount; $index++) {
+ $startInfo = New-Object System.Diagnostics.ProcessStartInfo
+ $startInfo.FileName = $resolvedFilePath
+ $startInfo.Arguments = $ProcessArguments
+ $startInfo.UseShellExecute = $false
+
+ $process = New-Object System.Diagnostics.Process
+ $process.StartInfo = $startInfo
+ if (-not $process.Start()) {
+ throw "Failed to start $resolvedFilePath."
+ }
+ $processes += $process
+ }
+}
+catch {
+ foreach ($process in $processes) {
+ Stop-RunningProcess -Process $process
+ }
+ throw
+}
+
+$deadline = $startedAt.AddSeconds($TimeoutSeconds)
+while ($true) {
+ $failedProcess = $null
+ $failedExitCode = 0
+ $running = @()
+ foreach ($process in $processes) {
+ if ($process.HasExited) {
+ # WaitForExit() populates ExitCode reliably for processes that can
+ # finish before the first polling iteration.
+ $process.WaitForExit()
+ $process.Refresh()
+ if ($process.ExitCode -ne 0 -and $null -eq $failedProcess) {
+ $failedProcess = $process
+ $failedExitCode = $process.ExitCode
+ }
+ }
+ else {
+ $running += $process
+ }
+ }
+
+ if ($null -ne $failedProcess) {
+ foreach ($process in $processes) {
+ Stop-RunningProcess -Process $process
+ }
+ Add-Content -LiteralPath $statusPath -Value @(
+ "Completed: $((Get-Date).ToString('o'))"
+ "Result: failed"
+ "Exit code: $failedExitCode"
+ )
+ exit $failedExitCode
+ }
+
+ if ($running.Count -eq 0) {
+ Add-Content -LiteralPath $statusPath -Value @(
+ "Completed: $((Get-Date).ToString('o'))"
+ "Result: passed"
+ "Exit code: 0"
+ )
+ exit 0
+ }
+
+ if ((Get-Date) -ge $deadline) {
+ Write-Host "::error::$Label exceeded its $TimeoutSeconds-second timeout."
+ Add-Content -LiteralPath $statusPath -Value @(
+ "Completed: $((Get-Date).ToString('o'))"
+ "Result: timed out"
+ "Exit code: 124"
+ )
+
+ foreach ($process in $running) {
+ try {
+ if (-not $process.HasExited) {
+ $detailsPath = Join-Path $resolvedDiagnosticsDirectory "$safeLabel-$($process.Id).txt"
+ Get-Process -Id $process.Id |
+ Format-List Id, ProcessName, StartTime, TotalProcessorTime, Threads, HandleCount |
+ Out-File -LiteralPath $detailsPath
+
+ $dumpPath = Join-Path $resolvedDiagnosticsDirectory "$safeLabel-$($process.Id).dmp"
+ Save-ProcessDump -Process $process -DumpPath $dumpPath
+ Write-Host "Captured $dumpPath"
+ }
+ }
+ catch {
+ Write-Warning $_
+ }
+ finally {
+ Stop-RunningProcess -Process $process
+ }
+ }
+ exit 124
+ }
+
+ Start-Sleep -Milliseconds 200
+}
diff --git a/.github/scripts/write-minidump.ps1 b/.github/scripts/write-minidump.ps1
new file mode 100644
index 000000000..9ff613062
--- /dev/null
+++ b/.github/scripts/write-minidump.ps1
@@ -0,0 +1,63 @@
+[CmdletBinding()]
+param(
+ [Parameter(Mandatory = $true)]
+ [ValidateRange(1, [int]::MaxValue)]
+ [int]$ProcessId,
+
+ [Parameter(Mandatory = $true)]
+ [ValidateNotNullOrEmpty()]
+ [string]$DumpPath
+)
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = "Stop"
+
+Add-Type -TypeDefinition @"
+namespace WriteMiniDump
+{
+ using System;
+ using System.Runtime.InteropServices;
+ using Microsoft.Win32.SafeHandles;
+
+ public static class NativeMethods
+ {
+ [DllImport("dbghelp.dll", SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ public static extern bool MiniDumpWriteDump(
+ IntPtr processHandle,
+ uint processId,
+ SafeFileHandle fileHandle,
+ uint dumpType,
+ IntPtr exceptionParameters,
+ IntPtr userStreamParameters,
+ IntPtr callbackParameters);
+ }
+}
+"@
+
+$process = Get-Process -Id $ProcessId
+$resolvedDumpPath = [System.IO.Path]::GetFullPath($DumpPath)
+$dumpStream = [System.IO.File]::Open(
+ $resolvedDumpPath,
+ [System.IO.FileMode]::Create,
+ [System.IO.FileAccess]::Write,
+ [System.IO.FileShare]::None)
+
+try {
+ $created = [WriteMiniDump.NativeMethods]::MiniDumpWriteDump(
+ $process.Handle,
+ [uint32]$process.Id,
+ $dumpStream.SafeFileHandle,
+ 0,
+ [IntPtr]::Zero,
+ [IntPtr]::Zero,
+ [IntPtr]::Zero)
+ if (-not $created) {
+ $errorCode = [Runtime.InteropServices.Marshal]::GetLastWin32Error()
+ throw "MiniDumpWriteDump failed for process $ProcessId (Win32 error $errorCode)."
+ }
+}
+finally {
+ $dumpStream.Dispose()
+ $process.Dispose()
+}
diff --git a/.github/workflows/build-android.yml b/.github/workflows/build-android.yml
index 576eeb1ce..96cb76c80 100644
--- a/.github/workflows/build-android.yml
+++ b/.github/workflows/build-android.yml
@@ -50,6 +50,8 @@ jobs:
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2
+ with:
+ packages: platform-tools
- name: Install NDK
run: |
java -version
diff --git a/.github/workflows/build-windows-vs2022.yaml b/.github/workflows/build-windows-vs2022.yaml
index e109575e8..c6efdb426 100644
--- a/.github/workflows/build-windows-vs2022.yaml
+++ b/.github/workflows/build-windows-vs2022.yaml
@@ -34,7 +34,6 @@ jobs:
env:
SKIP_ARM_BUILD: 1
SKIP_ARM64_BUILD: 1
- SKIP_NET40_BUILD: 1
PlatformToolset: v143
VSTOOLS_VERSION: vs2022
shell: cmd
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
index a47773036..bad283b5f 100644
--- a/.github/workflows/codeql-analysis.yml
+++ b/.github/workflows/codeql-analysis.yml
@@ -132,6 +132,8 @@ jobs:
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@9fc6c4e9069bf8d3d10b2204b1fb8f6ef7065407 # v3.2.2
+ with:
+ packages: platform-tools
- name: Install NDK
run: |
java -version
diff --git a/.github/workflows/test-vcpkg.yml b/.github/workflows/test-vcpkg.yml
index 59961ce53..98ef86429 100644
--- a/.github/workflows/test-vcpkg.yml
+++ b/.github/workflows/test-vcpkg.yml
@@ -24,7 +24,11 @@ concurrency:
jobs:
windows:
runs-on: windows-latest
- name: Windows (x64-windows-static)
+ name: Windows (x64-windows-static, ${{ matrix.transport }})
+ strategy:
+ fail-fast: false
+ matrix:
+ transport: [WinHTTP, WinInet]
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
@@ -35,7 +39,12 @@ jobs:
shell: pwsh
- name: Run vcpkg port test
- run: .\tests\vcpkg\test-vcpkg-windows.ps1 -VcpkgRoot "${{ runner.temp }}\vcpkg"
+ run: |
+ $arguments = @{ VcpkgRoot = "${{ runner.temp }}\vcpkg" }
+ if ("${{ matrix.transport }}" -eq "WinInet") {
+ $arguments.WinInet = $true
+ }
+ .\tests\vcpkg\test-vcpkg-windows.ps1 @arguments
shell: pwsh
linux:
diff --git a/.github/workflows/test-win-latest.yml b/.github/workflows/test-win-latest.yml
index 2a77d5e2a..66261d1e6 100644
--- a/.github/workflows/test-win-latest.yml
+++ b/.github/workflows/test-win-latest.yml
@@ -32,28 +32,47 @@ concurrency:
jobs:
test:
- name: Test on Windows ${{ matrix.arch }}-${{ matrix.build }}
+ name: Test on Windows ${{ matrix.arch }}-${{ matrix.build }}${{ matrix.transport == 'WinInet' && ' (WinInet)' || '' }}
runs-on: ${{ matrix.os }}
+ timeout-minutes: 30
strategy:
+ fail-fast: false
matrix:
arch: [Win32, x64]
build: [Release, Debug]
+ transport: [WinHTTP, WinInet]
os: [windows-2022]
+ exclude:
+ - build: Debug
+ transport: WinInet
steps:
- name: Checkout
uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- continue-on-error: true
- name: setup-msbuild
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
with:
vs-version: '[17,)'
- - name: Test ${{ matrix.arch }} ${{ matrix.build }}
+ - name: Test ${{ matrix.transport }} ${{ matrix.arch }} ${{ matrix.build }}
shell: cmd
- run: build-tests.cmd ${{ matrix.arch }} ${{ matrix.build }}
+ run: build-tests.cmd ${{ matrix.arch }} ${{ matrix.build }} "" ${{ matrix.transport }}
+
+ - name: Upload test failure diagnostics
+ if: failure() || cancelled()
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
+ with:
+ name: windows-test-failure-${{ matrix.transport }}-${{ matrix.arch }}-${{ matrix.build }}
+ path: |
+ test-diagnostics
+ Solutions/out/${{ matrix.build }}/${{ matrix.arch }}/UnitTests/*.pdb
+ Solutions/out/${{ matrix.build }}/${{ matrix.arch }}/UnitTests/*.map
+ Solutions/out/${{ matrix.build }}/${{ matrix.arch }}/FuncTests/*.pdb
+ Solutions/out/${{ matrix.build }}/${{ matrix.arch }}/FuncTests/*.map
+ if-no-files-found: ignore
+ retention-days: 7
public-headers:
name: Public header gate (MSVC)
diff --git a/Solutions/Clienttelemetry/Clienttelemetry.vcxitems b/Solutions/Clienttelemetry/Clienttelemetry.vcxitems
index 065ca3118..ec398399b 100644
--- a/Solutions/Clienttelemetry/Clienttelemetry.vcxitems
+++ b/Solutions/Clienttelemetry/Clienttelemetry.vcxitems
@@ -105,7 +105,7 @@
-
+
@@ -161,6 +161,7 @@
+
diff --git a/Solutions/Clienttelemetry/Clienttelemetry.vcxitems.filters b/Solutions/Clienttelemetry/Clienttelemetry.vcxitems.filters
index 376e1dfba..3f2ed6822 100644
--- a/Solutions/Clienttelemetry/Clienttelemetry.vcxitems.filters
+++ b/Solutions/Clienttelemetry/Clienttelemetry.vcxitems.filters
@@ -90,7 +90,7 @@
-
+
@@ -147,6 +147,9 @@
+
+ Header Files
+
diff --git a/Solutions/MSTelemetrySDK.sln b/Solutions/MSTelemetrySDK.sln
index 8e83ec54a..0f531a2ea 100644
--- a/Solutions/MSTelemetrySDK.sln
+++ b/Solutions/MSTelemetrySDK.sln
@@ -19,7 +19,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win10-cs", "win10-cs\win10-
{8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net40", "net40\net40.vcxproj", "{DC91621E-A203-42DF-8E03-3A23DD0602B1}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "net48", "net48\net48.vcxproj", "{DC91621E-A203-42DF-8E03-3A23DD0602B1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{250EFB82-2F0E-4781-94BB-8313201ABDF0}"
EndProject
@@ -87,7 +87,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleCpp", "..\examples\cp
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleCppUWP", "..\examples\cpp\SampleCppUWP\SampleCppUWP.vcxproj", "{39DBD601-4D79-49F9-AD18-065404DBA273}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsNet40", "..\examples\cs\SampleCsNet40\SampleCsNet40.csproj", "{65AFA0E2-F9A2-4309-87E7-E419D59583C1}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsNet48", "..\examples\cs\SampleCsNet48\SampleCsNet48.csproj", "{65AFA0E2-F9A2-4309-87E7-E419D59583C1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SampleCsUWP", "..\examples\cs\SampleCsUWP\SampleCsUWP.csproj", "{F797B22C-A1C4-4136-9DCC-0682A183A4DA}"
EndProject
diff --git a/Solutions/before.targets b/Solutions/before.targets
index 43e18d434..1be68446e 100644
--- a/Solutions/before.targets
+++ b/Solutions/before.targets
@@ -2,6 +2,14 @@
$(SolutionDir)\..\third_party\krabsetw\krabs;$(CustomIncludePath)
+
+
+
+ _SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)
+ $(SolutionDir)..\zlib;$(SolutionDir)..\sqlite;$(SolutionDir)..\lib\pal\universal;%(AdditionalIncludeDirectories)
+
+
diff --git a/Solutions/build.net40.props b/Solutions/build.net48.props
similarity index 83%
rename from Solutions/build.net40.props
rename to Solutions/build.net48.props
index 6bb7ab851..7c6843ee2 100644
--- a/Solutions/build.net40.props
+++ b/Solutions/build.net48.props
@@ -2,7 +2,7 @@
- %(PreprocessorDefinitions);CONFIG_CUSTOM_H="config-net40.h"
+ %(PreprocessorDefinitions);CONFIG_CUSTOM_H="config-net48.h"
diff --git a/Solutions/conformance.props b/Solutions/conformance.props
index 79e1ae779..6a2b1efdb 100644
--- a/Solutions/conformance.props
+++ b/Solutions/conformance.props
@@ -2,7 +2,7 @@
+
diff --git a/Solutions/win32-cs/deploy-dll.cmd b/Solutions/win32-cs/deploy-dll.cmd
index 5feac91bc..8adccab60 100644
--- a/Solutions/win32-cs/deploy-dll.cmd
+++ b/Solutions/win32-cs/deploy-dll.cmd
@@ -3,17 +3,16 @@ cd /d %~dp0
set OUTDIR=%CD%\..\..\out
cd %OUTDIR%
-xcopy /Y /D Debug\Win32\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Debug\x86\win32-cs\bin\
-xcopy /Y /D Debug\x64\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Debug\x64\win32-cs\bin\
+xcopy /Y /D Debug\Win32\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Debug\x86\win32-cs\bin\
+xcopy /Y /D Debug\x64\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Debug\x64\win32-cs\bin\
-xcopy /Y /D Debug.vs2013\Win32\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Debug.vs2013\x86\win32-cs\bin\
-xcopy /Y /D Debug.vs2013\x64\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Debug.vs2013\x64\win32-cs\bin\
+xcopy /Y /D Debug.vs2013\Win32\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Debug.vs2013\x86\win32-cs\bin\
+xcopy /Y /D Debug.vs2013\x64\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Debug.vs2013\x64\win32-cs\bin\
-xcopy /Y /D Release\Win32\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Release\x86\win32-cs\bin\
-xcopy /Y /D Release\x64\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Release\x64\win32-cs\bin\
+xcopy /Y /D Release\Win32\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Release\x86\win32-cs\bin\
+xcopy /Y /D Release\x64\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Release\x64\win32-cs\bin\
-xcopy /Y /D Release.vs2013\Win32\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Release.vs2013\x86\win32-cs\bin\
-xcopy /Y /D Release.vs2013\x64\net40\bin\Microsoft.Applications.Telemetry.Windows.dll Release.vs2013\x64\win32-cs\bin\
+xcopy /Y /D Release.vs2013\Win32\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Release.vs2013\x86\win32-cs\bin\
+xcopy /Y /D Release.vs2013\x64\net48\bin\Microsoft.Applications.Telemetry.Windows.dll Release.vs2013\x64\win32-cs\bin\
exit /b 0
-
diff --git a/Solutions/win32-cs/packages.config b/Solutions/win32-cs/packages.config
index a751695d0..c358ed79c 100644
--- a/Solutions/win32-cs/packages.config
+++ b/Solutions/win32-cs/packages.config
@@ -1,5 +1,5 @@
-
-
+
+
\ No newline at end of file
diff --git a/Solutions/win32-cs/win32-cs.csproj b/Solutions/win32-cs/win32-cs.csproj
index a93a15fa7..53c3361b7 100644
--- a/Solutions/win32-cs/win32-cs.csproj
+++ b/Solutions/win32-cs/win32-cs.csproj
@@ -10,7 +10,7 @@
Properties
CLI
win32-cs
- v4.0
+ v4.8
512
false
@@ -39,7 +39,7 @@
prompt
MinimumRecommendedRules.ruleset
true
- v4.0
+ v4.8
true
..\..\out\Debug\x86\win32-cs\bin\
true
@@ -52,7 +52,7 @@
prompt
MinimumRecommendedRules.ruleset
true
- v4.0
+ v4.8
true
@@ -62,7 +62,7 @@
prompt
MinimumRecommendedRules.ruleset
false
- v4.0
+ v4.8
TRACE
@@ -73,7 +73,7 @@
MinimumRecommendedRules.ruleset
false
true
- v4.0
+ v4.8
CLI.Program
@@ -117,9 +117,9 @@
-
+
False
- Microsoft .NET Framework 4 %28x86 and x64%29
+ Microsoft .NET Framework 4.8 %28x86 and x64%29
true
@@ -134,9 +134,9 @@
-
+
{dc91621e-a203-42df-8e03-3a23dd0602b1}
- net40
+ net48
diff --git a/Solutions/win32-dll/win32-dll.vcxproj b/Solutions/win32-dll/win32-dll.vcxproj
index b01b9e690..968f36990 100644
--- a/Solutions/win32-dll/win32-dll.vcxproj
+++ b/Solutions/win32-dll/win32-dll.vcxproj
@@ -28,10 +28,10 @@
-
+
-
+
@@ -211,7 +211,7 @@
Windows
true
- uuid.lib;wininet.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
runtimeobject.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -233,7 +233,7 @@
true
- wininet.lib;user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
+ user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
%(AdditionalLibraryDirectories)
@@ -297,7 +297,7 @@
true
true
true
- uuid.lib;wininet.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
runtimeobject.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -322,7 +322,7 @@
true
- wininet.lib;user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
+ user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
%(AdditionalLibraryDirectories)
@@ -336,6 +336,22 @@
{2ebc7b3c-2af1-442c-9285-cab39bbb8c00}
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
diff --git a/Solutions/win32-dll/win32-dll.vcxproj.filters b/Solutions/win32-dll/win32-dll.vcxproj.filters
index 302a6f598..ec89c6c46 100644
--- a/Solutions/win32-dll/win32-dll.vcxproj.filters
+++ b/Solutions/win32-dll/win32-dll.vcxproj.filters
@@ -1,7 +1,7 @@
-
+
@@ -9,7 +9,7 @@
-
+
diff --git a/Solutions/win32-lib/win32-lib.vcxproj b/Solutions/win32-lib/win32-lib.vcxproj
index 1b9fb6a7c..d088b06c7 100644
--- a/Solutions/win32-lib/win32-lib.vcxproj
+++ b/Solutions/win32-lib/win32-lib.vcxproj
@@ -279,7 +279,7 @@
Windows
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
false
@@ -347,7 +347,7 @@
Windows
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
false
@@ -425,7 +425,7 @@
true
true
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -501,7 +501,7 @@
true
true
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -536,6 +536,22 @@
true
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
diff --git a/Solutions/win32-mini-dll/win32-mini-dll.vcxproj b/Solutions/win32-mini-dll/win32-mini-dll.vcxproj
index fe923aee2..99d21d1ba 100644
--- a/Solutions/win32-mini-dll/win32-mini-dll.vcxproj
+++ b/Solutions/win32-mini-dll/win32-mini-dll.vcxproj
@@ -28,10 +28,10 @@
-
+
-
+
@@ -240,7 +240,7 @@
Windows
true
- uuid.lib;wininet.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
runtimeobject.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -268,7 +268,7 @@
true
- wininet.lib;user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
+ user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
%(AdditionalLibraryDirectories)
@@ -357,7 +357,7 @@
true
true
true
- uuid.lib;wininet.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;version.lib;%(AdditionalDependencies)
runtimeobject.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -385,10 +385,26 @@
true
- wininet.lib;user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
+ user32.lib;shell32.lib;Advapi32.lib;Ole32.lib
%(AdditionalLibraryDirectories)
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
diff --git a/Solutions/win32-mini-dll/win32-mini-dll.vcxproj.filters b/Solutions/win32-mini-dll/win32-mini-dll.vcxproj.filters
index 302a6f598..ec89c6c46 100644
--- a/Solutions/win32-mini-dll/win32-mini-dll.vcxproj.filters
+++ b/Solutions/win32-mini-dll/win32-mini-dll.vcxproj.filters
@@ -1,7 +1,7 @@
-
+
@@ -9,7 +9,7 @@
-
+
diff --git a/Solutions/win32-mini-lib/win32-mini-lib.vcxproj b/Solutions/win32-mini-lib/win32-mini-lib.vcxproj
index 700623d89..aba9e8999 100644
--- a/Solutions/win32-mini-lib/win32-mini-lib.vcxproj
+++ b/Solutions/win32-mini-lib/win32-mini-lib.vcxproj
@@ -321,7 +321,7 @@
Windows
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
false
@@ -427,7 +427,7 @@
Windows
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
false
@@ -534,7 +534,7 @@
true
true
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -642,7 +642,7 @@
true
true
true
- uuid.lib;wininet.lib;crypt32.lib;%(AdditionalDependencies)
+ uuid.lib;crypt32.lib;%(AdditionalDependencies)
%(AdditionalLibraryDirectories)
api-ms-win-core-winrt-l1-1-0.dll;api-ms-win-core-winrt-string-l1-1-0.dll
@@ -677,6 +677,22 @@
true
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
diff --git a/build-Win32Debug.bat b/build-Win32Debug.bat
index 890bddc16..6b5cdf9f5 100644
--- a/build-Win32Debug.bat
+++ b/build-Win32Debug.bat
@@ -3,5 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
-call tools\RunMsBuild.bat Win32 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
+call tools\RunMsBuild.bat Win32 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net48:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
call tools\RunTests.bat Win32 Debug
\ No newline at end of file
diff --git a/build-Win32Release.bat b/build-Win32Release.bat
index a9f8ee040..ed987543c 100644
--- a/build-Win32Release.bat
+++ b/build-Win32Release.bat
@@ -3,5 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
-call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
+call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net48:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
call tools\RunTests.bat Win32 Release
\ No newline at end of file
diff --git a/build-all-v143.bat b/build-all-v143.bat
index 8d5ebbfa9..1e67178ab 100644
--- a/build-all-v143.bat
+++ b/build-all-v143.bat
@@ -2,5 +2,4 @@
set VSTOOLS_VERSION=vs2022
set PlatformToolset=v143
-set SKIP_NET40_BUILD=1
call "%~dp0build-all-windows.bat" %*
diff --git a/build-all-v145.bat b/build-all-v145.bat
index 54f6b4e9a..6bc704bc9 100644
--- a/build-all-v145.bat
+++ b/build-all-v145.bat
@@ -2,5 +2,4 @@
set VSTOOLS_VERSION=vs2026
set PlatformToolset=v145
-set SKIP_NET40_BUILD=1
call "%~dp0build-all-windows.bat" %*
diff --git a/build-all-windows.bat b/build-all-windows.bat
index 4ea3808e9..d5b3c7214 100644
--- a/build-all-windows.bat
+++ b/build-all-windows.bat
@@ -33,12 +33,12 @@ exit /b 1
:after_custom_props_validation
call tools\gen-version.cmd
-set NET40_MD_TARGETS=,net40:Rebuild
-set NET40_SAMPLE_TARGETS=,Samples\cs\SampleCsNet40:Rebuild
-if DEFINED SKIP_NET40_BUILD (
- echo Skipping legacy .NET Framework 4.0 targets.
- set NET40_MD_TARGETS=
- set NET40_SAMPLE_TARGETS=
+set NET48_MD_TARGETS=,net48:Rebuild
+set NET48_SAMPLE_TARGETS=,Samples\cs\SampleCsNet48:Rebuild
+if DEFINED SKIP_NET48_BUILD (
+ echo Skipping .NET Framework 4.8 targets.
+ set NET48_MD_TARGETS=
+ set NET48_SAMPLE_TARGETS=
)
echo Update all public submodules...
@@ -57,15 +57,15 @@ if NOT EXIST %GTEST_PATH%\CMakeLists.txt (
if NOT DEFINED SKIP_MD_BUILD (
REM DLL and static /MD build
REM Release
- call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild%NET40_SAMPLE_TARGETS%" %CUSTOM_PROPS%
+ call tools\RunMsBuild.bat Win32 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET48_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild%NET48_SAMPLE_TARGETS%" %CUSTOM_PROPS%
if errorlevel 1 exit /b 1
- call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild%NET40_SAMPLE_TARGETS%" %CUSTOM_PROPS%
+ call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET48_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild%NET48_SAMPLE_TARGETS%" %CUSTOM_PROPS%
if errorlevel 1 exit /b 1
REM Debug
if NOT DEFINED SKIP_DEBUG_BUILD (
- call tools\RunMsBuild.bat Win32 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
+ call tools\RunMsBuild.bat Win32 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET48_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
if errorlevel 1 exit /b 1
- call tools\RunMsBuild.bat x64 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET40_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
+ call tools\RunMsBuild.bat x64 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild%NET48_MD_TARGETS%,win10-cs:Rebuild,win10-dll:Rebuild,win10-lib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild" %CUSTOM_PROPS%
if errorlevel 1 exit /b 1
)
)
diff --git a/build-tests.cmd b/build-tests.cmd
index 7f3d0a0ba..12b74e59a 100644
--- a/build-tests.cmd
+++ b/build-tests.cmd
@@ -2,6 +2,18 @@
cd %~dp0
@setlocal ENABLEEXTENSIONS
+set TRANSPORT=%~4
+if not defined TRANSPORT set TRANSPORT=WinHTTP
+if /I "%TRANSPORT%"=="WinInet" (
+ set TRANSPORT_PROPERTY=/p:MATSDK_USE_WININET=true
+) else if /I "%TRANSPORT%"=="WinHTTP" (
+ set TRANSPORT_PROPERTY=/p:MATSDK_USE_WININET=false
+) else (
+ echo ERROR: Unknown HTTP transport "%TRANSPORT%". Expected WinHTTP or WinInet.
+ exit /b 2
+)
+echo HTTP transport: %TRANSPORT%
+
set CUSTOM_PROPS=
if not "%~3"=="" (
if not exist "%~f3" (
@@ -52,11 +64,11 @@ set CONFIGURATION=%2
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set SOLUTION=Solutions\MSTelemetrySDK.sln
-msbuild %SOLUTION% /target:sqlite:Rebuild,zlib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=%CONFIGURATION% /p:Platform=%PLAT% %CUSTOM_PROPS%
+msbuild %SOLUTION% /target:sqlite:Rebuild,zlib:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /detailedsummary /p:Configuration=%CONFIGURATION% /p:Platform=%PLAT% %TRANSPORT_PROPERTY% %CUSTOM_PROPS%
if not "%ERRORLEVEL%"=="0" exit /b %ERRORLEVEL%
-Solutions\out\%CONFIGURATION%\%PLAT%\UnitTests\UnitTests.exe
+powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .github\scripts\run-with-timeout.ps1 -FilePath Solutions\out\%CONFIGURATION%\%PLAT%\UnitTests\UnitTests.exe -TimeoutSeconds 600 -Label UnitTests-%CONFIGURATION%-%PLAT%-%TRANSPORT%
if not "%ERRORLEVEL%"=="0" exit /b %ERRORLEVEL%
-Solutions\out\%CONFIGURATION%\%PLAT%\FuncTests\FuncTests.exe
+powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .github\scripts\run-with-timeout.ps1 -FilePath Solutions\out\%CONFIGURATION%\%PLAT%\FuncTests\FuncTests.exe -TimeoutSeconds 600 -Label FuncTests-%CONFIGURATION%-%PLAT%-%TRANSPORT%
if not "%ERRORLEVEL%"=="0" exit /b %ERRORLEVEL%
-powershell -NoProfile -ExecutionPolicy Bypass -Command "$path = Join-Path (Get-Location) 'Solutions\out\%CONFIGURATION%\%PLAT%\FuncTests\FuncTests.exe'; $args = '--gtest_filter=MultipleLogManagersTests.MultiProcessesLogManager'; $p1 = Start-Process -FilePath $path -ArgumentList $args -PassThru; $p2 = Start-Process -FilePath $path -ArgumentList $args -PassThru; $p1.WaitForExit(); $p2.WaitForExit(); if ($p1.ExitCode -ne 0 -or $p2.ExitCode -ne 0) { exit 1 }"
+powershell.exe -NoLogo -NoProfile -ExecutionPolicy Bypass -File .github\scripts\run-with-timeout.ps1 -FilePath Solutions\out\%CONFIGURATION%\%PLAT%\FuncTests\FuncTests.exe -ProcessArguments "--gtest_filter=MultipleLogManagersTests.MultiProcessesLogManager" -ProcessCount 2 -TimeoutSeconds 600 -Label FuncTests-concurrent-%CONFIGURATION%-%PLAT%-%TRANSPORT%
if not "%ERRORLEVEL%"=="0" exit /b %ERRORLEVEL%
diff --git a/build-x64Debug.bat b/build-x64Debug.bat
index 1567e1aa7..a5485c2da 100644
--- a/build-x64Debug.bat
+++ b/build-x64Debug.bat
@@ -3,5 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
-call tools\RunMsBuild.bat x64 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
+call tools\RunMsBuild.bat x64 Debug "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net48:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
call tools\RunTests.bat x64 Debug
\ No newline at end of file
diff --git a/build-x64Release.bat b/build-x64Release.bat
index 5b3d6619a..ee9ee7166 100644
--- a/build-x64Release.bat
+++ b/build-x64Release.bat
@@ -3,5 +3,5 @@ cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
-call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net40:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
+call tools\RunMsBuild.bat x64 Release "sqlite:Rebuild,zlib:Rebuild,sqlite-uwp:Rebuild,win32-dll:Rebuild,win32-lib:Rebuild,net48:Rebuild,win10-cs:Rebuild,win10-dll:Rebuild,Tests\gmock:Rebuild,Tests\gtest:Rebuild,Tests\UnitTests:Rebuild,Tests\FuncTests:Rebuild"
call tools\RunTests.bat x64 Release
diff --git a/cmake/MSTelemetryConfig.cmake.in b/cmake/MSTelemetryConfig.cmake.in
index a46d7d94c..60a3579c2 100644
--- a/cmake/MSTelemetryConfig.cmake.in
+++ b/cmake/MSTelemetryConfig.cmake.in
@@ -17,6 +17,7 @@ if(@MATSDK_CONFIG_STATIC_PACKAGE@)
SQLite3::SQLite3
"@MATSDK_SQLITE_PROVIDER_RESOLVED@"
SQLite3
+ LEGACY_TARGET SQLite::SQLite3
${_matsdk_package_sqlite_args})
matsdk_add_package_system_dependency(
MSTelemetry::zlib_dependency
diff --git a/cmake/MatsdkDependencyTargets.cmake b/cmake/MatsdkDependencyTargets.cmake
index f5f320043..47ddf21a4 100644
--- a/cmake/MatsdkDependencyTargets.cmake
+++ b/cmake/MatsdkDependencyTargets.cmake
@@ -20,7 +20,7 @@ function(matsdk_add_package_system_dependency dependency_target canonical_target
endif()
set(options APPLE_SYSTEM)
- set(one_value_args APPLE_LIBRARY)
+ set(one_value_args APPLE_LIBRARY LEGACY_TARGET)
cmake_parse_arguments(MATSDK_PACKAGE_DEP "${options}" "${one_value_args}" "" ${ARGN})
if(MATSDK_PACKAGE_DEP_APPLE_SYSTEM)
@@ -35,6 +35,12 @@ function(matsdk_add_package_system_dependency dependency_target canonical_target
elseif(NOT TARGET "${canonical_target}")
find_dependency(${package_name})
endif()
+ if(NOT TARGET "${canonical_target}"
+ AND DEFINED MATSDK_PACKAGE_DEP_LEGACY_TARGET
+ AND TARGET "${MATSDK_PACKAGE_DEP_LEGACY_TARGET}")
+ matsdk_add_interface_dependency(
+ "${canonical_target}" "${MATSDK_PACKAGE_DEP_LEGACY_TARGET}")
+ endif()
if(NOT TARGET "${canonical_target}")
message(FATAL_ERROR
"${package_name} did not create the required ${canonical_target} target.")
diff --git a/cmake/MatsdkOptions.cmake b/cmake/MatsdkOptions.cmake
index c90487350..ed95ec805 100644
--- a/cmake/MatsdkOptions.cmake
+++ b/cmake/MatsdkOptions.cmake
@@ -42,6 +42,8 @@ option(MATSDK_BUILD_AZMON
"Build Azure Monitor / Application Insights support" ON)
option(MATSDK_BUILD_APPLE_HTTP
"Build the Apple-native HTTP client" "${APPLE}")
+option(MATSDK_USE_WININET
+ "Use WinInet instead of WinHTTP as the Win32 desktop HTTP client" OFF)
option(MATSDK_DISABLE_LOGGING
"Compile internal SDK logging out" OFF)
diff --git a/docs/Offline-storage-settings.md b/docs/Offline-storage-settings.md
index 137cb5c34..a3f2fd60f 100644
--- a/docs/Offline-storage-settings.md
+++ b/docs/Offline-storage-settings.md
@@ -21,6 +21,8 @@ Set `skipSqliteInitAndShutdown` to `"true"` only when your application already o
When this option is enabled, the application is responsible for calling `sqlite3_initialize()` before creating a `LogManager` that uses offline storage and for delaying `sqlite3_shutdown()` until all SDK offline storage instances have been released.
+This also applies when multiple libraries in one process each embed 1DS but link to the same system or shared SQLite runtime. Configure every 1DS copy to skip SQLite initialization and shutdown, and let the host own that shared runtime. No coordination is required when each library contains a genuinely private bundled SQLite copy; the bundled CMake target hides its SQLite symbols to preserve that isolation.
+
## Deprecated configurations
| Configuration |
diff --git a/docs/building-with-vcpkg.md b/docs/building-with-vcpkg.md
index 8cdb27c69..a4aa85a3c 100644
--- a/docs/building-with-vcpkg.md
+++ b/docs/building-with-vcpkg.md
@@ -220,18 +220,27 @@ On Linux, libcurl is provided by the default `curl-openssl` feature;
`curl-mbedtls` swaps in the mbedTLS backend — see
[Choose the Linux HTTP client / TLS backend](#choose-the-linux-http-client--tls-backend-largest-lever-on-linux).
-Windows and macOS/iOS use platform-native HTTP clients (WinInet and
+Windows and macOS/iOS use platform-native HTTP clients (WinHTTP and
NSURLSession respectively). Android defaults to the platform Java/JNI HTTP
bridge; native curl is available only through explicit `android-curl-*` features.
> **Note (Windows):** The port targets the MSVC/`WIN32` PAL on Windows, which
-> uses WinInet, so the default `curl` dependency is declared for Linux only
+> uses WinHTTP, so the default `curl` dependency is declared for Linux only
> (Android has separate explicit `android-curl-*` features). A MinGW /
> non-MSVC Windows triplet — or forcing `-DPAL_IMPLEMENTATION=CPP11` on Windows —
> selects the curl HTTP client, which the port does not provision on Windows
> (broadening `curl` to `windows` would pull an unused curl into every MSVC
> build, since vcpkg platform expressions can't key off the PAL). Use a standard
> MSVC triplet such as `x64-windows-static` for Windows vcpkg builds.
+>
+> Consumers that require WinInet's IE-integrated proxy or cookie behavior can
+> opt in with the `wininet` feature, for example
+> `"features": ["wininet", "system-sqlite"]`.
+> WinHTTP uses automatic or machine-level proxy configuration rather than the
+> logged-on user's Internet Explorer settings, does not answer authentication
+> challenges with ambient user credentials, and reports WinHTTP error codes.
+> Consumers that depend on the prior WinInet behavior should select the feature
+> explicitly before updating.
## Optional: SIMD-Optimized zlib with zlib-ng
@@ -303,7 +312,7 @@ export table pins its symbols and defeats `/OPT:REF`.
### Choose the Linux HTTP client / TLS backend (largest lever on Linux)
On Linux the built-in HTTP client is libcurl, and curl's TLS backend dominates
-the SDK's footprint. (Windows uses WinInet, Apple uses NSURLSession, and Android
+the SDK's footprint. (Windows uses WinHTTP by default, Apple uses NSURLSession, and Android
uses the Java/JNI bridge by default, so this section does not apply there.) The
port exposes the Linux TLS backend as two mutually-exclusive features; pick the
one that matches what your application already has:
diff --git a/docs/cpp-start-windows.md b/docs/cpp-start-windows.md
index 6f6189056..2a6877d17 100644
--- a/docs/cpp-start-windows.md
+++ b/docs/cpp-start-windows.md
@@ -29,7 +29,7 @@ If your project requires the Universal Telemetry Client (a.k.a. UTC) to send tel
The version-specific scripts set `VSTOOLS_VERSION` and `PlatformToolset` before calling `build-all-windows.bat`, which builds the Windows Visual Studio solution matrix. `build-all.bat` remains as a compatibility wrapper for existing automation; if you call either script directly, set both values yourself so `tools\vcvars.cmd` selects the same Visual Studio installation as your requested toolset.
-Visual Studio 2022 and newer may report the legacy .NET Framework 4.0 projects (`net40` and `SampleCsNet40`) as unsupported. They are only needed for the legacy .NET Framework wrapper; the VS2022 and VS2026 command-line wrappers skip those projects, and you can unload them in the IDE when building the native SDK.
+The Windows solution includes the .NET Framework 4.8 wrapper (`net48`) and C# sample (`SampleCsNet48`). Install the .NET Framework 4.8 SDK and targeting pack through the Visual Studio Installer to build these projects. Set `SKIP_NET48_BUILD=1` before running a command-line build only when you want to build the native SDK without the managed wrapper and sample.
If your build fails, then you most likely missing the following optional Visual Studio components:
diff --git a/examples/c/SampleC-Guest/CMakeLists.txt b/examples/c/SampleC-Guest/CMakeLists.txt
index 06a7d85b5..f64d0bcd6 100644
--- a/examples/c/SampleC-Guest/CMakeLists.txt
+++ b/examples/c/SampleC-Guest/CMakeLists.txt
@@ -6,8 +6,10 @@ project(SampleC-Guest)
include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/MSTelemetrySample.cmake)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
+if(NOT MSVC)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
+endif()
find_package (Threads)
@@ -20,4 +22,4 @@ source_group(" " REGULAR_EXPRESSION "")
# The 1DS SDK's required Apple frameworks are provided by MATSDK_SAMPLE_PLATFORM_LIBS.
-target_link_libraries(SampleC-Guest ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl)
+target_link_libraries(SampleC-Guest ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS})
diff --git a/examples/c/SampleC/SampleC.vcxproj b/examples/c/SampleC/SampleC.vcxproj
index d307939cf..8dc8948f1 100644
--- a/examples/c/SampleC/SampleC.vcxproj
+++ b/examples/c/SampleC/SampleC.vcxproj
@@ -1,4 +1,4 @@
-
+
@@ -43,7 +43,7 @@
false
- $(MSBuildProjectDirectory)\lib\$(Configuration)\$(Platform);$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WindowsSdkDir)lib;$(FrameworkSDKDir)\lib
+ $(LibraryPath)
$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include;$(MSBuildProjectDirectory)\include
@@ -53,7 +53,7 @@
Level3
Disabled
HAVE_DYNAMIC_C_LIB;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- $(SolutionDir)\..\lib\include\public
+ $(ProjectDir)\..\..\..\lib\include\public
Console
@@ -80,7 +80,7 @@
- $(SolutionDir)\..\lib\include\public
+ $(ProjectDir)\..\..\..\lib\include\public
Console
@@ -102,10 +102,10 @@
-
-
-
-
+
+
+
+
diff --git a/examples/c/SampleC/SampleC.vcxproj.filters b/examples/c/SampleC/SampleC.vcxproj.filters
index ec99270d2..bc6cb1d50 100644
--- a/examples/c/SampleC/SampleC.vcxproj.filters
+++ b/examples/c/SampleC/SampleC.vcxproj.filters
@@ -1,4 +1,4 @@
-
+
@@ -20,16 +20,16 @@
-
+
Header Files
-
+
Header Files
-
+
Header Files
-
+
Header Files
diff --git a/examples/cmake/MSTelemetrySample.cmake b/examples/cmake/MSTelemetrySample.cmake
index 5a7eca8ab..de4d636cf 100644
--- a/examples/cmake/MSTelemetrySample.cmake
+++ b/examples/cmake/MSTelemetrySample.cmake
@@ -13,9 +13,24 @@ if(NOT EXISTS "${MATSDK_LIB_DIR}/libmat.a"
set(MATSDK_LIB_DIR "${MATSDK_LIB_DIR}/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu" CACHE PATH "MSTelemetry library directory" FORCE)
endif()
-find_library(MATSDK_LIBRARY NAMES mat HINTS "${MATSDK_LIB_DIR}" NO_DEFAULT_PATH)
-if(NOT MATSDK_LIBRARY)
- message(FATAL_ERROR "Could not find libmat under ${MATSDK_LIB_DIR}. Set MATSDK_INSTALL_DIR or MATSDK_LIB_DIR.")
+find_package(MSTelemetry CONFIG QUIET
+ PATHS "${MATSDK_INSTALL_DIR}/lib/cmake/MSTelemetry"
+ NO_DEFAULT_PATH)
+if(TARGET MSTelemetry::mat)
+ set(MATSDK_LIBRARY MSTelemetry::mat)
+ set(MATSDK_SAMPLE_DEPENDENCY_LIBS "")
+else()
+ find_library(MATSDK_LIBRARY NAMES mat HINTS "${MATSDK_LIB_DIR}" NO_DEFAULT_PATH)
+ if(NOT MATSDK_LIBRARY)
+ message(FATAL_ERROR "Could not find libmat under ${MATSDK_LIB_DIR}. Set MATSDK_INSTALL_DIR or MATSDK_LIB_DIR.")
+ endif()
+ find_package(ZLIB REQUIRED)
+ set(MATSDK_SAMPLE_DEPENDENCY_LIBS ZLIB::ZLIB)
+ if(NOT WIN32 AND NOT APPLE
+ AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
+ find_package(CURL REQUIRED)
+ list(APPEND MATSDK_SAMPLE_DEPENDENCY_LIBS CURL::libcurl)
+ endif()
endif()
if(NOT EXISTS "${MATSDK_INCLUDE_DIR}")
@@ -40,9 +55,13 @@ if(APPLE)
endif()
endif()
-find_library(MATSDK_SQLITE3_LIB NAMES sqlite3 HINTS "${MATSDK_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
-if(NOT MATSDK_SQLITE3_LIB)
- set(MATSDK_SQLITE3_LIB sqlite3)
+if(TARGET MSTelemetry::mat)
+ set(MATSDK_SQLITE3_LIB "")
+else()
+ find_library(MATSDK_SQLITE3_LIB NAMES sqlite3 sqlite3_bundled HINTS "${MATSDK_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
+ if(NOT MATSDK_SQLITE3_LIB)
+ set(MATSDK_SQLITE3_LIB sqlite3)
+ endif()
endif()
mark_as_advanced(MATSDK_INSTALL_DIR MATSDK_INCLUDE_DIR MATSDK_LIB_DIR MATSDK_LIBRARY MATSDK_SQLITE3_LIB)
diff --git a/examples/cpp/EventSender/CMakeLists.txt b/examples/cpp/EventSender/CMakeLists.txt
index 223ebb785..76a86982b 100644
--- a/examples/cpp/EventSender/CMakeLists.txt
+++ b/examples/cpp/EventSender/CMakeLists.txt
@@ -23,4 +23,4 @@ source_group(" " REGULAR_EXPRESSION "")
#tcmalloc turned off by default
#target_link_libraries(EventSender ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl tcmalloc)
-target_link_libraries(EventSender ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl)
+target_link_libraries(EventSender ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS})
diff --git a/examples/cpp/MacProxy/CMakeLists.txt b/examples/cpp/MacProxy/CMakeLists.txt
index 04dfa5d01..082ee5fed 100644
--- a/examples/cpp/MacProxy/CMakeLists.txt
+++ b/examples/cpp/MacProxy/CMakeLists.txt
@@ -26,4 +26,4 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
set (PLATFORM_LIBS "atomic")
endif()
-target_link_libraries(MacProxy ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS} dl)
+target_link_libraries(MacProxy ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS})
diff --git a/examples/cpp/SampleCpp/CMakeLists.txt b/examples/cpp/SampleCpp/CMakeLists.txt
index bfa90995e..4cc763ceb 100644
--- a/examples/cpp/SampleCpp/CMakeLists.txt
+++ b/examples/cpp/SampleCpp/CMakeLists.txt
@@ -6,8 +6,10 @@ project(SampleCpp)
include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/MSTelemetrySample.cmake)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
+if(NOT MSVC)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
+endif()
find_package (Threads)
@@ -30,4 +32,4 @@ endif()
#target_link_libraries(SampleCpp ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS} dl tcmalloc)
# TODO: use add_library to allow linking against a proper exported SDK target
-target_link_libraries(SampleCpp ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS} dl)
+target_link_libraries(SampleCpp ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS})
diff --git a/examples/cpp/SampleCpp/SampleCpp.vcxproj b/examples/cpp/SampleCpp/SampleCpp.vcxproj
index a8548808f..39bf28e1c 100644
--- a/examples/cpp/SampleCpp/SampleCpp.vcxproj
+++ b/examples/cpp/SampleCpp/SampleCpp.vcxproj
@@ -244,7 +244,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
@@ -252,37 +252,37 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
@@ -290,19 +290,19 @@
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
@@ -310,37 +310,37 @@
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
@@ -348,13 +348,13 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
@@ -461,7 +461,7 @@
true
true
true
- wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
@@ -546,7 +546,7 @@
true
true
true
- wininet.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;%(AdditionalDependencies)
@@ -666,7 +666,7 @@
Console
true
- wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
@@ -818,7 +818,7 @@
Console
true
- wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
@@ -894,7 +894,7 @@
Console
true
- wininet.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;%(AdditionalDependencies)
@@ -1013,7 +1013,7 @@
true
true
true
- wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
@@ -1107,6 +1107,16 @@
{216a8e97-21f7-4bef-9e52-7f772c177c32}
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
diff --git a/examples/cpp/SampleCppLogManagers/SampleCppLogManagers.vcxproj b/examples/cpp/SampleCppLogManagers/SampleCppLogManagers.vcxproj
index 7f6b47434..def42ce22 100644
--- a/examples/cpp/SampleCppLogManagers/SampleCppLogManagers.vcxproj
+++ b/examples/cpp/SampleCppLogManagers/SampleCppLogManagers.vcxproj
@@ -67,7 +67,7 @@
true
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public;$(SolutionDir)\..\lib\pal\
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public;$(SolutionDir)\..\lib\pal\
$(ProjectDir)
$(Configuration)\
$(LibraryPath)
@@ -75,16 +75,16 @@
true
$(ProjectDir)
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public;$(SolutionDir)\..\lib\pal\
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public;$(SolutionDir)\..\lib\pal\
$(LibraryPath)
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)\..\..\..\lib\include\public
diff --git a/examples/cpp/SampleCppMini/CMakeLists.txt b/examples/cpp/SampleCppMini/CMakeLists.txt
index a2c33224f..181aff4ce 100644
--- a/examples/cpp/SampleCppMini/CMakeLists.txt
+++ b/examples/cpp/SampleCppMini/CMakeLists.txt
@@ -6,8 +6,10 @@ project(SampleCppMini)
include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/MSTelemetrySample.cmake)
-set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
+if(NOT MSVC)
+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
+endif()
find_package (Threads)
@@ -23,4 +25,4 @@ source_group(" " REGULAR_EXPRESSION "")
#tcmalloc turned off by default
#target_link_libraries(SampleCppMini ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl tcmalloc)
-target_link_libraries(SampleCppMini ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl)
+target_link_libraries(SampleCppMini ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS})
diff --git a/examples/cpp/SampleCppMini/SampleCppMini.vcxproj b/examples/cpp/SampleCppMini/SampleCppMini.vcxproj
index 424394f7e..82f12a487 100644
--- a/examples/cpp/SampleCppMini/SampleCppMini.vcxproj
+++ b/examples/cpp/SampleCppMini/SampleCppMini.vcxproj
@@ -262,7 +262,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
@@ -272,7 +272,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -280,7 +280,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -288,7 +288,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -296,7 +296,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -304,7 +304,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -312,7 +312,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
@@ -322,7 +322,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -330,7 +330,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -338,7 +338,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
@@ -348,7 +348,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -356,7 +356,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -364,7 +364,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -372,7 +372,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -380,7 +380,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -388,7 +388,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
@@ -398,7 +398,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -406,7 +406,7 @@
false
- $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\..\lib\include\public
+ $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\..\..\lib\include\public
true
@@ -430,7 +430,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -453,7 +453,7 @@
/merge:.rdata=.text
false
API-MS-WIN-CORE-WINRT-STRING-L1-1-0;API-MS-WIN-CORE-WINRT-L1-1-0
- wininet.lib;Crypt32.lib;
+ Crypt32.lib;
$(ProjectDir)\deploy-dll.cmd $(PlatformTarget) $(Configuration) $(OutDir)
@@ -486,7 +486,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -509,7 +509,7 @@
/merge:.rdata=.text
false
API-MS-WIN-CORE-WINRT-STRING-L1-1-0;API-MS-WIN-CORE-WINRT-L1-1-0
- wininet.lib;Crypt32.lib;
+ Crypt32.lib;
$(ProjectDir)\deploy-dll.cmd $(PlatformTarget) $(Configuration) $(OutDir)
@@ -549,7 +549,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -563,7 +563,7 @@
true
true
true
- wininet.lib;Crypt32.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
false
true
true
@@ -611,7 +611,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -626,7 +626,7 @@
true
true
true
- wininet.lib;Crypt32.lib;libcmt.lib;libvcruntime.lib;libucrt.lib;Version.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;libcmt.lib;libvcruntime.lib;libucrt.lib;Version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
true
false
true
@@ -675,7 +675,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -689,7 +689,7 @@
true
true
true
- wininet.lib;Crypt32.lib;wininet.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
+ Crypt32.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
false
true
true
@@ -737,7 +737,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -752,7 +752,7 @@
true
true
true
- wininet.lib;Crypt32.lib;libcmt.lib;libvcruntime.lib;libucrt.lib;Version.lib;wininet.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
+ Crypt32.lib;libcmt.lib;libvcruntime.lib;libucrt.lib;Version.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
true
false
true
@@ -802,7 +802,7 @@
Default
false
false
- false
+ Sync
Disabled
Size
false
@@ -824,7 +824,7 @@
/merge:.rdata=.text
false
API-MS-WIN-CORE-WINRT-STRING-L1-1-0;API-MS-WIN-CORE-WINRT-L1-1-0
- wininet.lib;Crypt32.lib;
+ Crypt32.lib;
$(ProjectDir)\deploy-dll.cmd $(PlatformTarget) $(Configuration) $(OutDir)
@@ -866,7 +866,7 @@
Default
false
false
- false
+ Sync
Disabled
Size
false
@@ -877,7 +877,7 @@
Console
true
- wininet.lib;Crypt32.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
false
true
true
@@ -930,7 +930,7 @@
Default
false
false
- false
+ Sync
Disabled
Size
false
@@ -941,7 +941,7 @@
Console
true
- wininet.lib;Crypt32.lib;libucrtd.lib;Version.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;libucrtd.lib;Version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
false
true
true
@@ -990,7 +990,7 @@
Default
false
false
- false
+ Sync
false
Disabled
Size
@@ -1014,7 +1014,7 @@
/merge:.rdata=.text
false
API-MS-WIN-CORE-WINRT-STRING-L1-1-0;API-MS-WIN-CORE-WINRT-L1-1-0
- wininet.lib;Crypt32.lib;
+ Crypt32.lib;
$(ProjectDir)\deploy-dll.cmd $(PlatformTarget) $(Configuration) $(OutDir)
@@ -1054,7 +1054,7 @@
Default
false
false
- false
+ Sync
false
Disabled
Size
@@ -1078,7 +1078,7 @@
/merge:.rdata=.text
false
API-MS-WIN-CORE-WINRT-STRING-L1-1-0;API-MS-WIN-CORE-WINRT-L1-1-0
- wininet.lib;Crypt32.lib;
+ Crypt32.lib;
$(ProjectDir)\deploy-dll.cmd $(PlatformTarget) $(Configuration) $(OutDir)
@@ -1119,7 +1119,7 @@
Default
false
false
- false
+ Sync
false
Disabled
Size
@@ -1132,7 +1132,7 @@
Console
true
- wininet.lib;Crypt32.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
false
true
true
@@ -1183,7 +1183,7 @@
Default
false
false
- false
+ Sync
false
Disabled
Size
@@ -1196,7 +1196,7 @@
Console
true
- wininet.lib;Crypt32.lib;libucrtd.lib;Version.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;libucrtd.lib;Version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
false
true
true
@@ -1246,7 +1246,7 @@
Default
false
false
- false
+ Sync
false
Disabled
Size
@@ -1259,7 +1259,7 @@
Console
true
- wininet.lib;Crypt32.lib;wininet.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
+ Crypt32.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
false
true
true
@@ -1310,7 +1310,7 @@
Default
false
false
- false
+ Sync
false
Disabled
Size
@@ -1323,7 +1323,7 @@
Console
true
- wininet.lib;Crypt32.lib;libucrtd.lib;Version.lib;wininet.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
+ Crypt32.lib;libucrtd.lib;Version.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)
false
true
true
@@ -1370,7 +1370,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -1394,7 +1394,7 @@
/merge:.rdata=.text
false
API-MS-WIN-CORE-WINRT-STRING-L1-1-0;API-MS-WIN-CORE-WINRT-L1-1-0
- wininet.lib;Crypt32.lib;
+ Crypt32.lib;
$(ProjectDir)\deploy-dll.cmd $(PlatformTarget) $(Configuration) $(OutDir)
@@ -1433,7 +1433,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -1448,7 +1448,7 @@
true
true
true
- wininet.lib;Crypt32.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
false
true
true
@@ -1496,7 +1496,7 @@
false
false
false
- false
+ Sync
false
Disabled
Size
@@ -1512,7 +1512,7 @@
true
true
true
- wininet.lib;Crypt32.lib;libcmt.lib;libvcruntime.lib;libucrt.lib;Version.lib;wininet.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
+ Crypt32.lib;libcmt.lib;libvcruntime.lib;libucrt.lib;Version.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
true
false
true
@@ -1548,16 +1548,26 @@
-
+
-
+
{1dc6b38a-b390-34ce-907f-4958807a3d43}
+
+
+ wininet.lib;%(AdditionalDependencies)
+
+
+
+
+ winhttp.lib;%(AdditionalDependencies)
+
+
diff --git a/examples/cpp/SampleCppUWP/SampleCppUWP.vcxproj b/examples/cpp/SampleCppUWP/SampleCppUWP.vcxproj
index a55fbf088..39c8649fe 100644
--- a/examples/cpp/SampleCppUWP/SampleCppUWP.vcxproj
+++ b/examples/cpp/SampleCppUWP/SampleCppUWP.vcxproj
@@ -134,7 +134,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)
Cdecl
true
@@ -146,7 +146,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)
Cdecl
true
@@ -159,7 +159,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)
MinSpace
Size
@@ -173,7 +173,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1;%(ClCompile.PreprocessorDefinitions)
MinSpace
Size
@@ -188,7 +188,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_UNICODE;UNICODE;%(PreprocessorDefinitions)
ProgramDatabase
Cdecl
@@ -204,7 +204,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_UNICODE;UNICODE;%(PreprocessorDefinitions)
MinSpace
Size
@@ -217,7 +217,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_UNICODE;UNICODE;%(PreprocessorDefinitions)
ProgramDatabase
Cdecl
@@ -229,7 +229,7 @@
/bigobj %(AdditionalOptions)
4453;28204
- $(SolutionDir)\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
+ $(ProjectDir)\..\..\..\lib\include\public;$(ProjectDir);$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories)
_UNICODE;UNICODE;%(PreprocessorDefinitions)
MinSpace
Size
diff --git a/examples/cs/SampleCsNet40/deploy-dll.cmd b/examples/cs/SampleCsNet40/deploy-dll.cmd
deleted file mode 100644
index 305a494a8..000000000
--- a/examples/cs/SampleCsNet40/deploy-dll.cmd
+++ /dev/null
@@ -1,2 +0,0 @@
-copy %3\..\net40\*.dll %3
-exit /b 0
diff --git a/examples/cs/SampleCsNet40/.gitignore b/examples/cs/SampleCsNet48/.gitignore
similarity index 100%
rename from examples/cs/SampleCsNet40/.gitignore
rename to examples/cs/SampleCsNet48/.gitignore
diff --git a/examples/cs/SampleCsNet40/App.config b/examples/cs/SampleCsNet48/App.config
similarity index 89%
rename from examples/cs/SampleCsNet40/App.config
rename to examples/cs/SampleCsNet48/App.config
index 357d2c97a..9dba31111 100644
--- a/examples/cs/SampleCsNet40/App.config
+++ b/examples/cs/SampleCsNet48/App.config
@@ -1,6 +1,6 @@
-
+
diff --git a/examples/cs/SampleCsNet40/Program.cs b/examples/cs/SampleCsNet48/Program.cs
similarity index 98%
rename from examples/cs/SampleCsNet40/Program.cs
rename to examples/cs/SampleCsNet48/Program.cs
index 12a5c38e0..9472ca10c 100644
--- a/examples/cs/SampleCsNet40/Program.cs
+++ b/examples/cs/SampleCsNet48/Program.cs
@@ -55,7 +55,7 @@ static void Main(string[] args)
for (int i = 0; i < 999; i++)
{
EventProperties props2 = new EventProperties("EventSimpleFromCSharpApp");
- props.SetProperty("EventSeqNum", Convert.ToString(i));
+ props2.SetProperty("EventSeqNum", Convert.ToString(i));
logger.LogEvent(props2);
}
diff --git a/examples/cs/SampleCsNet40/Properties/AssemblyInfo.cs b/examples/cs/SampleCsNet48/Properties/AssemblyInfo.cs
similarity index 93%
rename from examples/cs/SampleCsNet40/Properties/AssemblyInfo.cs
rename to examples/cs/SampleCsNet48/Properties/AssemblyInfo.cs
index e01acda76..65c23771c 100644
--- a/examples/cs/SampleCsNet40/Properties/AssemblyInfo.cs
+++ b/examples/cs/SampleCsNet48/Properties/AssemblyInfo.cs
@@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("SampleCsNet40")]
+[assembly: AssemblyTitle("SampleCsNet48")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft Corporation")]
-[assembly: AssemblyProduct("SampleCsNet40 Testapp")]
+[assembly: AssemblyProduct("SampleCsNet48 Testapp")]
[assembly: AssemblyCopyright("Copyright (c) Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
diff --git a/examples/cs/SampleCsNet40/Properties/Resources.Designer.cs b/examples/cs/SampleCsNet48/Properties/Resources.Designer.cs
similarity index 100%
rename from examples/cs/SampleCsNet40/Properties/Resources.Designer.cs
rename to examples/cs/SampleCsNet48/Properties/Resources.Designer.cs
diff --git a/examples/cs/SampleCsNet40/Properties/Resources.resx b/examples/cs/SampleCsNet48/Properties/Resources.resx
similarity index 100%
rename from examples/cs/SampleCsNet40/Properties/Resources.resx
rename to examples/cs/SampleCsNet48/Properties/Resources.resx
diff --git a/examples/cs/SampleCsNet40/Properties/Settings.Designer.cs b/examples/cs/SampleCsNet48/Properties/Settings.Designer.cs
similarity index 100%
rename from examples/cs/SampleCsNet40/Properties/Settings.Designer.cs
rename to examples/cs/SampleCsNet48/Properties/Settings.Designer.cs
diff --git a/examples/cs/SampleCsNet40/Properties/Settings.settings b/examples/cs/SampleCsNet48/Properties/Settings.settings
similarity index 100%
rename from examples/cs/SampleCsNet40/Properties/Settings.settings
rename to examples/cs/SampleCsNet48/Properties/Settings.settings
diff --git a/examples/cs/SampleCsNet40/SampleCsNet40.csproj b/examples/cs/SampleCsNet48/SampleCsNet48.csproj
similarity index 90%
rename from examples/cs/SampleCsNet40/SampleCsNet40.csproj
rename to examples/cs/SampleCsNet48/SampleCsNet48.csproj
index 5d30599df..ae7203c18 100644
--- a/examples/cs/SampleCsNet40/SampleCsNet40.csproj
+++ b/examples/cs/SampleCsNet48/SampleCsNet48.csproj
@@ -10,8 +10,8 @@
Exe
Properties
CLI
- SampleCsNet40
- v4.0
+ SampleCsNet48
+ v4.8
512
false
@@ -43,7 +43,7 @@
prompt
MinimumRecommendedRules.ruleset
true
- v4.0
+ v4.8
true
true
.\
@@ -56,7 +56,7 @@
prompt
MinimumRecommendedRules.ruleset
true
- v4.0
+ v4.8
.\
@@ -67,7 +67,7 @@
prompt
MinimumRecommendedRules.ruleset
false
- v4.0
+ v4.8
bin\
@@ -79,7 +79,7 @@
MinimumRecommendedRules.ruleset
false
true
- v4.0
+ v4.8
bin\
@@ -114,9 +114,9 @@
-
+
False
- Microsoft .NET Framework 4 %28x86 and x64%29
+ Microsoft .NET Framework 4.8 %28x86 and x64%29
true
@@ -132,15 +132,15 @@
- C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.CSharp.dll
+ C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.8\Microsoft.CSharp.dll
-
-
+
+
{dc91621e-a203-42df-8e03-3a23dd0602b1}
- net40
+ net48
diff --git a/examples/cs/SampleCsNet48/deploy-dll.cmd b/examples/cs/SampleCsNet48/deploy-dll.cmd
new file mode 100644
index 000000000..a5a02644a
--- /dev/null
+++ b/examples/cs/SampleCsNet48/deploy-dll.cmd
@@ -0,0 +1,2 @@
+copy %3\..\net48\*.dll %3
+exit /b 0
diff --git a/examples/cs/SampleCsNet40/packages.config b/examples/cs/SampleCsNet48/packages.config
similarity index 100%
rename from examples/cs/SampleCsNet40/packages.config
rename to examples/cs/SampleCsNet48/packages.config
diff --git a/examples/cs/SampleCsUWP/SampleCsUWP.csproj b/examples/cs/SampleCsUWP/SampleCsUWP.csproj
index 4c73a88f9..c488e2bdc 100644
--- a/examples/cs/SampleCsUWP/SampleCsUWP.csproj
+++ b/examples/cs/SampleCsUWP/SampleCsUWP.csproj
@@ -11,7 +11,7 @@
SampleCsUWP
en-US
UAP
- 10.0.17763.0
+ 10.0.22621.0
10.0.10240.0
14
512
diff --git a/examples/objc/cocoa-app/CMakeLists.txt b/examples/objc/cocoa-app/CMakeLists.txt
index 353098e92..70285039a 100644
--- a/examples/objc/cocoa-app/CMakeLists.txt
+++ b/examples/objc/cocoa-app/CMakeLists.txt
@@ -42,4 +42,4 @@ set_target_properties(
${CMAKE_CURRENT_LIST_DIR}/plist.in
)
-target_link_libraries(foo ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS} dl)
+target_link_libraries(foo ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS})
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 29d56105e..321ed6b8c 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -85,6 +85,8 @@ endif()
# Support for Azure Monitor / Application Insights
if(MATSDK_BUILD_AZMON)
include(modules/azmon/CMakeLists.txt OPTIONAL)
+else()
+ target_compile_definitions(matsdk_internal_config INTERFACE MATSDK_NO_AZMON)
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/modules/exp/")
@@ -299,9 +301,24 @@ target_compile_definitions(matsdk_internal_config INTERFACE
_USRDLL
WINVER=_WIN32_WINNT_WIN7)
target_compile_options(matsdk_internal_config INTERFACE /U_MBCS)
+if(MATSDK_USE_WININET)
+ target_compile_definitions(matsdk_internal_config INTERFACE HAVE_MAT_WININET_HTTP_CLIENT)
+else()
+ target_compile_definitions(matsdk_internal_config INTERFACE HAVE_MAT_WINHTTP_HTTP_CLIENT)
+endif()
+if(MATSDK_USE_WININET)
list(APPEND SRCS
http/HttpClient_WinInet.cpp
http/HttpClient_WinInet.hpp
+ )
+else()
+ list(APPEND SRCS
+ http/HttpClient_WinHttp.cpp
+ http/HttpClient_WinHttp.hpp
+ http/IBoundedHttpClientCancel.hpp
+ )
+endif()
+ list(APPEND SRCS
pal/desktop/WindowsDesktopDeviceInformationImpl.cpp
pal/desktop/WindowsDesktopNetworkInformationImpl.cpp
pal/desktop/WindowsDesktopSystemInformationImpl.cpp
@@ -666,7 +683,12 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "Android")
target_link_libraries(mat PUBLIC log)
endif()
elseif(PAL_IMPLEMENTATION STREQUAL "WIN32")
- target_link_libraries(mat PUBLIC wininet crypt32 ws2_32)
+ if(MATSDK_USE_WININET)
+ target_link_libraries(mat PRIVATE wininet)
+ else()
+ target_link_libraries(mat PRIVATE winhttp)
+ endif()
+ target_link_libraries(mat PRIVATE crypt32)
elseif(APPLE)
target_link_libraries(mat PUBLIC
"-framework CoreFoundation"
diff --git a/lib/android_build/app/src/androidTest/java/com/microsoft/applications/events/maesdktest/SDKUnitNativeTest.java b/lib/android_build/app/src/androidTest/java/com/microsoft/applications/events/maesdktest/SDKUnitNativeTest.java
index 95118242d..648b66eff 100644
--- a/lib/android_build/app/src/androidTest/java/com/microsoft/applications/events/maesdktest/SDKUnitNativeTest.java
+++ b/lib/android_build/app/src/androidTest/java/com/microsoft/applications/events/maesdktest/SDKUnitNativeTest.java
@@ -260,7 +260,8 @@ public void runNativeTests() {
OfflineRoom.connectContext(appContext);
TestStub stub = new TestStub();
- int result = stub.runNativeTests(this);
+ int result =
+ stub.runNativeTests(this, client, appContext, System.getProperty("java.io.tmpdir"));
assertEquals(0, result);
Log.i("MAE", "Test finished");
}
diff --git a/lib/android_build/app/src/main/cpp/native-lib.cpp b/lib/android_build/app/src/main/cpp/native-lib.cpp
index 1cffaa805..407a32d3f 100644
--- a/lib/android_build/app/src/main/cpp/native-lib.cpp
+++ b/lib/android_build/app/src/main/cpp/native-lib.cpp
@@ -10,6 +10,10 @@
#include "LogManager.hpp"
#include "api/LogManagerImpl.hpp"
+#include "config/RuntimeConfig_Default.hpp"
+#include "http/HttpClient_Android.hpp"
+#include "offline/OfflineStorage_Room.hpp"
+#include "pal/PAL.hpp"
LOGMANAGER_INSTANCE
@@ -114,13 +118,14 @@ int RunTests::run_all_tests(JNIEnv* env, jobject java_logger)
{
int argc = 2;
char command_name[] = "maesdk-test";
- char filter[] = "--gtest_filter=*";
+ // Java HTTP callbacks target the AAR's shared SDK, not this test binary's
+ // private static SDK copy. Exercise that transport through instrumentation.
+ char filter[] = "--gtest_filter=-HttpClientTests.*";
char* argv[] = {command_name, filter};
::testing::InitGoogleTest(&argc, argv);
::testing::TestEventListeners& listeners =
::testing::UnitTest::GetInstance()->listeners();
listeners.Append(new AndroidLogger(env, java_logger));
- auto logger = Microsoft::Applications::Events::LogManager::Initialize("0123456789abcdef0123456789abcdef-01234567-0123-0123-0123-0123456789ab-0123");
return RUN_ALL_TESTS();
}
@@ -129,9 +134,27 @@ extern "C" JNIEXPORT jint JNICALL
Java_com_microsoft_applications_events_maesdktest_TestStub_runNativeTests(
JNIEnv* env,
jobject /* stub */,
- jobject logger)
+ jobject logger,
+ jobject http_client,
+ jobject app_context,
+ jstring cache_file_path)
{
- return RunTests::run_all_tests(env, logger);
+ auto path = env->GetStringUTFChars(cache_file_path, nullptr);
+ Microsoft::Applications::Events::HttpClient_Android::SetCacheFilePath(path);
+ env->ReleaseStringUTFChars(cache_file_path, path);
+ Microsoft::Applications::Events::HttpClient_Android::CreateClientInstance(env, http_client);
+ Microsoft::Applications::Events::OfflineStorage_Room::ConnectJVM(env, app_context);
+
+ JavaVM* java_vm = nullptr;
+ env->GetJavaVM(&java_vm);
+ Microsoft::Applications::Events::ILogConfiguration pal_config;
+ pal_config[CFG_PTR_ANDROID_JVM] = static_cast(java_vm);
+ pal_config[CFG_JOBJECT_ANDROID_ACTIVITY] = reinterpret_cast(app_context);
+ Microsoft::Applications::Events::RuntimeConfig_Default runtime_config(pal_config);
+ PAL::GetPAL().initialize(runtime_config);
+ const int result = RunTests::run_all_tests(env, logger);
+ PAL::GetPAL().shutdown();
+ return result;
}
@@ -154,4 +177,3 @@ Java_com_microsoft_applications_events_maesdktest_SDKUnitNativeTest_nativeGetDat
auto property = GetEventProperty(env, jProperty);
return static_cast(property.dataCategory);
}
-
diff --git a/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/MainActivity.java b/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/MainActivity.java
index 7159f10a6..73cbf59e7 100644
--- a/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/MainActivity.java
+++ b/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/MainActivity.java
@@ -44,7 +44,8 @@ protected void onCreate(Bundle savedInstanceState) {
// Example of a call to a native method
TextView tv = findViewById(R.id.sample_text);
try {
- Integer result = testStub.executorRun(dummyLogger);
+ Integer result =
+ testStub.executorRun(dummyLogger, m_client, getApplicationContext());
tv.setText(String.format(Locale.ROOT, "Tests returned %d", result));
} catch (ExecutionException e) {
tv.setText("Woopsy");
@@ -53,4 +54,3 @@ protected void onCreate(Bundle savedInstanceState) {
}
}
}
-
diff --git a/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/TestStub.java b/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/TestStub.java
index f224933b8..c25f1896e 100644
--- a/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/TestStub.java
+++ b/lib/android_build/app/src/main/java/com/microsoft/applications/events/maesdktest/TestStub.java
@@ -4,6 +4,8 @@
//
package com.microsoft.applications.events.maesdktest;
+import android.content.Context;
+import com.microsoft.applications.events.HttpClient;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@@ -13,9 +15,13 @@
public class TestStub {
class CallTests implements Callable {
MaeUnitLogger logger;
+ HttpClient httpClient;
+ Context appContext;
- CallTests(MaeUnitLogger logger) {
+ CallTests(MaeUnitLogger logger, HttpClient httpClient, Context appContext) {
this.logger = logger;
+ this.httpClient = httpClient;
+ this.appContext = appContext;
}
/**
@@ -26,17 +32,21 @@ class CallTests implements Callable {
*/
@Override
public Integer call() throws Exception {
- return Integer.valueOf(runNativeTests(logger));
+ return Integer.valueOf(
+ runNativeTests(logger, httpClient, appContext, System.getProperty("java.io.tmpdir")));
}
}
- public Integer executorRun(MaeUnitLogger logger) throws ExecutionException, InterruptedException {
+ public Integer executorRun(MaeUnitLogger logger, HttpClient httpClient, Context appContext)
+ throws ExecutionException, InterruptedException {
ExecutorService executorService = Executors.newFixedThreadPool(2);
- FutureTask tests = new FutureTask(new CallTests(logger));
+ FutureTask tests =
+ new FutureTask(new CallTests(logger, httpClient, appContext));
executorService.execute(tests);
return tests.get();
}
- public native int runNativeTests(MaeUnitLogger logger);
+ public native int runNativeTests(
+ MaeUnitLogger logger, HttpClient httpClient, Context appContext, String cacheFilePath);
}
diff --git a/lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/LogConfigurationKey.java b/lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/LogConfigurationKey.java
index 0ce2881ef..b7abb002d 100644
--- a/lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/LogConfigurationKey.java
+++ b/lib/android_build/maesdk/src/main/java/com/microsoft/applications/events/LogConfigurationKey.java
@@ -23,6 +23,9 @@ public enum LogConfigurationKey {
/** Enable database compression. */
CFG_BOOL_ENABLE_DB_COMPRESS("enableDBCompression", Boolean.class),
+ /** Batch records when flushing the RAM queue to disk storage. */
+ CFG_BOOL_ENABLE_BATCHED_STORAGE_FLUSH("enableBatchedStorageFlush", Boolean.class),
+
/** Enable WAL journal. */
CFG_BOOL_ENABLE_WAL_JOURNAL("enableWALJournal", Boolean.class),
@@ -187,4 +190,3 @@ public Class getValueType() {
return valueType;
}
}
-
diff --git a/lib/api/LogConfiguration.cpp b/lib/api/LogConfiguration.cpp
index 23a7e53cd..0eb6581b2 100644
--- a/lib/api/LogConfiguration.cpp
+++ b/lib/api/LogConfiguration.cpp
@@ -19,6 +19,7 @@ namespace MAT_NS_BEGIN {
{ CFG_BOOL_ENABLE_ANALYTICS, false },
{ CFG_INT_CACHE_FILE_SIZE, 3145728 },
{ CFG_INT_RAM_QUEUE_SIZE, 524288 },
+ { CFG_BOOL_ENABLE_BATCHED_STORAGE_FLUSH, true },
{ CFG_BOOL_ENABLE_MULTITENANT, true },
{ CFG_BOOL_ENABLE_DB_DROP_IF_FULL, false },
{ CFG_INT_MAX_TEARDOWN_TIME, 0 },
@@ -51,6 +52,7 @@ namespace MAT_NS_BEGIN {
{ CFG_BOOL_ENABLE_ANALYTICS, src.enableLifecycleSession },
{ CFG_INT_CACHE_FILE_SIZE, src.cacheFileSizeLimitInBytes },
{ CFG_INT_RAM_QUEUE_SIZE, src.cacheMemorySizeLimitInBytes },
+ { CFG_BOOL_ENABLE_BATCHED_STORAGE_FLUSH, true },
{ CFG_BOOL_ENABLE_MULTITENANT, src.multiTenantEnabled },
{ CFG_INT_MAX_TEARDOWN_TIME, src.maxTeardownUploadTimeInSec },
{ CFG_INT_MAX_PENDING_REQ, src.maxPendingHTTPRequests },
@@ -128,4 +130,3 @@ namespace MAT_NS_BEGIN {
}
} MAT_NS_END
-
diff --git a/lib/api/LogManagerFactory.hpp b/lib/api/LogManagerFactory.hpp
index 5e26267d8..63adfb646 100644
--- a/lib/api/LogManagerFactory.hpp
+++ b/lib/api/LogManagerFactory.hpp
@@ -67,7 +67,15 @@ namespace MAT_NS_BEGIN {
// C++11 Magic Statics (N2660)
static LogManagerFactory& instance() {
- static LogManagerFactory impl;
+ // Deliberately never destroyed. LogManagerProvider::Release() must be
+ // able to walk this factory's registries during process teardown, but
+ // a normal function-local static's destruction order relative to that
+ // teardown call is unspecified -- if this were destroyed first,
+ // Release() would walk already-freed std::map nodes (a downstream
+ // consumer observed this as EXC_BAD_ACCESS in release() at process
+ // exit). Leaking one small, fixed-size object avoids the ordering
+ // hazard entirely; the OS reclaims it when the process exits.
+ static LogManagerFactory& impl = *new LogManagerFactory();
return impl;
}
diff --git a/lib/api/LogManagerImpl.cpp b/lib/api/LogManagerImpl.cpp
index 24215c0cd..dd943fd6c 100644
--- a/lib/api/LogManagerImpl.cpp
+++ b/lib/api/LogManagerImpl.cpp
@@ -2,11 +2,17 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
//
-#ifdef _MSC_VER
-// evntprov.h(838) : warning C4459 : declaration of 'Version' hides global declaration
-#pragma warning(disable : 4459)
+#ifdef _WIN32
+// Include the SDK declaration before the telemetry Version symbol enters scope.
+#ifndef WIN32_LEAN_AND_MEAN
+#define WIN32_LEAN_AND_MEAN
+#endif
+#include
+#include
#endif
#include "LogManagerImpl.hpp"
+#include
+#include "ctmacros.hpp"
#include "mat/config.h"
#include "offline/LogSessionDataProvider.hpp"
@@ -289,6 +295,11 @@ namespace MAT_NS_BEGIN
if (m_httpClient == nullptr)
{
m_httpClient = HttpClientFactory::Create();
+ if (m_httpClient == nullptr)
+ {
+ LOG_ERROR("The default HTTP client has not been initialized.");
+ MATSDK_THROW(std::invalid_argument("configuration"));
+ }
m_httpClient->ApplySettings(m_logConfiguration);
}
else
@@ -368,9 +379,31 @@ namespace MAT_NS_BEGIN
LogManagerImpl::~LogManagerImpl() noexcept
{
- FlushAndTeardown();
- LOCKGUARD(ILogManagerInternal::managers_lock);
- ILogManagerInternal::managers.erase(this);
+ MATSDK_TRY
+ {
+ FlushAndTeardown();
+ }
+#if HAVE_EXCEPTIONS
+ MATSDK_CATCH(const std::exception& e)
+ {
+ std::fprintf(stderr, "Log manager teardown failed: %s\n", e.what());
+ }
+ MATSDK_CATCH(...)
+ {
+ std::fputs("Log manager teardown failed with an unknown exception\n", stderr);
+ }
+#endif
+ MATSDK_TRY
+ {
+ LOCKGUARD(ILogManagerInternal::managers_lock);
+ ILogManagerInternal::managers.erase(this);
+ }
+#if HAVE_EXCEPTIONS
+ MATSDK_CATCH(...)
+ {
+ std::fputs("Log manager registry cleanup failed\n", stderr);
+ }
+#endif
}
size_t LogManagerImpl::GetDeadLoggerCount()
@@ -959,20 +992,33 @@ namespace MAT_NS_BEGIN
return true;
}
- void LogManagerImpl::EndActivity()
+ void LogManagerImpl::EndActivity() noexcept
{
- std::unique_lock lock(m_pause_mutex);
- if (m_pause_active_count == 0) {
- return;
+ MATSDK_TRY
+ {
+ std::unique_lock lock(m_pause_mutex);
+ if (m_pause_active_count == 0) {
+ return;
+ }
+ m_pause_active_count -= 1;
+ if (m_pause_active_count > 0) {
+ return;
+ }
+ if (m_pause_state == PauseState::Pausing) {
+ m_pause_state = PauseState::Paused;
+ m_pause_cv.notify_all();
+ }
}
- m_pause_active_count -= 1;
- if (m_pause_active_count > 0) {
- return;
+#if HAVE_EXCEPTIONS
+ MATSDK_CATCH(const std::exception& e)
+ {
+ std::fprintf(stderr, "Failed to end telemetry activity: %s\n", e.what());
}
- if (m_pause_state == PauseState::Pausing) {
- m_pause_state = PauseState::Paused;
- m_pause_cv.notify_all();
+ MATSDK_CATCH(...)
+ {
+ std::fputs("Failed to end telemetry activity\n", stderr);
}
+#endif
}
}
MAT_NS_END
diff --git a/lib/api/LogManagerImpl.hpp b/lib/api/LogManagerImpl.hpp
index 7dd7f7442..75e062868 100644
--- a/lib/api/LogManagerImpl.hpp
+++ b/lib/api/LogManagerImpl.hpp
@@ -306,7 +306,7 @@ namespace MAT_NS_BEGIN
virtual void ResumeActivity() override;
virtual void WaitPause() override;
virtual bool StartActivity() override;
- virtual void EndActivity() override;
+ virtual void EndActivity() noexcept override;
protected:
std::unique_ptr& GetSystem();
diff --git a/lib/api/Logger.cpp b/lib/api/Logger.cpp
index aec4b9e52..75d3bd292 100644
--- a/lib/api/Logger.cpp
+++ b/lib/api/Logger.cpp
@@ -127,7 +127,8 @@ namespace MAT_NS_BEGIN
Logger::~Logger() noexcept
{
- LOG_TRACE("%p: Destroyed", this);
+ // Intentionally empty — logging here triggers a static-destruction-order
+ // crash on iOS simulator (recursive_mutex used after teardown).
}
ISemanticContext* Logger::GetSemanticContext() const
diff --git a/lib/config/RuntimeConfig_Default.hpp b/lib/config/RuntimeConfig_Default.hpp
index 504aeefe3..ecd6e079a 100644
--- a/lib/config/RuntimeConfig_Default.hpp
+++ b/lib/config/RuntimeConfig_Default.hpp
@@ -16,6 +16,7 @@ namespace MAT_NS_BEGIN
{CFG_BOOL_ENABLE_ANALYTICS, false},
{CFG_INT_CACHE_FILE_SIZE, 3145728},
{CFG_INT_RAM_QUEUE_SIZE, 524288},
+ {CFG_BOOL_ENABLE_BATCHED_STORAGE_FLUSH, true},
{CFG_BOOL_ENABLE_MULTITENANT, true},
{CFG_BOOL_ENABLE_DB_DROP_IF_FULL, false},
{CFG_INT_MAX_TEARDOWN_TIME, 1},
@@ -61,7 +62,7 @@ namespace MAT_NS_BEGIN
{"contentEncoding", "deflate"},
/* Optional parameter to require Microsoft Root CA */
{CFG_BOOL_HTTP_MS_ROOT_CHECK, false},
- /* Optional parameter for SSL certificate verification (curl) */
+ /* Compatibility parameter; curl verification cannot be disabled */
{CFG_BOOL_HTTP_SSL_VERIFY, true},
/* Optional CA bundle path for OpenSSL-backed curl */
{CFG_STR_HTTP_SSL_CAINFO, ""}}},
@@ -233,4 +234,3 @@ namespace MAT_NS_BEGIN
}
MAT_NS_END
-
diff --git a/lib/filter/EventFilterCollection.cpp b/lib/filter/EventFilterCollection.cpp
index f6387e99e..092f7ae5b 100644
--- a/lib/filter/EventFilterCollection.cpp
+++ b/lib/filter/EventFilterCollection.cpp
@@ -18,9 +18,17 @@ namespace MAT_NS_BEGIN
if (filter == nullptr)
MATSDK_THROW(std::invalid_argument("filter"));
- std::lock_guard lock(m_filterLock);
- m_filters.emplace_back(std::move(filter));
- m_size = m_filters.size();
+ std::shared_ptr sharedFilter(std::move(filter));
+ {
+ std::lock_guard lock(m_filterLock);
+ auto current = std::atomic_load(&m_filters);
+ auto updated = std::make_shared(
+ current == nullptr ? FilterList{} : *current);
+ updated->emplace_back(std::move(sharedFilter));
+ std::atomic_store(
+ &m_filters,
+ std::shared_ptr(std::move(updated)));
+ }
}
void EventFilterCollection::UnregisterEventFilter(const char* filterName)
@@ -28,33 +36,52 @@ namespace MAT_NS_BEGIN
if (filterName == nullptr)
MATSDK_THROW(std::invalid_argument("filterName"));
- std::lock_guard lock(m_filterLock);
- m_filters.erase(
- std::remove_if(m_filters.begin(), m_filters.end(),
- [filterName](const std::unique_ptr& filter) noexcept
- {
- return strcmp(filter->GetName(), filterName) == 0;
- }),
- m_filters.end());
- m_size = m_filters.size();
+ std::shared_ptr removedFilters;
+ {
+ std::lock_guard lock(m_filterLock);
+ auto current = std::atomic_load(&m_filters);
+ if (current == nullptr)
+ {
+ return;
+ }
+
+ auto updated = std::make_shared(*current);
+ updated->erase(
+ std::remove_if(updated->begin(), updated->end(),
+ [filterName](const std::shared_ptr& filter) noexcept
+ {
+ return strcmp(filter->GetName(), filterName) == 0;
+ }),
+ updated->end());
+ if (updated->size() == current->size())
+ {
+ return;
+ }
+
+ removedFilters = std::move(current);
+ std::atomic_store(
+ &m_filters,
+ updated->empty()
+ ? std::shared_ptr{}
+ : std::shared_ptr(std::move(updated)));
+ }
}
void EventFilterCollection::UnregisterAllFilters() noexcept
{
- std::lock_guard lock(m_filterLock);
- std::vector>{}.swap(m_filters);
- m_size = 0;
+ std::shared_ptr removedFilters;
+ {
+ std::lock_guard lock(m_filterLock);
+ removedFilters = std::atomic_exchange(
+ &m_filters, std::shared_ptr{});
+ }
}
bool EventFilterCollection::CanEventPropertiesBeSent(const EventProperties& properties) const noexcept
{
- if (Empty())
- {
- return true;
- }
- std::lock_guard lock(m_filterLock);
- return std::all_of(m_filters.cbegin(), m_filters.cend(),
- [&properties](const std::unique_ptr& filter)
+ auto filters = std::atomic_load(&m_filters);
+ return filters == nullptr || std::all_of(filters->cbegin(), filters->cend(),
+ [&properties](const std::shared_ptr& filter)
{
return filter->CanEventPropertiesBeSent(properties);
});
@@ -62,12 +89,13 @@ namespace MAT_NS_BEGIN
size_t EventFilterCollection::Size() const noexcept
{
- return m_size.load();
+ auto filters = std::atomic_load(&m_filters);
+ return filters == nullptr ? 0 : filters->size();
}
bool EventFilterCollection::Empty() const noexcept
{
- return (Size() == 0);
+ return Size() == 0;
}
} MAT_NS_END
diff --git a/lib/filter/EventFilterCollection.hpp b/lib/filter/EventFilterCollection.hpp
index 3c3efcebc..dc59e7409 100644
--- a/lib/filter/EventFilterCollection.hpp
+++ b/lib/filter/EventFilterCollection.hpp
@@ -11,7 +11,6 @@
#include
#include
#include
-#include
namespace MAT_NS_BEGIN
{
@@ -26,9 +25,10 @@ namespace MAT_NS_BEGIN
virtual bool Empty() const noexcept override;
protected:
- std::atomic m_size { 0 };
+ using FilterList = std::vector>;
+
mutable std::mutex m_filterLock;
- std::vector> m_filters;
+ std::shared_ptr m_filters;
};
} MAT_NS_END
diff --git a/lib/http/HttpClientFactory.cpp b/lib/http/HttpClientFactory.cpp
index 5419f161d..b58175e1a 100644
--- a/lib/http/HttpClientFactory.cpp
+++ b/lib/http/HttpClientFactory.cpp
@@ -18,6 +18,8 @@
#include "http/HttpClient_WinRt.hpp"
#elif defined(HAVE_MAT_WININET_HTTP_CLIENT)
#include "http/HttpClient_WinInet.hpp"
+ #elif defined(HAVE_MAT_WINHTTP_HTTP_CLIENT)
+ #include "http/HttpClient_WinHttp.hpp"
#endif
#elif defined(MATSDK_PAL_CPP11)
#if TARGET_OS_IPHONE || (defined(__APPLE__) && defined(APPLE_HTTP))
@@ -49,6 +51,13 @@ namespace MAT_NS_BEGIN {
return std::make_shared();
}
+#elif defined(HAVE_MAT_WINHTTP_HTTP_CLIENT)
+ /* Win32 WinHTTP client (default) */
+ std::shared_ptr HttpClientFactory::Create() {
+ LOG_TRACE("Creating HttpClient_WinHttp");
+ return std::make_shared();
+ }
+
#endif
#elif defined(HAVE_MAT_CURL_HTTP_CLIENT)
std::shared_ptr HttpClientFactory::Create() {
diff --git a/lib/http/HttpClientFactory.hpp b/lib/http/HttpClientFactory.hpp
index c96bc2ab0..ae1fb9681 100644
--- a/lib/http/HttpClientFactory.hpp
+++ b/lib/http/HttpClientFactory.hpp
@@ -25,8 +25,22 @@ class HttpClientFactory
// TODO: [maxgolov] - remove this once there is a better way to pass HTTP client configuration
#if defined(MATSDK_PAL_WIN32) && !defined(_WINRT_DLL)
-#define HAVE_MAT_WININET_HTTP_CLIENT
-#include "http/HttpClient_WinInet.hpp"
+ #if defined(HAVE_MAT_WININET_HTTP_CLIENT) && defined(HAVE_MAT_WINHTTP_HTTP_CLIENT)
+ #error WinInet and WinHTTP cannot both be selected.
+ #endif
+ #if defined(HAVE_MAT_WININET_HTTP_CLIENT)
+ #include "http/HttpClient_WinInet.hpp"
+ #else
+ // WinHTTP is the default Win32 desktop transport: unlike WinInet, it does
+ // not depend on a logged-on interactive user or that user's Internet
+ // Explorer settings, so it works in services and other non-interactive
+ // processes without extra configuration. Define HAVE_MAT_WININET_HTTP_CLIENT
+ // to opt back into WinInet (e.g. for IE-integrated proxy/cookie behavior).
+ #ifndef HAVE_MAT_WINHTTP_HTTP_CLIENT
+ #define HAVE_MAT_WINHTTP_HTTP_CLIENT
+ #endif
+ #include "http/HttpClient_WinHttp.hpp"
+ #endif
#endif
#endif // HAVE_MAT_DEFAULT_HTTP_CLIENT
diff --git a/lib/http/HttpClientManager.cpp b/lib/http/HttpClientManager.cpp
index 3c7d1f809..c449d2aad 100644
--- a/lib/http/HttpClientManager.cpp
+++ b/lib/http/HttpClientManager.cpp
@@ -10,8 +10,14 @@
#include
#include
+#include
#include
+#include
+#include
+#include
+#include
#include
+#include
#include
#ifdef linux
@@ -35,15 +41,49 @@ namespace MAT_NS_BEGIN {
class HttpClientManager::HttpCallback : public IHttpResponseCallback
{
public:
+ struct CompletionState
+ {
+ explicit CompletionState(std::string id)
+ : requestId(std::move(id))
+ {
+ }
+
+ bool TryStartTerminal() noexcept
+ {
+ bool expected = false;
+ return terminalStarted.compare_exchange_strong(expected, true);
+ }
+
+ std::atomic terminalStarted{false};
+ std::string const requestId;
+ };
HttpCallback(HttpClientManager& hcm, EventsUploadContextPtr const& ctx)
: m_hcm(hcm),
m_ctx(ctx),
- m_startTime(PAL::getMonotonicTimeMs())
+ m_startTime(PAL::getMonotonicTimeMs()),
+ m_completion(std::make_shared(
+ !ctx->httpRequestId.empty()
+ ? ctx->httpRequestId
+ : (ctx->httpRequest != nullptr
+ ? ctx->httpRequest->GetId()
+ : std::string())))
{
}
virtual void OnHttpResponse(IHttpResponse* response) override
+ {
+ std::unique_ptr ownedResponse(response);
+ if (!m_completion->TryStartTerminal())
+ {
+ LOG_ERROR("Ignoring duplicate terminal HTTP callback for request %s",
+ m_completion->requestId.c_str());
+ return;
+ }
+ CompleteClaimed(ownedResponse.release());
+ }
+
+ void CompleteClaimed(IHttpResponse* response)
{
m_ctx->durationMs = static_cast(PAL::getMonotonicTimeMs() - m_startTime);
m_ctx->httpResponse = response;
@@ -77,6 +117,7 @@ namespace MAT_NS_BEGIN {
HttpClientManager& m_hcm;
EventsUploadContextPtr m_ctx;
int64_t m_startTime;
+ std::shared_ptr m_completion;
};
//---
@@ -86,16 +127,39 @@ namespace MAT_NS_BEGIN {
m_httpClient(httpClient),
m_taskDispatcher(taskDispatcher)
{
+ int64_t configuredSeconds =
+ logManager.GetLogConfiguration()[CFG_INT_MAX_TEARDOWN_TIME];
+ if (configuredSeconds > 0)
+ {
+ int64_t const maxSeconds =
+ std::chrono::milliseconds::max().count() / 1000;
+ m_cancelDrainTimeout = std::chrono::seconds(
+ std::min(configuredSeconds, maxSeconds));
+ }
}
HttpClientManager::~HttpClientManager() noexcept
{
- cancelAllRequestsAsync();
+ // HttpCallback and scheduled response tasks retain a reference to this
+ // manager, so non-reentrant destruction must be a full callback lifetime
+ // barrier. Reentrant destruction is unsupported because the active
+ // callback itself must still unwind through this object.
+#ifndef NDEBUG
+ {
+ std::lock_guard lock(m_httpCallbacksMtx);
+ for (auto const& active : m_activeHttpCallbacks)
+ {
+ assert(active.second != std::this_thread::get_id());
+ }
+ }
+#endif
+ cancelAllRequests();
}
void HttpClientManager::handleSendRequest(EventsUploadContextPtr const& ctx)
{
HttpCallback *callback = new HttpCallback(*this, ctx);
+ auto completion = callback->m_completion;
{
LOCKGUARD(m_httpCallbacksMtx);
m_httpCallbacks.push_back(callback);
@@ -105,47 +169,185 @@ namespace MAT_NS_BEGIN {
static_cast(ctx->recordIdsAndTenantIds.size()), ctx->latency, latencyToStr(ctx->latency), static_cast(ctx->packageIds.size()),
ctx->httpRequest->GetId().c_str(), static_cast(ctx->httpRequest->GetSizeEstimate()));
+#if HAVE_EXCEPTIONS
+ try
+ {
+ m_httpClient.SendRequestAsync(ctx->httpRequest, callback);
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("HTTP client rejected request %s with an exception: %s",
+ completion->requestId.c_str(), ex.what());
+ if (completion->TryStartTerminal())
+ {
+ callback->CompleteClaimed(
+ new SimpleHttpResponse(completion->requestId));
+ }
+ }
+ catch (...)
+ {
+ LOG_ERROR("HTTP client rejected request %s with a non-standard exception",
+ completion->requestId.c_str());
+ if (completion->TryStartTerminal())
+ {
+ callback->CompleteClaimed(
+ new SimpleHttpResponse(completion->requestId));
+ }
+ }
+#else
m_httpClient.SendRequestAsync(ctx->httpRequest, callback);
+#endif
}
void HttpClientManager::scheduleOnHttpResponse(HttpCallback* callback)
{
- PAL::scheduleTask(&m_taskDispatcher, 0, this, &HttpClientManager::onHttpResponse, callback);
+ auto started = std::make_shared>(false);
+#if HAVE_EXCEPTIONS
+ try
+ {
+#endif
+ auto task = PAL::scheduleTask(
+ &m_taskDispatcher, 0, this,
+ &HttpClientManager::runScheduledHttpResponse, started, callback);
+ if (task.GetTask() != nullptr ||
+ started->load(std::memory_order_acquire))
+ {
+ return;
+ }
+#if HAVE_EXCEPTIONS
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("Failed to schedule HTTP response callback: %s", ex.what());
+ if (started->load(std::memory_order_acquire))
+ {
+ return;
+ }
+ }
+ catch (...)
+ {
+ LOG_ERROR("Failed to schedule HTTP response callback with a non-standard exception");
+ if (started->load(std::memory_order_acquire))
+ {
+ return;
+ }
+ }
+#endif
+ // Some supported dispatchers synchronously destroy tasks they cannot
+ // accept. Complete inline so the claimed callback cannot remain tracked.
+ onHttpResponse(callback);
+ }
+
+ void HttpClientManager::runScheduledHttpResponse(
+ std::shared_ptr> const& started,
+ HttpCallback* callback)
+ {
+ started->store(true, std::memory_order_release);
+ onHttpResponse(callback);
}
/* This method may get executed synchronously on Windows from handleSendRequest in case of connection failure */
void HttpClientManager::onHttpResponse(HttpCallback* callback)
{
- EventsUploadContextPtr &ctx = callback->m_ctx;
{
- LOCKGUARD(m_httpCallbacksMtx);
+ std::lock_guard lock(m_httpCallbacksMtx);
auto z = std::find(m_httpCallbacks.cbegin(), m_httpCallbacks.cend(), callback);
if (z == m_httpCallbacks.end()) {
- assert(false);
+ LOG_ERROR("Ignoring untracked HTTP callback=%p", callback);
+ return;
}
+ m_activeHttpCallbacks[callback] = std::this_thread::get_id();
+ m_httpCallbacksCV.notify_all();
+ }
+
+ EventsUploadContextPtr &ctx = callback->m_ctx;
#if !defined(NDEBUG) && defined(HAVE_MAT_LOGGING)
- // Response may be null if request got aborted
- if (ctx->httpResponse != nullptr)
- {
- IHttpResponse const& response = (*ctx->httpResponse);
- LOG_TRACE("HTTP response %s: result=%u, status=%u, body=%u bytes",
- response.GetId().c_str(), response.GetResult(), response.GetStatusCode(), static_cast(response.GetBody().size()));
- }
+ // Response may be null if request got aborted
+ if (ctx->httpResponse != nullptr)
+ {
+ IHttpResponse const& response = (*ctx->httpResponse);
+ LOG_TRACE("HTTP response %s: result=%u, status=%u, body=%u bytes",
+ response.GetId().c_str(), response.GetResult(), response.GetStatusCode(), static_cast(response.GetBody().size()));
+ }
#endif
+ // Never hold m_httpCallbacksMtx while calling the transport or
+ // dispatching requestDone(): either path may synchronously re-enter this
+ // manager. Reentrant cancellation recognizes this callback as active
+ // and does not wait for its own stack to unwind.
+#if HAVE_EXCEPTIONS
+ try
+ {
requestDone(ctx);
- // request done should be handled by now
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("Unhandled exception in HTTP response callback: %s", ex.what());
+ notifyRequestFailure(ctx);
+ }
+ catch (...)
+ {
+ LOG_ERROR("Unhandled non-standard exception in HTTP response callback");
+ notifyRequestFailure(ctx);
+ }
+#else
+ requestDone(ctx);
+#endif
+ // request done should be handled by now
+ {
+ std::lock_guard lock(m_httpCallbacksMtx);
LOG_TRACE("HTTP remove callback=%p", callback);
m_httpCallbacks.remove(callback);
- // Wake cancelAllRequests() waiting for the list to drain.
+ m_activeHttpCallbacks.erase(callback);
+ // Wake cancelAllRequests() waiting for the list to drain while the
+ // condition variable is still guaranteed to be alive.
m_httpCallbacksCV.notify_all();
}
delete callback;
}
+ void HttpClientManager::notifyRequestFailure(EventsUploadContextPtr const& ctx) noexcept
+ {
+#if HAVE_EXCEPTIONS
+ try
+ {
+ requestFailed(ctx);
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("Unhandled exception while releasing failed HTTP request: %s", ex.what());
+ }
+ catch (...)
+ {
+ LOG_ERROR("Unhandled non-standard exception while releasing failed HTTP request");
+ }
+
+ try
+ {
+ requestFailureComplete(ctx);
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("Unhandled exception while completing failed HTTP request: %s", ex.what());
+ }
+ catch (...)
+ {
+ LOG_ERROR("Unhandled non-standard exception while completing failed HTTP request");
+ }
+#else
+ requestFailed(ctx);
+ requestFailureComplete(ctx);
+#endif
+ }
+
void HttpClientManager::cancelAllRequestsAsync(std::chrono::milliseconds bestEffortTimeout)
{
if (bestEffortTimeout > std::chrono::milliseconds::zero())
@@ -154,8 +356,25 @@ namespace MAT_NS_BEGIN {
auto boundedCancel = dynamic_cast(&m_httpClient);
if (boundedCancel != nullptr)
{
+#if HAVE_EXCEPTIONS
+ try
+ {
+ boundedCancel->CancelAllRequests(bestEffortTimeout);
+ return;
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("HTTP client bounded cancellation failed: %s", ex.what());
+ }
+ catch (...)
+ {
+ LOG_ERROR("HTTP client bounded cancellation failed with a non-standard exception");
+ }
+#else
boundedCancel->CancelAllRequests(bestEffortTimeout);
return;
+#endif
}
#endif
@@ -163,7 +382,25 @@ namespace MAT_NS_BEGIN {
return;
}
+#if HAVE_EXCEPTIONS
+ try
+ {
+ m_httpClient.CancelAllRequests();
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("HTTP client cancellation failed: %s", ex.what());
+ cancelTrackedRequestsAsync();
+ }
+ catch (...)
+ {
+ LOG_ERROR("HTTP client cancellation failed with a non-standard exception");
+ cancelTrackedRequestsAsync();
+ }
+#else
m_httpClient.CancelAllRequests();
+#endif
}
void HttpClientManager::cancelTrackedRequestsAsync()
@@ -192,28 +429,72 @@ namespace MAT_NS_BEGIN {
for (const auto& id : requestIds)
{
+#if HAVE_EXCEPTIONS
+ try
+ {
+ m_httpClient.CancelRequestAsync(id);
+ }
+ catch (const std::exception& ex)
+ {
+ (void)ex;
+ LOG_ERROR("HTTP client failed to cancel request %s: %s",
+ id.c_str(), ex.what());
+ }
+ catch (...)
+ {
+ LOG_ERROR("HTTP client failed to cancel request %s with a non-standard exception",
+ id.c_str());
+ }
+#else
m_httpClient.CancelRequestAsync(id);
+#endif
}
}
void HttpClientManager::cancelAllRequests(bool bestEffort)
{
- // Use the transport-specific bounded path when available; older clients
- // fall back to cancelling tracked requests individually.
+ if (bestEffort &&
+ m_cancelDrainTimeout <= std::chrono::milliseconds::zero())
+ {
+ // A zero budget means "do not wait", not "leave requests running".
+ // Snapshot IDs and initiate asynchronous cancellation before returning.
+ cancelTrackedRequestsAsync();
+ return;
+ }
+ // Quiesce the transport before taking m_httpCallbacksMtx. Moving this
+ // call under the mutex deadlocks when a synchronous transport completion
+ // re-enters onHttpResponse().
const auto cancelStart = std::chrono::steady_clock::now();
cancelAllRequestsAsync(bestEffort ? m_cancelDrainTimeout : std::chrono::milliseconds::zero());
// Drain callbacks through the condition variable signaled by onHttpResponse.
- std::unique_lock lock(m_httpCallbacksMtx);
+ std::unique_lock lock(m_httpCallbacksMtx);
+ std::thread::id const callerThread = std::this_thread::get_id();
+ auto callbacksDrainedForCaller = [this, callerThread] {
+ for (auto const& active : m_activeHttpCallbacks)
+ {
+ if (active.second == callerThread)
+ {
+ // A completion running on a single-thread dispatcher cannot
+ // wait for peer completions queued behind itself. Returning
+ // from reentrant cancellation lets this callback unwind and
+ // the dispatcher drain the remaining work.
+ return true;
+ }
+ }
+ return m_httpCallbacks.empty();
+ };
if (bestEffort)
{
- // Keep pause bounded, including time spent in the transport cancel.
+ // Keep pause within the configured soft cap, including time spent
+ // in transport cancellation. A synchronous native handle close
+ // already in progress can finish after the deadline.
const auto elapsed = std::chrono::duration_cast(
std::chrono::steady_clock::now() - cancelStart);
const auto remaining = (elapsed < m_cancelDrainTimeout)
? (m_cancelDrainTimeout - elapsed) : std::chrono::milliseconds::zero();
- if (!m_httpCallbacksCV.wait_for(lock, remaining,
- [this] { return m_httpCallbacks.empty(); }))
+ if (!m_httpCallbacksCV.wait_for(
+ lock, remaining, callbacksDrainedForCaller))
{
LOG_WARN("cancelAllRequests: %zu callback(s) still draining after %lld ms (best-effort)",
m_httpCallbacks.size(), static_cast(m_cancelDrainTimeout.count()));
@@ -221,8 +502,10 @@ namespace MAT_NS_BEGIN {
}
else
{
- // Shutdown/cleanup is the lifetime barrier for callback state, so drain fully.
- m_httpCallbacksCV.wait(lock, [this] { return m_httpCallbacks.empty(); });
+ // Non-reentrant shutdown/cleanup is the lifetime barrier for callback
+ // state. A callback re-entering cancellation must return so its own
+ // stack can unwind; destroying the manager from that stack is unsupported.
+ m_httpCallbacksCV.wait(lock, callbacksDrainedForCaller);
}
}
diff --git a/lib/http/HttpClientManager.hpp b/lib/http/HttpClientManager.hpp
index 4f350e37f..e2717cc6f 100644
--- a/lib/http/HttpClientManager.hpp
+++ b/lib/http/HttpClientManager.hpp
@@ -10,10 +10,14 @@
#include "system/Route.hpp"
#include "ILogManager.hpp"
-#include
-#include
+#include
#include
#include
+#include
+#include