Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run signcheck in single threaded apartment #7241

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static uint IsSigned(string path)
WinTrustData data = new WinTrustData()
{
cbStruct = (uint)Marshal.SizeOf(typeof(WinTrustData)),
dwProvFlags = Convert.ToUInt32(Provider.WTD_SAFER_FLAG),
dwProvFlags = 0,
dwStateAction = Convert.ToUInt32(StateAction.WTD_STATEACTION_IGNORE),
dwUIChoice = Convert.ToUInt32(UIChoice.WTD_UI_NONE),
dwUIContext = 0,
Expand Down
4 changes: 4 additions & 0 deletions src/SignCheck/SignCheck/Microsoft.DotNet.SignCheck.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
<ProjectReference Include="..\Microsoft.SignCheck\Microsoft.DotNet.SignCheckLibrary.csproj" PrivateAssets="All" Publish="true" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\Common\Internal\AssemblyResolution.cs" Link="src\AssemblyResolution.cs" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Net" Pack="false" />
</ItemGroup>
Expand Down
9 changes: 8 additions & 1 deletion src/SignCheck/SignCheck/SignCheckTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using Microsoft.SignCheck.Logging;
using System;
using System.Collections.Generic;
Expand All @@ -10,8 +11,12 @@

namespace SignCheck
{
public class SignCheckTask : Microsoft.Build.Utilities.Task
[Microsoft.Build.Framework.LoadInSeparateAppDomain]
[RunInSTA]
public class SignCheckTask : AppDomainIsolatedTask
{
static SignCheckTask() => Microsoft.DotNet.AssemblyResolution.Initialize();

public bool EnableJarSignatureVerification
{
get;
Expand Down Expand Up @@ -85,6 +90,7 @@ public string ArtifactFolder

public override bool Execute()
{
Microsoft.DotNet.AssemblyResolution.Log = Log;
Options options = new Options();
options.EnableJarSignatureVerification = EnableJarSignatureVerification;
options.EnableXmlSignatureVerification = EnableXmlSignatureVerification;
Expand Down Expand Up @@ -143,6 +149,7 @@ public override bool Execute()

var sc = new SignCheck(options);
int result = sc.Run();
Microsoft.DotNet.AssemblyResolution.Log = null;
return (result == 0 && !Log.HasLoggedErrors);
}
}
Expand Down