Skip to content

Purge test warnings #671

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

Merged
merged 3 commits into from
Aug 15, 2017

Conversation

fredericDelaporte
Copy link
Member

For more easily avoiding adding new compilation warnings to any project, better avoid letting any anywhere.

This PR removes compilations warning from the test project.

An additional commit enables "warnings as errors" for release build. So the release build should detect if any warning is added back. I have not enabled it for debug for avoiding hindering debug session and temporarily fiddling with code.

It appears the Hql.g warnings are not considered by this setting, so they should not block the release build.

private int id;
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely most of those cases could have been fixed by using a setter instead. But this would require analyzing each test case for ensuring their current way of mapping the property was not having any bound with the tested feature.

// Test uses an obsolete .Net feature, changing the private path of an ongoing AppDomain.
// If that feature is dropped, the tests will likely need to be dropped too. (Or heavily changed
// for running in a newly created AppDomain.)
#pragma warning disable CS0618 // Type or member is obsolete
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not found a way to do that with non-obsolete methods and without spawning a new app domain for the test. It seems the used methods have been obsoleted precisely because they were altering private path for already created app domain, which the .Net designers seem to advise against.

@@ -2,11 +2,9 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Data;
using System.Diagnostics;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicated namespace probably due to a rebase miss.

Copy link
Member

@hazzik hazzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise

@@ -12,6 +12,11 @@
<NoWarn>$(NoWarn);3001;3002;3003;3005</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's good to treat warnings as errors for all configurations.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to give it a try with only the release build checking that. If that generates frequently PR failing at this but detected a bit too late (especially already merged), it would be easy and fast to change that.

@hazzik hazzik removed the to review label Aug 14, 2017
@hazzik hazzik added this to the 5.0 milestone Aug 14, 2017
@fredericDelaporte fredericDelaporte merged commit 59ba21f into nhibernate:master Aug 15, 2017
@fredericDelaporte fredericDelaporte deleted the TestWarnings branch August 15, 2017 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants