Skip to content

Commit 9247ad0

Browse files
bmehta001Copilot
andcommitted
Merge runtime fixes into transport hardening
Bring PR microsoft#1429's current runtime, storage, and callback lifetime fixes into PR microsoft#1520 after synchronizing both branches with Microsoft main. Preserve the transport state machines, serialized deferred-task lifetime handling, newer module pointer, and both PAL regression suites while adopting transactional SQLite batching. Files changed: - Solutions/Clienttelemetry/Clienttelemetry.vcxitems - Solutions/Clienttelemetry/Clienttelemetry.vcxitems.filters - Solutions/before.targets - Solutions/win32-cs/win32-cs.csproj - examples/c/SampleC-Guest/CMakeLists.txt - examples/cmake/MSTelemetrySample.cmake - examples/cpp/EventSender/CMakeLists.txt - examples/cpp/MacProxy/CMakeLists.txt - examples/cpp/SampleCpp/CMakeLists.txt - examples/cpp/SampleCppMini/CMakeLists.txt - examples/cs/SampleCsNet40/SampleCsNet40.csproj - examples/cs/SampleCsUWP/SampleCsUWP.csproj - examples/objc/cocoa-app/CMakeLists.txt - lib/api/LogConfiguration.cpp - lib/api/LogManagerFactory.hpp - lib/api/LogManagerImpl.cpp - lib/api/LogManagerImpl.hpp - lib/api/Logger.cpp - lib/config/RuntimeConfig_Default.hpp - lib/http/HttpResponseDecoder.cpp - lib/include/mat/config-default.h - lib/include/public/ILogConfiguration.hpp - lib/include/public/ITaskDispatcher.hpp - lib/offline/IOfflineStorageProvider.hpp - lib/offline/MemoryStorage.cpp - lib/offline/OfflineStorageFactory.cpp - lib/offline/OfflineStorageFactory.hpp - lib/offline/OfflineStorageHandler.cpp - lib/offline/OfflineStorageHandler.hpp - lib/offline/OfflineStorage_SQLite.cpp - lib/offline/OfflineStorage_SQLite.hpp - lib/offline/SQLiteWrapper.hpp - lib/offline/StorageRecordValidation.hpp - lib/pal/PAL.cpp - lib/pal/TaskDispatcher.hpp - lib/pal/TaskDispatcher_CAPI.cpp - lib/pal/WorkerThread.cpp - lib/tpm/TransmissionPolicyManager.cpp - lib/tpm/TransmissionPolicyManager.hpp - lib/tpm/TransmitProfiles.cpp - lib/utils/Utils.cpp - tests/common/MockIRuntimeConfig.hpp - tests/common/SocketTools.hpp - tests/functests/BasicFuncTests.cpp - tests/functests/MultipleLogManagersTests.cpp - tests/unittests/HttpResponseDecoderTests.cpp - tests/unittests/LogSessionDataDBTests.cpp - tests/unittests/Main.cpp - tests/unittests/MemoryStorageTests.cpp - tests/unittests/OfflineStorageTests.cpp - tests/unittests/OfflineStorageTests_SQLite.cpp - tests/unittests/PalTests.cpp - tests/unittests/TaskDispatcherCAPITests.cpp - tests/unittests/TransmissionPolicyManagerTests.cpp - tests/unittests/TransmitProfilesTests.cpp Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c4cfcad8-1637-4e46-86cf-6bf200244b04
2 parents 3fac64a + 9e54c3b commit 9247ad0

55 files changed

Lines changed: 3069 additions & 1952 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Solutions/Clienttelemetry/Clienttelemetry.vcxitems‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\LogSessionDataProvider.hpp" />
162162
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\MemoryStorage.hpp" />
163163
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\OfflineStorageHandler.hpp" />
164+
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\IOfflineStorageProvider.hpp" />
164165
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\OfflineStorage_SQLite.hpp" />
165166
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\SQLiteWrapper.hpp" />
166167
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\StorageObserver.hpp" />

‎Solutions/Clienttelemetry/Clienttelemetry.vcxitems.filters‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\MemoryStorage.hpp" />
148148
<ClCompile Include="$(MSBuildThisFileDirectory)..\..\lib\offline\OfflineStorageFactory.cpp" />
149149
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\OfflineStorageHandler.hpp" />
150+
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\IOfflineStorageProvider.hpp">
151+
<Filter>Header Files</Filter>
152+
</ClInclude>
150153
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\OfflineStorage_SQLite.hpp" />
151154
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\SQLiteWrapper.hpp" />
152155
<ClInclude Include="$(MSBuildThisFileDirectory)..\..\lib\offline\StorageObserver.hpp" />

