-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16924 from tamasvajk/feature/winforms-linux
C#: Restore Windows dependencies when Windows Forms or WPF usage is detected
- Loading branch information
Showing
13 changed files
with
188 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
csharp/ql/integration-tests/all-platforms/standalone_winforms/Assemblies.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/Accessibility.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/Microsoft.VisualBasic.Forms.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/Microsoft.VisualBasic.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/Microsoft.Win32.Registry.AccessControl.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/Microsoft.Win32.SystemEvents.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationCore.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationFramework.Aero2.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationFramework.Aero.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationFramework.AeroLite.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationFramework.Classic.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationFramework.Luna.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationFramework.Royale.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationFramework.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/PresentationUI.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/ReachFramework.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.CodeDom.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Configuration.ConfigurationManager.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Design.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Diagnostics.EventLog.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Diagnostics.PerformanceCounter.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.DirectoryServices.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Drawing.Common.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Drawing.Design.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Drawing.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.IO.Packaging.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Printing.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Resources.Extensions.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Security.Cryptography.Pkcs.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Security.Cryptography.ProtectedData.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Security.Cryptography.Xml.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Security.Permissions.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Threading.AccessControl.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Controls.Ribbon.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Extensions.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Forms.Design.Editors.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Forms.Design.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Forms.Primitives.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Forms.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Input.Manipulations.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Windows.Presentation.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/System.Xaml.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/UIAutomationClient.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/UIAutomationClientSideProviders.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/UIAutomationProvider.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/UIAutomationTypes.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/WindowsBase.dll | | ||
| [...]/microsoft.windowsdesktop.app.ref/8.0.1/ref/net8.0/WindowsFormsIntegration.dll | |
11 changes: 11 additions & 0 deletions
11
csharp/ql/integration-tests/all-platforms/standalone_winforms/Assemblies.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import csharp | ||
|
||
private string getPath(Assembly a) { | ||
not a.getCompilation().getOutputAssembly() = a and | ||
exists(string s | s = a.getFile().getAbsolutePath() | | ||
result = "[...]" + s.substring(s.indexOf("microsoft.windowsdesktop.app.ref") - 1, s.length()) | ||
) | ||
} | ||
|
||
from Assembly a | ||
select getPath(a) |
18 changes: 18 additions & 0 deletions
18
csharp/ql/integration-tests/all-platforms/standalone_winforms/CompilationInfo.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
| All Nuget feeds reachable | 1.0 | | ||
| Failed project restore with package source error | 0.0 | | ||
| Failed solution restore with package source error | 0.0 | | ||
| NuGet feed responsiveness checked | 1.0 | | ||
| Project files on filesystem | 1.0 | | ||
| Reachable fallback Nuget feed count | 1.0 | | ||
| Resource extraction enabled | 0.0 | | ||
| Restored .NET framework variants | 1.0 | | ||
| Restored projects through solution files | 0.0 | | ||
| Solution files on filesystem | 0.0 | | ||
| Source files generated | 1.0 | | ||
| Source files on filesystem | 3.0 | | ||
| Successfully restored project files | 1.0 | | ||
| Successfully restored solution files | 0.0 | | ||
| Unresolved references | 0.0 | | ||
| UseWPF set | 0.0 | | ||
| UseWindowsForms set | 1.0 | | ||
| WebView extraction enabled | 1.0 | |
16 changes: 16 additions & 0 deletions
16
csharp/ql/integration-tests/all-platforms/standalone_winforms/CompilationInfo.ql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import csharp | ||
import semmle.code.csharp.commons.Diagnostics | ||
|
||
query predicate compilationInfo(string key, float value) { | ||
key != "Resolved references" and | ||
key != "Resolved assembly conflicts" and | ||
not key.matches("Compiler diagnostic count for%") and | ||
exists(Compilation c, string infoKey, string infoValue | infoValue = c.getInfo(infoKey) | | ||
key = infoKey and | ||
value = infoValue.toFloat() | ||
or | ||
not exists(infoValue.toFloat()) and | ||
key = infoKey + ": " + infoValue and | ||
value = 1 | ||
) | ||
} |
38 changes: 38 additions & 0 deletions
38
csharp/ql/integration-tests/all-platforms/standalone_winforms/Form1.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
csharp/ql/integration-tests/all-platforms/standalone_winforms/Form1.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace winforms; | ||
|
||
public partial class Form1 : Form | ||
{ | ||
public Form1() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
csharp/ql/integration-tests/all-platforms/standalone_winforms/Program.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
namespace winforms; | ||
|
||
static class Program | ||
{ | ||
/// <summary> | ||
/// The main entry point for the application. | ||
/// </summary> | ||
[STAThread] | ||
static void Main() | ||
{ | ||
// To customize application configuration such as set high DPI settings or default font, | ||
// see https://aka.ms/applicationconfiguration. | ||
ApplicationConfiguration.Initialize(); | ||
Application.Run(new Form1()); | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
csharp/ql/integration-tests/all-platforms/standalone_winforms/global.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"sdk": { | ||
"version": "8.0.101" | ||
} | ||
} |
3 changes: 3 additions & 0 deletions
3
csharp/ql/integration-tests/all-platforms/standalone_winforms/test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from create_database_utils import * | ||
|
||
run_codeql_database_create(lang="csharp", extra_args=["--build-mode=none"]) |
11 changes: 11 additions & 0 deletions
11
csharp/ql/integration-tests/all-platforms/standalone_winforms/winforms.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<UseWindowsForms>true</UseWindowsForms> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
|
||
</Project> |