Skip to content

Commit fd34d5e

Browse files
authored
[6.0] Fix xevent and codeql (#3775)(#3819), add global.json (#3827)
1 parent 8b320de commit fd34d5e

File tree

13 files changed

+559
-140
lines changed

13 files changed

+559
-140
lines changed

.github/workflows/codeql.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL Advanced"
13+
14+
on:
15+
push:
16+
branches: [ "release/6.0" ]
17+
pull_request:
18+
branches: [ "release/6.0" ]
19+
schedule:
20+
- cron: '33 23 * * 6'
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
# Runner size impacts CodeQL analysis time. To learn more, please see:
26+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
27+
# - https://gh.io/supported-runners-and-hardware-resources
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
30+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31+
permissions:
32+
# required for all workflows
33+
security-events: write
34+
35+
# required to fetch internal or private CodeQL packs
36+
packages: read
37+
38+
# only required for workflows in private repositories
39+
actions: read
40+
contents: read
41+
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
include:
46+
- language: csharp
47+
build-mode: manual
48+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
49+
# Use `c-cpp` to analyze code written in C, C++ or both
50+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
56+
steps:
57+
- name: Checkout repository
58+
uses: actions/checkout@v4
59+
60+
- name: Setup .NET Core SDK
61+
uses: actions/[email protected]
62+
with:
63+
global-json-file: global.json
64+
65+
# Initializes the CodeQL tools for scanning.
66+
- name: Initialize CodeQL
67+
uses: github/codeql-action/init@v4
68+
with:
69+
languages: ${{ matrix.language }}
70+
build-mode: ${{ matrix.build-mode }}
71+
# If you wish to specify custom queries, you can do so here or in a config file.
72+
# By default, queries listed here will override any specified in a config file.
73+
# Prefix the list here with "+" to use these queries and those in the config file.
74+
75+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
76+
# queries: security-extended,security-and-quality
77+
78+
# If the analyze step fails for one of the languages you are analyzing with
79+
# "We were unable to automatically build your code", modify the matrix above
80+
# to set the build mode to "manual" for that language. Then modify this step
81+
# to build your code.
82+
# ℹ️ Command-line programs to run using the OS shell.
83+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
84+
- name: Run manual build steps
85+
if: matrix.build-mode == 'manual'
86+
shell: bash
87+
run: |
88+
mkdir packages
89+
dotnet build src/Microsoft.Data.SqlClient.sln
90+
91+
- name: Perform CodeQL Analysis
92+
uses: github/codeql-action/analyze@v4
93+
with:
94+
category: "/language:${{matrix.language}}"

eng/pipelines/common/templates/jobs/ci-code-coverage-job.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ jobs:
6161
displayName: '[Debug] Show Disk Usage'
6262

6363
- task: UseDotNet@2
64-
displayName: 'Use .NET SDK 8.0.x'
64+
displayName: 'Install .NET SDK'
6565
inputs:
6666
packageType: sdk
67-
version: 8.0.x
67+
useGlobalJson: true
6868

6969
- pwsh: |
7070
dotnet tool install --global dotnet-coverage

eng/pipelines/common/templates/jobs/ci-run-tests-job.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -232,18 +232,21 @@ jobs:
232232
dotnet --info
233233
234234
Invoke-WebRequest https://dot.net/v1/dotnet-install.ps1 -OutFile dotnet-install.ps1
235-
236-
# install .net x86
235+
237236
$version = "LTS"
238237
if (!"${{parameters.targetFramework }}".StartsWith("net4"))
239238
{
240239
$version = "${{parameters.targetFramework }}".Substring(3, "${{parameters.targetFramework }}".Length-3)
241240
}
242241
242+
# Install targetFramework specific .NET runtime (and sdk)
243243
.\dotnet-install.ps1 -Channel $version -Architecture x86 -InstallDir "$(dotnetx86RootPath)"
244244
245+
# Install globally required .NET sdk
246+
.\dotnet-install.ps1 -Architecture x86 -InstallDir "$(dotnetx86RootPath)" -JSonFile global.json
247+
245248
$(dotnetx86RootPath)dotnet.exe --info
246-
displayName: 'Install .NET x86 '
249+
displayName: 'Install .NET x86'
247250
condition: ne(variables['dotnetx86RootPath'], '')
248251
249252
- template: ../steps/run-all-tests-step.yml@self

global.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"sdk": {
3+
"version": "9.0.308",
4+
"rollForward": "latestFeature"
5+
}
6+
}