‎Solutions/before.targets‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
<PropertyGroup>
33
<CustomIncludePath>$(SolutionDir)\..\third_party\krabsetw\krabs;$(CustomIncludePath)</CustomIncludePath>
44
</PropertyGroup>
5+
<ItemDefinitionGroup Condition="$([MSBuild]::VersionGreaterThanOrEquals('$(VisualStudioVersion)', '18.0'))">
6+
<ClCompile>
7+
<!-- v145's C++14 compatibility headers still use experimental coroutines.
8+
This acknowledges that deprecation only; it does not disable compiler diagnostics. -->
9+
<PreprocessorDefinitions>_SILENCE_EXPERIMENTAL_COROUTINE_DEPRECATION_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
10+
<AdditionalIncludeDirectories>$(SolutionDir)..\zlib;$(SolutionDir)..\sqlite;$(SolutionDir)..\lib\pal\universal;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
11+
</ClCompile>
12+
</ItemDefinitionGroup>
513
<PropertyGroup Label="Globals">
614
<!-- before.targets is imported before Microsoft.Cpp.Default.props, so DefaultPlatformToolset is not reliable here. -->
715
<!-- Map known-shipped toolsets explicitly; callers can still override PlatformToolset. -->

‎Solutions/win32-cs/win32-cs.csproj‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<AppDesignerFolder>Properties</AppDesignerFolder>
1111
<RootNamespace>CLI</RootNamespace>
1212
<AssemblyName>win32-cs</AssemblyName>
13-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
13+
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
1414
<FileAlignment>512</FileAlignment>
1515
<TargetFrameworkProfile />
1616
<IsWebBootstrapper>false</IsWebBootstrapper>
@@ -39,7 +39,7 @@
3939
<ErrorReport>prompt</ErrorReport>
4040
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
4141
<Prefer32Bit>true</Prefer32Bit>
42-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
42+
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
4343
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
4444
<OutputPath>..\..\out\Debug\x86\win32-cs\bin\</OutputPath>
4545
<RunCodeAnalysis>true</RunCodeAnalysis>
@@ -52,7 +52,7 @@
5252
<ErrorReport>prompt</ErrorReport>
5353
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
5454
<Prefer32Bit>true</Prefer32Bit>
55-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
55+
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
5656
</PropertyGroup>
5757
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
5858
<DebugSymbols>true</DebugSymbols>
@@ -62,7 +62,7 @@
6262
<ErrorReport>prompt</ErrorReport>
6363
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
6464
<Prefer32Bit>false</Prefer32Bit>
65-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
65+
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
6666
</PropertyGroup>
6767
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
6868
<DefineConstants>TRACE</DefineConstants>
@@ -73,7 +73,7 @@
7373
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
7474
<Prefer32Bit>false</Prefer32Bit>
7575
<RunCodeAnalysis>true</RunCodeAnalysis>
76-
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
76+
<TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
7777
</PropertyGroup>
7878
<PropertyGroup>
7979
<StartupObject>CLI.Program</StartupObject>
@@ -117,9 +117,9 @@
117117
</EmbeddedResource>
118118
</ItemGroup>
119119
<ItemGroup>
120-
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
120+
<BootstrapperPackage Include=".NETFramework,Version=v4.8.1">
121121
<Visible>False</Visible>
122-
<ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
122+
<ProductName>Microsoft .NET Framework 4.8.1 %28x86 and x64%29</ProductName>
123123
<Install>true</Install>
124124
</BootstrapperPackage>
125125
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">

‎examples/c/SampleC-Guest/CMakeLists.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ project(SampleC-Guest)
66

77
include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/MSTelemetrySample.cmake)
88

9-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
10-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
9+
if(NOT MSVC)
10+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
11+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
12+
endif()
1113

1214
find_package (Threads)
1315

@@ -20,4 +22,4 @@ source_group(" " REGULAR_EXPRESSION "")
2022

2123
# The 1DS SDK's required Apple frameworks are provided by MATSDK_SAMPLE_PLATFORM_LIBS.
2224

23-
target_link_libraries(SampleC-Guest ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl)
25+
target_link_libraries(SampleC-Guest ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS})

