Skip to content

Commit 4c81d97

Browse files
committed
Cleaned up all warnings
Warnings are now treated as errors
1 parent 3ab0ce8 commit 4c81d97

25 files changed

Lines changed: 268 additions & 60 deletions

src/CommonAssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
// Contains assembly attributes shared by all Npgsql projects
88

9-
[assembly: CLSCompliantAttribute(true)]
9+
[assembly: CLSCompliant(false)]
1010
[assembly: AllowPartiallyTrustedCallersAttribute()]
1111
[assembly: SecurityRules(SecurityRuleSet.Level1)]
1212
[assembly: AssemblyCompanyAttribute("Npgsql Development Team")]

src/Npgsql/Common.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ internal abstract class FrontendMessage {}
5555
internal abstract class SimpleFrontendMessage : FrontendMessage
5656
{
5757
/// <summary>
58-
/// Returns the number of bytes needed to write this message. Can only be called after
59-
/// <see cref="FrontendMessage.Prepare"/> has been called.
58+
/// Returns the number of bytes needed to write this message.
6059
/// </summary>
6160
internal abstract int Length { get; }
6261

src/Npgsql/Logging/NpgsqlLogLevel.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
namespace Npgsql.Logging
1+
#pragma warning disable 1591
2+
namespace Npgsql.Logging
23
{
34
public enum NpgsqlLogLevel
45
{

src/Npgsql/Logging/NpgsqlLogger.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5+
#pragma warning disable 1591
56

67
namespace Npgsql.Logging
78
{

src/Npgsql/Npgsql.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
<CodeContractsRuntimeCheckingLevel>Full</CodeContractsRuntimeCheckingLevel>
9292
<CodeContractsReferenceAssembly>Build</CodeContractsReferenceAssembly>
9393
<CodeContractsAnalysisWarningLevel>0</CodeContractsAnalysisWarningLevel>
94+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
9495
</PropertyGroup>
9596
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-net45|AnyCPU' ">
9697
<DebugType>pdbonly</DebugType>
@@ -480,12 +481,12 @@
480481
<Error Condition="!Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=317567." HelpKeyword="BCLBUILD2001" />
481482
<Error Condition="Exists('..\..\packages\Microsoft.Bcl.Build.1.0.14\tools\Microsoft.Bcl.Build.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://go.microsoft.com/fwlink/?LinkID=317568." HelpKeyword="BCLBUILD2002" />
482483
</Target>
483-
<Import Project="..\..\packages\AsyncRewriter.0.5.1-beta\build\AsyncRewriter.targets" Condition="Exists('..\..\packages\AsyncRewriter.0.5.1-beta\build\AsyncRewriter.targets')" />
484+
<Import Project="..\..\packages\AsyncRewriter.0.5.2-beta\build\AsyncRewriter.targets" Condition="Exists('..\..\packages\AsyncRewriter.0.5.2-beta\build\AsyncRewriter.targets')" />
484485
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
485486
<PropertyGroup>
486487
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
487488
</PropertyGroup>
488-
<Error Condition="!Exists('..\..\packages\AsyncRewriter.0.5.1-beta\build\AsyncRewriter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\AsyncRewriter.0.5.1-beta\build\AsyncRewriter.targets'))" />
489+
<Error Condition="!Exists('..\..\packages\AsyncRewriter.0.5.2-beta\build\AsyncRewriter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\AsyncRewriter.0.5.2-beta\build\AsyncRewriter.targets'))" />
489490
</Target>
490491
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
491492
Other similar extension points exist, see Microsoft.Common.targets.

src/Npgsql/Npgsql.xproj

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
<Project ToolsVersion="__ToolsVersion__" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
55
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
66
</PropertyGroup>
7+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
78
<PropertyGroup Label="Globals">
8-
<ProjectGuid>9D13B739-62B1-4190-B386-7A9547304EB3</ProjectGuid>
9-
<RootNamespace>Npgsql</RootNamespace>
10-
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
11-
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
12-
<SccProjectName>
13-
</SccProjectName>
14-
<SccProvider>
15-
</SccProvider>
16-
<SccAuxPath>
17-
</SccAuxPath>
18-
<SccLocalPath>
19-
</SccLocalPath>
9+
<ProjectGuid>470b4d0c-e44f-4989-aa38-1e237e9d1b11</ProjectGuid>
2010
</PropertyGroup>
21-
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
22-
<AssemblyName>Npgsql</AssemblyName>
11+
12+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'" Label="Configuration">
13+
</PropertyGroup>
14+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'" Label="Configuration">
2315
</PropertyGroup>
2416
<PropertyGroup>
2517
<SchemaVersion>2.0</SchemaVersion>
2618
</PropertyGroup>
27-
<ProjectExtensions>
28-
<VisualStudio>
29-
<UserProperties project_1json__JSONSchema="http://www.asp.net/media/4878834/project.json" />
30-
</VisualStudio>
31-
</ProjectExtensions>
32-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" />
33-
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" />
19+
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
3420
</Project>

src/Npgsql/NpgsqlBinaryExporter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,9 @@ void CheckDisposed()
232232

233233
#region Close / Dispose
234234

235+
/// <summary>
236+
/// Completes that binary export and sets the connection back to idle state
237+
/// </summary>
235238
public void Dispose()
236239
{
237240
if (_isDisposed) { return; }

src/Npgsql/NpgsqlBinaryImporter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ public void Cancel()
277277
}
278278
}
279279

280+
/// <summary>
281+
/// Completes that binary import and sets the connection back to idle state
282+
/// </summary>
280283
public void Dispose() { Close(); }
281284

282285
/// <summary>

src/Npgsql/NpgsqlBuffer.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ internal void Ensure(int count)
9797
}
9898
}
9999

100-
[RewriteAsync]
101100
internal void ReadMore()
102101
{
103102
Ensure(ReadBytesLeft + 1);
@@ -377,10 +376,6 @@ internal void ReadBytesSimple(byte[] output, int outputOffset, int len)
377376
ReadPosition += len;
378377
}
379378

380-
/// <summary>
381-
/// </summary>
382-
/// <param name="readAll">whether to loop internally until all bytes are read,
383-
/// or return after a single read to the underlying stream</param>
384379
internal int ReadBytes(byte[] output, int outputOffset, int len, bool readAll=false)
385380
{
386381
if (len <= ReadBytesLeft)
@@ -414,6 +409,8 @@ internal int ReadBytes(byte[] output, int outputOffset, int len, bool readAll=fa
414409
/// <param name="charCount">number of character to be read into the output buffer</param>
415410
/// <param name="byteCount">number of bytes left in the field. This method will not read bytes
416411
/// beyond this count</param>
412+
/// <param name="bytesRead">The number of bytes actually read.</param>
413+
/// <param name="charsRead">The number of characters actually read.</param>
417414
/// <returns>the number of bytes read</returns>
418415
internal void ReadChars(char[] output, int outputOffset, int charCount, int byteCount, out int bytesRead, out int charsRead)
419416
{
@@ -460,6 +457,8 @@ internal void ReadChars(char[] output, int outputOffset, int charCount, int byte
460457
/// int.MaxValue means all available characters (limited only by <paramref name="byteCount"/>).
461458
/// </param>
462459
/// <param name="byteCount">the maximal number of bytes to process</param>
460+
/// <param name="bytesSkipped">The number of bytes actually skipped.</param>
461+
/// <param name="charsSkipped">The number of characters actually skipped.</param>
463462
/// <returns>the number of bytes read</returns>
464463
internal void SkipChars(int charCount, int byteCount, out int bytesSkipped, out int charsSkipped)
465464
{

src/Npgsql/NpgsqlCommand.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,10 @@ public sealed partial class NpgsqlCommand : DbCommand
7575

7676
int _queryIndex;
7777

78-
// locals about function support so we don`t need to check it everytime a function is called.
79-
bool _functionChecksDone;
80-
bool _functionNeedsColumnListDefinition; // Functions don't return record by default.
81-
8278
UpdateRowSource _updateRowSource = UpdateRowSource.Both;
8379

8480
internal Type[] ExpectedTypes { get; set; }
8581

86-
FormatCode[] _resultFormatCodes;
87-
8882
/// <summary>
8983
/// Indicates whether this command has been prepared.
9084
/// Never access this field directly, use <see cref="IsPrepared"/> instead.
@@ -176,7 +170,6 @@ public override String CommandText
176170
// [TODO] Validate commandtext.
177171
_commandText = value;
178172
DeallocatePrepared();
179-
_functionChecksDone = false;
180173
}
181174
}
182175

@@ -374,7 +367,7 @@ public bool[] UnknownResultTypeList
374367

375368
#region State management
376369

377-
volatile int _state;
370+
int _state;
378371

379372
/// <summary>
380373
/// Gets the current state of the connector
@@ -934,6 +927,12 @@ object ExecuteScalarInternal()
934927
return (NpgsqlDataReader)base.ExecuteReader(behavior);
935928
}
936929

930+
/// <summary>
931+
/// Executes the command text against the connection.
932+
/// </summary>
933+
/// <param name="behavior">An instance of <see cref="CommandBehavior"/>.</param>
934+
/// <param name="cancellationToken">A task representing the operation.</param>
935+
/// <returns></returns>
937936
#if NET40
938937
/// <summary>
939938
/// Executes the CommandText against the Connection, and returns an DbDataReader using one

0 commit comments

Comments
 (0)