src/Microsoft.Data.SqlClient/netcore/src/Microsoft.Data.SqlClient.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@
491491
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlInternalTransaction.cs">
492492
<Link>Microsoft\Data\SqlClient\SqlInternalTransaction.cs</Link>
493493
</Compile>
494-
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlMetadataFactory.cs">
495-
<Link>Microsoft\Data\SqlClient\SqlMetadataFactory.cs</Link>
494+
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlMetaDataFactory.cs">
495+
<Link>Microsoft\Data\SqlClient\SqlMetaDataFactory.cs</Link>
496496
</Compile>
497497
<Compile Include="$(CommonSourceRoot)Microsoft\Data\SqlClient\SqlNotificationEventArgs.cs">
498498
<Link>Microsoft\Data\SqlClient\SqlNotificationEventArgs.cs</Link>

src/Microsoft.Data.SqlClient/netfx/src/Microsoft.Data.SqlClient.csproj

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.Net.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<ProjectGuid>{407890AC-9876-4FEF-A6F1-F36A876BAADE}</ProjectGuid>
44
<RootNamespace></RootNamespace>
@@ -12,9 +12,6 @@
1212
<DocumentationFile>$(OutputPath)\Microsoft.Data.SqlClient.xml</DocumentationFile>
1313
<IntermediateOutputPath>$(ObjPath)$(AssemblyName)\netfx\</IntermediateOutputPath>
1414
<Product>Framework $(BaseProduct)</Product>
15-
<!-- ResolveComReferenceSilent suppresses warnings thrown due to the inclusion of mscoree.
16-
We should remove ResolveComReferenceSilent as soon as we can remove the dependency on mscoree. -->
17-
<ResolveComReferenceSilent>True</ResolveComReferenceSilent>
1815
<EnableDefaultCompileItems>false</EnableDefaultCompileItems>
1916
<DefineConstants>$(DefineConstants);NETFRAMEWORK;</DefineConstants>
2017
</PropertyGroup>
@@ -56,7 +53,8 @@
5653
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
5754
<Utf8Output>True</Utf8Output>
5855
<ErrorReport>None</ErrorReport>
59-
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
56+
<!-- This code analysis ruleset only exists with the .NET Framework toolset. -->
57+
<CodeAnalysisRuleSet Condition="$(MSBuildRuntimeType) == 'Full'">MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
6058
<BuildProjectReferences>True</BuildProjectReferences>
6159
<GenerateAssemblyRefs>True</GenerateAssemblyRefs>
6260
<DefineConstants>$(DefineConstants);USEOFFSET;CODE_ANALYSIS_BASELINE;FEATURE_LEGACYSURFACEAREA;FEATURE_UTF32;FEATURE_UTF7;TRACE;</DefineConstants>
@@ -806,7 +804,7 @@
806804
<ItemGroup>
807805
<Compile Include="Common\Microsoft\Data\Common\NameValuePermission.cs" />
808806
<Compile Include="Microsoft\Data\Common\DbConnectionOptions.cs" />
809-
<Compile Include="Microsoft\Data\Common\DbConnectionString.cs" />
807+
<Compile Include="Microsoft\Data\Common\DBConnectionString.cs" />
810808
<Compile Include="Microsoft\Data\Common\GreenMethods.cs" />
811809
<Compile Include="Microsoft\Data\Interop\SNINativeManagedWrapperARM64.cs" />
812810
<Compile Include="Microsoft\Data\Interop\SNINativeManagedWrapperX64.cs" />
@@ -875,17 +873,6 @@
875873
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
876874
</EmbeddedResource>
877875
</ItemGroup>
878-
<ItemGroup>
879-
<COMReference Include="mscoree">
880-
<Guid>{5477469E-83B1-11D2-8B49-00A0C9B7C9C4}</Guid>
881-
<VersionMajor>2</VersionMajor>
882-
<VersionMinor>4</VersionMinor>
883-
<Lcid>0</Lcid>
884-
<WrapperTool>tlbimp</WrapperTool>
885-
<Isolated>False</Isolated>
886-
<EmbedInteropTypes>True</EmbedInteropTypes>
887-
</COMReference>
888-
</ItemGroup>
889876
<ItemGroup>
890877
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryVersion)" />
891878
<PackageReference Include="System.Text.Encodings.Web" Version="$(SystemTextEncodingsWebVersion)" />

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetadataFactory.cs renamed to src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetaDataFactory.cs

File renamed without changes.

src/Microsoft.Data.SqlClient/tests/FunctionalTests/Microsoft.Data.SqlClient.Tests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
9494
<PrivateAssets>all</PrivateAssets>
9595
</PackageReference>
96-
<PackageReference Include="xunit.runner.utility" Version="$(XunitVersion)" />
9796
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" Version="$(MicrosoftDotNetXUnitExtensionsVersion)" />
9897
</ItemGroup>
9998
<ItemGroup>

0 commit comments

Comments
 (0)