Skip to content

Commit 59ba21f

Browse files
Merge pull request #671 from fredericDelaporte/TestWarnings
Purge tests compilation warnings
2 parents 02a6315 + 4c3b169 commit 59ba21f

File tree

78 files changed

+266
-24
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+266
-24
lines changed

src/NHibernate.DomainModel/NHibernate.DomainModel.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
<NoWarn>$(NoWarn);3001;3002;3003;3005</NoWarn>
1313
</PropertyGroup>
1414

15+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
16+
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
17+
<TreatSpecificWarningsAsErrors />
18+
</PropertyGroup>
19+
1520
<ItemGroup>
1621
<None Remove="**\*.hbm.xml" />
1722
</ItemGroup>

src/NHibernate.Test/Generatedkeys/Identity/MyEntityIdentity.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ namespace NHibernate.Test.Generatedkeys.Identity
22
{
33
public class MyEntityIdentity
44
{
5+
// Assigned by reflection
6+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
57
private int id;
8+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
69
private string name;
710

811
public virtual int Id

src/NHibernate.Test/Generatedkeys/Select/MyEntity.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ namespace NHibernate.Test.Generatedkeys.Select
22
{
33
public class MyEntity
44
{
5+
// Assigned by reflection
6+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
57
private int id;
8+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
69
private string name;
710
protected MyEntity() {}
811

src/NHibernate.Test/Generatedkeys/Seqidentity/MyEntity.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ namespace NHibernate.Test.Generatedkeys.Seqidentity
22
{
33
public class MyEntity
44
{
5+
// Assigned by reflection
6+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
57
private int id;
8+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
69
private string name;
710

811
public virtual int Id

src/NHibernate.Test/Hql/Ast/KeyManyToOneEntity.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ namespace NHibernate.Test.Hql.Ast
44
{
55
public class KeyManyToOneEntity
66
{
7+
// Used by reflection
8+
#pragma warning disable CS0169 // The field is never used
79
private Id id;
10+
#pragma warning restore CS0169 // The field is never used
811
private string name;
912

1013
public virtual string Name

src/NHibernate.Test/Hql/Ast/KeyManyToOneKeyEntity.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ namespace NHibernate.Test.Hql.Ast
22
{
33
public class KeyManyToOneKeyEntity
44
{
5+
// Assigned by reflection
6+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
57
private long id;
8+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
69
private string name;
710
private int? requestedHash;
811

src/NHibernate.Test/IdGen/Enhanced/Forcedtable/Entity.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
public class Entity
44
{
55

6-
#pragma warning disable 0414 // unassigned variable
6+
// Assigned by reflection
7+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
78
private long _id;
8-
#pragma warning restore 0414
9+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
910

1011
public virtual long Id
1112
{

src/NHibernate.Test/IdGen/Enhanced/Sequence/Entity.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
{
33
public class Entity
44
{
5-
6-
#pragma warning disable 0414 // unassigned variable
5+
// Assigned by reflection
6+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value 0
77
private long _id;
8-
#pragma warning restore 0414
8+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value 0
99

1010
public virtual long Id
1111
{

src/NHibernate.Test/IdGen/Enhanced/Table/Entity.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ namespace NHibernate.Test.IdGen.Enhanced.Table
22
{
33
public class Entity
44
{
5-
6-
#pragma warning disable 0414 // unassigned variable
5+
// Assigned by reflection
6+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
77
private long _id;
8-
#pragma warning restore 0414
8+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
99

1010
public virtual long Id
1111
{

src/NHibernate.Test/MappingByCode/ConventionModelMapperTests/ComponetsAccessorTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ public class ComponetsAccessorTests
1010
private class MyClass
1111
{
1212
public int Id { get; set; }
13+
// Assigned by reflection
14+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1315
private MyCompo compo;
16+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1417
public MyCompo Compo
1518
{
1619
get { return compo; }

src/NHibernate.Test/MappingByCode/ConventionModelMapperTests/ComponetsParentAccessorTests.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,11 @@ private class MyClass
1717

1818
private class MyCompo
1919
{
20+
// Assigned by reflection
21+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
2022
private MyClass parent;
23+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
24+
2125
public MyClass Parent
2226
{
2327
get { return parent; }
@@ -28,7 +32,10 @@ public MyClass Parent
2832

2933
private class MyNestedCompo
3034
{
35+
// Assigned by reflection
36+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
3137
private MyCompo owner;
38+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
3239
public MyCompo Owner
3340
{
3441
get { return owner; }

src/NHibernate.Test/MappingByCode/ConventionModelMapperTests/PropertyToFieldAccessorTest.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ public class PropertyToFieldAccessorTest
1111
private class MyClass
1212
{
1313
public int Id { get; set; }
14+
// Used by reflection
15+
#pragma warning disable CS0169 // The field is never used
1416
private string aField;
17+
#pragma warning restore CS0169 // The field is never used
1518
public int AProp { get; set; }
1619

1720
private ICollection<int> withDifferentBackField;
@@ -21,7 +24,10 @@ public IEnumerable<int> WithDifferentBackField
2124
set { withDifferentBackField = value as ICollection<int>; }
2225
}
2326

27+
// Assigned by reflection
28+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
2429
private string readOnlyWithSameBackField;
30+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
2531
public string ReadOnlyWithSameBackField
2632
{
2733
get { return readOnlyWithSameBackField; }

src/NHibernate.Test/MappingByCode/ConventionModelMapperTests/SafePoidTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ private class MyClassWithoutPoid
1313

1414
private class MyClass
1515
{
16+
// Assigned by reflection
17+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1618
private int _id;
19+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1720
public int Id
1821
{
1922
get { return _id; }

src/NHibernate.Test/MappingByCode/ExplicitMappingTests/IdBagMappingTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class IdBagMappingTest
1212
private class Animal
1313
{
1414
public int Id { get; set; }
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private ICollection<Animal> children;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public ICollection<Animal> Children
1720
{
1821
get { return children; }

src/NHibernate.Test/MappingByCode/ExplicitMappingTests/MappingOfPrivateMembersOnRootEntity.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ public class MappingOfPrivateMembersOnRootEntity
99
{
1010
public class MyClass
1111
{
12+
// Used by reflection.
13+
#pragma warning disable CS0169 // The field is never used
1214
private int id;
1315
private int version;
1416
private string something;
17+
#pragma warning disable CS0169 // The field is never used
1518
}
1619

1720
[Test]

src/NHibernate.Test/MappingByCode/MappersTests/ClassMapperTests/CheckMixingPOIDStrategiesTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ private class PersonId
1313

1414
private class Person
1515
{
16+
// Assigned by reflection
17+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1618
private PersonId id;
19+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1720
public PersonId Id
1821
{
1922
get { return id; }

src/NHibernate.Test/MappingByCode/MappersTests/ClassMapperTests/ComponetAsIdTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ private class PersonId
1717

1818
private class Person
1919
{
20+
// Assigned by reflection
21+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
2022
private PersonId id;
23+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
2124
public PersonId Id
2225
{
2326
get { return id; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/AnyPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class AnyPropertyOnDynamicCompoTests
1212
private class Person
1313
{
1414
public int Id { get; set; }
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private IDictionary info;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public IDictionary Info
1720
{
1821
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/BagPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ public class BagPropertyOnDynamicCompoTests
1313
private class Person
1414
{
1515
public int Id { get; set; }
16+
// Assigned by reflection
17+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1618
private IDictionary info;
19+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1720
public IDictionary Info
1821
{
1922
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/ComponentPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class ComponentPropertyOnDynamicCompoTests
1212
private class Person
1313
{
1414
public int Id { get; set; }
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private IDictionary info;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public IDictionary Info
1720
{
1821
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/DynComponentPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class DynComponentPropertyOnDynamicCompoTests
1212
private class Person
1313
{
1414
public int Id { get; set; }
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private IDictionary info;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public IDictionary Info
1720
{
1821
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/IdBagPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ public class IdBagPropertyOnDynamicCompoTests
1313
private class Person
1414
{
1515
public int Id { get; set; }
16+
// Assigned by reflection
17+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1618
private IDictionary info;
19+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1720
public IDictionary Info
1821
{
1922
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/ListPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ public class ListPropertyOnDynamicCompoTests
1313
private class Person
1414
{
1515
public int Id { get; set; }
16+
// Assigned by reflection
17+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1618
private IDictionary info;
19+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1720
public IDictionary Info
1821
{
1922
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/ManyToOnePropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class ManyToOnePropertyOnDynamicCompoTests
1212
private class Person
1313
{
1414
public int Id { get; set; }
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private IDictionary info;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public IDictionary Info
1720
{
1821
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/MapPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ public class MapPropertyOnDynamicCompoTests
1313
private class Person
1414
{
1515
public int Id { get; set; }
16+
// Assigned by reflection
17+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1618
private IDictionary info;
19+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1720
public IDictionary Info
1821
{
1922
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/OneToOnePropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class OneToOnePropertyOnDynamicCompoTests
1212
private class Person
1313
{
1414
public int Id { get; set; }
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private IDictionary info;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public IDictionary Info
1720
{
1821
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/SetPropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ public class SetPropertyOnDynamicCompoTests
1313
private class Person
1414
{
1515
public int Id { get; set; }
16+
// Assigned by reflection
17+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1618
private IDictionary info;
19+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1720
public IDictionary Info
1821
{
1922
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/DynamicComponentMapperTests/SimplePropertyOnDynamicCompoTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class SimplePropertyOnDynamicCompoTests
1212
private class Person
1313
{
1414
public int Id { get; set; }
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private IDictionary info;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public IDictionary Info
1720
{
1821
get { return info; }

src/NHibernate.Test/MappingByCode/MappersTests/IdMapperTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,10 @@ public void CanSetGeneratorEnhancedTable()
116116
}
117117
private class BaseEntity
118118
{
119+
// Assigned by reflection
120+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
119121
private int id;
122+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
120123

121124
public int Id
122125
{

src/NHibernate.Test/MappingByCode/MappersTests/PropertyMapperTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ public class MyType : IUserType
324324
{
325325
#region Implementation of IUserType
326326

327-
public bool Equals(object x, object y)
327+
public new bool Equals(object x, object y)
328328
{
329329
throw new NotImplementedException();
330330
}
@@ -394,7 +394,7 @@ public void SetPropertyValue(object component, int property, object value)
394394
throw new NotImplementedException();
395395
}
396396

397-
public bool Equals(object x, object y)
397+
public new bool Equals(object x, object y)
398398
{
399399
throw new NotImplementedException();
400400
}

src/NHibernate.Test/MappingByCode/MixAutomapping/ArrayCollectionTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ public class ArrayCollectionTests
99
{
1010
private class Entity
1111
{
12+
// Assigned by reflection
13+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1214
private ICollection<string> others;
1315
private string[] emails;
16+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1417
public string[] NickNames { get; set; }
1518
public byte[] Photo { get; set; }
1619

src/NHibernate.Test/MappingByCode/MixAutomapping/BagCollectionTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ public class BagCollectionTests
1212
// match any IEnumerable
1313
private class Entity
1414
{
15+
// Assigned by reflection
16+
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value
1517
private ICollection<string> emails;
18+
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
1619
public IEnumerable<string> NickNames { get; set; }
1720
public byte[] Bytes { get; set; }
1821
public object Emails

0 commit comments

Comments
 (0)