Skip to content
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
1 change: 0 additions & 1 deletion eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ function Deploy-VsixViaTool() {
"Roslyn.Compilers.Extension.vsix",
"Roslyn.VisualStudio.Setup.vsix",
"Roslyn.VisualStudio.Setup.Dependencies.vsix",
"Roslyn.VisualStudio.InteractiveComponents.vsix",
"ExpressionEvaluatorPackage.vsix",
"Roslyn.VisualStudio.DiagnosticsWindow.vsix",
"Microsoft.VisualStudio.IntegrationTest.Setup.vsix")
Expand Down
20 changes: 0 additions & 20 deletions eng/config/OptProf.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,6 @@
"filename": "/Microsoft.CodeAnalysis.Features.dll",
"testCases":[ "ManagedLangs.OptProfTests.DDRIT_RPS_ManagedLangs" ]
},
{
"filename": "/Microsoft.CodeAnalysis.CSharp.Workspaces.dll",
"testCases":[ "ManagedLangs.OptProfTests.DDRIT_RPS_ManagedLangs" ]
},
{
"filename": "/Microsoft.VisualStudio.LanguageServices.Implementation.dll",
"testCases":[ "ManagedLangs.OptProfTests.DDRIT_RPS_ManagedLangs" ]
Expand Down Expand Up @@ -143,10 +139,6 @@
"filename": "/Microsoft.CodeAnalysis.VisualBasic.Features.dll",
"testCases":[ "Microsoft.Test.Performance.XamlOptProfCreateTests.WpfCreateProject_DesignerIsolated" ]
},
{
"filename": "/Microsoft.CodeAnalysis.Workspaces.dll",
"testCases":[ "Microsoft.Test.Performance.XamlOptProfCreateTests.WpfCreateProject_DesignerIsolated" ]
},
{
"filename": "/Microsoft.CodeAnalysis.VisualBasic.dll",
"testCases":[ "Microsoft.Test.Performance.XamlOptProfCreateTests.WpfCreateProject_DesignerIsolated" ]
Expand Down Expand Up @@ -252,10 +244,6 @@
"filename": "/Microsoft.CodeAnalysis.VisualBasic.Features.dll",
"testCases":[ "WinForms.OptProfTests.winforms_largeform_vb" ]
},
{
"filename": "/Microsoft.CodeAnalysis.Workspaces.dll",
"testCases":[ "WinForms.OptProfTests.winforms_largeform_vb" ]
},
{
"filename": "/Microsoft.CodeAnalysis.VisualBasic.dll",
"testCases":[ "WinForms.OptProfTests.winforms_largeform_vb" ]
Expand Down Expand Up @@ -365,10 +353,6 @@
"filename": "/Microsoft.CodeAnalysis.VisualBasic.Features.dll",
"testCases":[ "TeamEng.OptProfTest.vs_debugger_start_no_build_cs_scribble" ]
},
{
"filename": "/Microsoft.CodeAnalysis.Workspaces.dll",
"testCases":[ "TeamEng.OptProfTest.vs_debugger_start_no_build_cs_scribble" ]
},
{
"filename": "/Microsoft.CodeAnalysis.VisualBasic.dll",
"testCases":[ "TeamEng.OptProfTest.vs_debugger_start_no_build_cs_scribble" ]
Expand Down Expand Up @@ -478,10 +462,6 @@
"filename": "/Microsoft.CodeAnalysis.VisualBasic.Features.dll",
"testCases":[ "VSPE.OptProfTests.vs_asl_vb_scenario", "VSPE.OptProfTests.vs_perf_designtime_solution_build_vb_australiangovernment" ]
},
{
"filename": "/Microsoft.CodeAnalysis.Workspaces.dll",
"testCases":[ "VSPE.OptProfTests.vs_asl_cs_scenario", "VSPE.OptProfTests.vs_asl_vb_scenario", "VSPE.OptProfTests.vs_perf_DesignTime_solution_loadclose_cs_picasso", "VSPE.OptProfTests.vs_perf_designtime_editor_intellisense_globalcompletionlist_cs", "VSPE.OptProfTests.vs_perf_designtime_ide_searchtest", "VSPE.OptProfTests.vs_perf_designtime_solution_build_vb_australiangovernment", "VSPE.OptProfTests.vs_perf_designtime_solution_loadclose_vb_australiangovernment" ]
},
{
"filename": "/Microsoft.CodeAnalysis.VisualBasic.dll",
"testCases":[ "VSPE.OptProfTests.vs_asl_vb_scenario", "VSPE.OptProfTests.vs_perf_designtime_ide_searchtest", "VSPE.OptProfTests.vs_perf_designtime_solution_build_vb_australiangovernment", "VSPE.OptProfTests.vs_perf_designtime_solution_loadclose_vb_australiangovernment" ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<RootNamespace>Microsoft.VisualStudio.LanguageServices.CodeLens</RootNamespace>
<TargetFramework>net472</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ApplyNgenOptimization>partial</ApplyNgenOptimization>

<!-- NuGet -->
<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<GeneratePkgDefFile>true</GeneratePkgDefFile>
<DeployExtension>false</DeployExtension>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<ApplyNgenOptimization>partial</ApplyNgenOptimization>

<!-- NuGet -->
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,8 @@ int Prop { $$}
assertCaretPosition: true);
}

[WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
[WpfTheory(Skip = "https://github.com/dotnet/roslyn/issues/43627")]
[CombinatorialData, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)]
[Trait(Traits.Feature, Traits.Features.CompleteStatement)]
[WorkItem(18104, "https://github.com/dotnet/roslyn/issues/18104")]
public void CompleteStatementTriggersCompletion(bool showCompletionInArgumentLists)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public void AtNamespaceLevel(bool showCompletionInArgumentLists)
VisualStudio.Editor.Verify.CurrentLineText("using$$", assertCaretPosition: true);
}

[WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)]
[WpfTheory(Skip = "https://github.com/dotnet/roslyn/issues/43627")]
[CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)]
public void SpeculativeTInList(bool showCompletionInArgumentLists)
{
SetUpEditor(@"
Expand Down Expand Up @@ -104,7 +105,8 @@ public static void Navigate(int i){ }
VisualStudio.Editor.Verify.CurrentLineText("NavigateTo.Search$$", assertCaretPosition: true);
}

[WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)]
[WpfTheory(Skip = "https://github.com/dotnet/roslyn/issues/43627")]
[CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)]
public void CtrlAltSpace(bool showCompletionInArgumentLists)
{
VisualStudio.Workspace.SetTriggerCompletionInArgumentLists(showCompletionInArgumentLists);
Expand Down Expand Up @@ -154,7 +156,8 @@ public void CtrlAltSpace(bool showCompletionInArgumentLists)
VisualStudio.Editor.Verify.CurrentLineText("System.Console.writeline();$$", assertCaretPosition: true);
}