‎examples/cmake/MSTelemetrySample.cmake‎

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,20 @@ if(NOT EXISTS "${MATSDK_LIB_DIR}/libmat.a"
1313
set(MATSDK_LIB_DIR "${MATSDK_LIB_DIR}/${CMAKE_SYSTEM_PROCESSOR}-linux-gnu" CACHE PATH "MSTelemetry library directory" FORCE)
1414
endif()
1515

16-
find_library(MATSDK_LIBRARY NAMES mat HINTS "${MATSDK_LIB_DIR}" NO_DEFAULT_PATH)
17-
if(NOT MATSDK_LIBRARY)
18-
message(FATAL_ERROR "Could not find libmat under ${MATSDK_LIB_DIR}. Set MATSDK_INSTALL_DIR or MATSDK_LIB_DIR.")
16+
find_package(MSTelemetry CONFIG QUIET
17+
PATHS "${MATSDK_INSTALL_DIR}/lib/cmake/MSTelemetry"
18+
NO_DEFAULT_PATH)
19+
if(TARGET MSTelemetry::mat)
20+
set(MATSDK_LIBRARY MSTelemetry::mat)
21+
set(MATSDK_SAMPLE_DEPENDENCY_LIBS "")
22+
else()
23+
find_library(MATSDK_LIBRARY NAMES mat HINTS "${MATSDK_LIB_DIR}" NO_DEFAULT_PATH)
24+
if(NOT MATSDK_LIBRARY)
25+
message(FATAL_ERROR "Could not find libmat under ${MATSDK_LIB_DIR}. Set MATSDK_INSTALL_DIR or MATSDK_LIB_DIR.")
26+
endif()
27+
find_package(CURL REQUIRED)
28+
find_package(ZLIB REQUIRED)
29+
set(MATSDK_SAMPLE_DEPENDENCY_LIBS CURL::libcurl ZLIB::ZLIB)
1930
endif()
2031

2132
if(NOT EXISTS "${MATSDK_INCLUDE_DIR}")
@@ -40,9 +51,13 @@ if(APPLE)
4051
endif()
4152
endif()
4253

43-
find_library(MATSDK_SQLITE3_LIB NAMES sqlite3 HINTS "${MATSDK_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
44-
if(NOT MATSDK_SQLITE3_LIB)
45-
set(MATSDK_SQLITE3_LIB sqlite3)
54+
if(TARGET MSTelemetry::mat)
55+
set(MATSDK_SQLITE3_LIB "")
56+
else()
57+
find_library(MATSDK_SQLITE3_LIB NAMES sqlite3 sqlite3_bundled HINTS "${MATSDK_INSTALL_DIR}/lib" NO_DEFAULT_PATH)
58+
if(NOT MATSDK_SQLITE3_LIB)
59+
set(MATSDK_SQLITE3_LIB sqlite3)
60+
endif()
4661
endif()
4762

4863
mark_as_advanced(MATSDK_INSTALL_DIR MATSDK_INCLUDE_DIR MATSDK_LIB_DIR MATSDK_LIBRARY MATSDK_SQLITE3_LIB)

‎examples/cpp/EventSender/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ source_group(" " REGULAR_EXPRESSION "")
2323
#tcmalloc turned off by default
2424
#target_link_libraries(EventSender ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl tcmalloc)
2525

26-
target_link_libraries(EventSender ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl)
26+
target_link_libraries(EventSender ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS})

‎examples/cpp/MacProxy/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
2626
set (PLATFORM_LIBS "atomic")
2727
endif()
2828

29-
target_link_libraries(MacProxy ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS} dl)
29+
target_link_libraries(MacProxy ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS})

‎examples/cpp/SampleCpp/CMakeLists.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ project(SampleCpp)
66

77
include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/MSTelemetrySample.cmake)
88

9-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
10-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
9+
if(NOT MSVC)
10+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
11+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
12+
endif()
1113

1214
find_package (Threads)
1315

@@ -30,4 +32,4 @@ endif()
3032
#target_link_libraries(SampleCpp ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS} dl tcmalloc)
3133

3234
# TODO: use add_library to allow linking against a proper exported SDK target
33-
target_link_libraries(SampleCpp ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS} dl)
35+
target_link_libraries(SampleCpp ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} ${PLATFORM_LIBS})

‎examples/cpp/SampleCppMini/CMakeLists.txt‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ project(SampleCppMini)
66

77
include(${CMAKE_CURRENT_LIST_DIR}/../../cmake/MSTelemetrySample.cmake)
88

9-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
10-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
9+
if(NOT MSVC)
10+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0 -ggdb -gdwarf-2 -std=c11")
11+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -ggdb -gdwarf-2 -std=c++11")
12+
endif()
1113

1214
find_package (Threads)
1315

@@ -23,4 +25,4 @@ source_group(" " REGULAR_EXPRESSION "")
2325
#tcmalloc turned off by default
2426
#target_link_libraries(SampleCppMini ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl tcmalloc)
2527

26-
target_link_libraries(SampleCppMini ${MATSDK_LIBRARY} curl z ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS} dl)
28+
target_link_libraries(SampleCppMini ${MATSDK_LIBRARY} ${MATSDK_SAMPLE_DEPENDENCY_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${MATSDK_SQLITE3_LIB} ${MATSDK_SAMPLE_PLATFORM_LIBS})

0 commit comments

Comments
 (0)