[WpfTheory, CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)]
[WpfTheory(Skip = "https://github.com/dotnet/roslyn/issues/43627")]
[CombinatorialData, Trait(Traits.Feature, Traits.Features.Completion)]
public void CtrlAltSpaceOption(bool showCompletionInArgumentLists)
{
VisualStudio.Workspace.SetTriggerCompletionInArgumentLists(showCompletionInArgumentLists);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<TargetFrameworks>netcoreapp3.1;netstandard2.0</TargetFrameworks>
<DefineConstants>$(DefineConstants);WORKSPACE</DefineConstants>
<GeneratePerformanceSensitiveAttribute>true</GeneratePerformanceSensitiveAttribute>
<ApplyNgenOptimization>partial</ApplyNgenOptimization>

<!-- NuGet -->
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Runtime.InteropServices;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis.Shared.Extensions
{
internal static class SafeHandleExtensions
{
/// <summary>
/// Acquires a lease on a safe handle. The lease increments the reference count of the <see cref="SafeHandle"/>
/// to ensure the handle is not released prior to the lease being released.
/// </summary>
/// <remarks>
/// This method is intended to be used in the initializer of a <c>using</c> statement. Failing to release the
/// lease will permanently prevent the underlying <see cref="SafeHandle"/> from being released by the garbage
/// collector.
/// </remarks>
/// <param name="handle">The <see cref="SafeHandle"/> to lease.</param>
/// <returns>A <see cref="SafeHandleLease"/>, which must be disposed to release the resource.</returns>
/// <exception cref="ObjectDisposedException">If the lease could not be acquired.</exception>
public static SafeHandleLease Lease(this SafeHandle handle)
{
RoslynDebug.AssertNotNull(handle);

var success = false;
try
{
handle.DangerousAddRef(ref success);
if (!success)
throw new ObjectDisposedException(handle.GetType().FullName);

return new SafeHandleLease(handle);
}
catch
{
if (success)
handle.DangerousRelease();

throw;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System;
using System.Runtime.InteropServices;

namespace Microsoft.CodeAnalysis.Shared.Extensions
{
/// <summary>
/// Represents a lease of a <see cref="SafeHandle"/>.
/// </summary>
/// <seealso cref="SafeHandleExtensions.Lease"/>
internal readonly struct SafeHandleLease : IDisposable
{
private readonly SafeHandle? _handle;

internal SafeHandleLease(SafeHandle handle)
=> _handle = handle;

/// <summary>
/// Releases the <see cref="SafeHandle"/> lease. The behavior of this method is unspecified if called more than
/// once.
/// </summary>
public void Dispose()
=> _handle?.DangerousRelease();
}
}
172 changes: 172 additions & 0 deletions src/Workspaces/Core/Portable/Storage/SQLite/Interop/NativeMethods.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable enable

using System.Diagnostics.CodeAnalysis;
using Microsoft.CodeAnalysis.Shared.Extensions;
using SQLitePCL;

namespace Microsoft.CodeAnalysis.SQLite.Interop
{
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Name chosen to match SQLitePCL.raw")]
internal static class NativeMethods
{
public static SafeSqliteHandle sqlite3_open_v2(string filename, int flags, string vfs, out Result result)
{
result = (Result)raw.sqlite3_open_v2(filename, out var wrapper, flags, vfs);
if (result != Result.OK)
{
wrapper = null;
}

try
{
// Always return a non-null handle to match default P/Invoke marshaling behavior. SafeHandle.IsInvalid
// will be true when the handle is not usable, but the handle instance can be disposed either way.
return new SafeSqliteHandle(wrapper);
}
catch
{
raw.sqlite3_close(wrapper);
throw;
}
}

public static SafeSqliteStatementHandle sqlite3_prepare_v2(SafeSqliteHandle db, string sql, out Result result)
{
using var _ = db.Lease();

result = (Result)raw.sqlite3_prepare_v2(db.DangerousGetHandle(), sql, out var wrapper);
if (result != (int)Result.OK)
{
wrapper = null;
}

try
{
// Always return a non-null handle to match default P/Invoke marshaling behavior. SafeHandle.IsInvalid
// will be true when the handle is not usable, but the handle instance can be disposed either way.
return new SafeSqliteStatementHandle(db, wrapper);
}
catch
{
raw.sqlite3_finalize(wrapper);
throw;
}
}

public static SafeSqliteBlobHandle sqlite3_blob_open(SafeSqliteHandle db, string sdb, string table, string col, long rowid, int flags, out Result result)
{
using var _ = db.Lease();

result = (Result)raw.sqlite3_blob_open(db.DangerousGetHandle(), sdb, table, col, rowid, flags, out var wrapper);
if (result != (int)Result.OK)
{
wrapper = null;
}

try
{
// Always return a non-null handle to match default P/Invoke marshaling behavior. SafeHandle.IsInvalid
// will be true when the handle is not usable, but the handle instance can be disposed either way.
return new SafeSqliteBlobHandle(db, wrapper);
}
catch
{
raw.sqlite3_blob_close(wrapper);
throw;
}
}

public static string sqlite3_errmsg(SafeSqliteHandle db)
{
using var _ = db.Lease();
return raw.sqlite3_errmsg(db.DangerousGetHandle());
}

public static string sqlite3_errstr(int rc)
{
return raw.sqlite3_errstr(rc);
}

public static int sqlite3_extended_errcode(SafeSqliteHandle db)
{
using var _ = db.Lease();
return raw.sqlite3_extended_errcode(db.DangerousGetHandle());
}

public static Result sqlite3_busy_timeout(SafeSqliteHandle db, int ms)
{
using var _ = db.Lease();
return (Result)raw.sqlite3_busy_timeout(db.DangerousGetHandle(), ms);
}

public static long sqlite3_last_insert_rowid(SafeSqliteHandle db)
{
using var _ = db.Lease();
return raw.sqlite3_last_insert_rowid(db.DangerousGetHandle());
}

public static int sqlite3_blob_bytes(SafeSqliteBlobHandle blob)
{
using var _ = blob.Lease();
return raw.sqlite3_blob_bytes(blob.DangerousGetHandle());
}

public static Result sqlite3_blob_read(SafeSqliteBlobHandle blob, byte[] b, int n, int offset)
{
using var _ = blob.Lease();
return (Result)raw.sqlite3_blob_read(blob.DangerousGetHandle(), b, n, offset);
}

public static Result sqlite3_reset(SafeSqliteStatementHandle stmt)
{
using var _ = stmt.Lease();
return (Result)raw.sqlite3_reset(stmt.DangerousGetHandle());
}

public static Result sqlite3_step(SafeSqliteStatementHandle stmt)
{
using var _ = stmt.Lease();
return (Result)raw.sqlite3_step(stmt.DangerousGetHandle());
}

public static Result sqlite3_bind_text(SafeSqliteStatementHandle stmt, int index, string val)
{
using var _ = stmt.Lease();
return (Result)raw.sqlite3_bind_text(stmt.DangerousGetHandle(), index, val);
}

public static Result sqlite3_bind_int64(SafeSqliteStatementHandle stmt, int index, long val)
{
using var _ = stmt.Lease();
return (Result)raw.sqlite3_bind_int64(stmt.DangerousGetHandle(), index, val);
}

public static byte[] sqlite3_column_blob(SafeSqliteStatementHandle stmt, int index)
{
using var _ = stmt.Lease();
return raw.sqlite3_column_blob(stmt.DangerousGetHandle(), index);
}

public static int sqlite3_column_int(SafeSqliteStatementHandle stmt, int index)
{
using var _ = stmt.Lease();
return raw.sqlite3_column_int(stmt.DangerousGetHandle(), index);
}

public static long sqlite3_column_int64(SafeSqliteStatementHandle stmt, int index)
{
using var _ = stmt.Lease();
return raw.sqlite3_column_int64(stmt.DangerousGetHandle(), index);
}

public static string sqlite3_column_text(SafeSqliteStatementHandle stmt, int index)
{
using var _ = stmt.Lease();
return raw.sqlite3_column_text(stmt.DangerousGetHandle(), index);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.SQLite.Interop
internal enum Result
{
OK = 0, /* Successful result */
// ERROR = 1, /* SQL error or missing database */
ERROR = 1, /* SQL error or missing database */
// INTERNAL = 2, /* Internal logic error in SQLite */
// PERM = 3, /* Access permission denied */
// ABORT = 4, /* Callback routine requested an abort */
Expand Down
Loading