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

ServiceController constructor throws exception with Nuget library 9.0 in .NET6 #110354

Closed
vsfeedback opened this issue Dec 3, 2024 · 3 comments
Closed
Assignees
Labels
area-System.ServiceProcess needs-author-action An issue or pull request that requires more info or actions from the author.

Comments

@vsfeedback
Copy link

This issue has been moved from a ticket on Developer Community.


[severity:It's more difficult to complete my work]
My .NET6 application works with the 8.1 ServiceController nuget library. I updated to the 9.0 library and the ServiceController constructor now throws a System.PlatformNotSupportedException.

public const string FriendlyServiceName = "Woodward File Collection Service";

Here is the line that throws the exception:
_serviceController = new ServiceController(FriendlyServiceName);

I reverted to the 8.1 ServiceController library. This works fine for now, but I'd like to know if there's a better solution.


Original Comments

Feedback Bot on 11/18/2024, 04:14 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 3, 2024
@ViktorHofer
Copy link
Member

@ DougWatt,

This is expected as the minimum supported runtimes for the System.ServiceProcess.ServiceController package are .NET Framework 4.6.2 and .NET 8.0. You should see the following warning at build time already:

System.ServiceProcess.ServiceController 9.0.0 doesn't support net6.0 and has not been tested with it. Consider upgrading your TargetFramework to net8.0 or later. You may also set <SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings> in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.

Please either downgrade the package back to 8.0.1 or update your TFM to an in-support version, i.e. net8.0. Note that .NET 6 is already out-of-support.

@ViktorHofer ViktorHofer added needs-author-action An issue or pull request that requires more info or actions from the author. and removed untriaged New issue has not been triaged by the area owner labels Dec 3, 2024
@ericstj ericstj added this to the 10.0.0 milestone Dec 3, 2024
@dotnet-policy-service dotnet-policy-service bot removed this from the 10.0.0 milestone Jan 1, 2025
@Varorbc
Copy link
Contributor

Varorbc commented Jan 21, 2025

@ViktorHofer Hey, shouldn't we rethink which target frameworks we're aiming for? It would be better if users couldn't install it at all when their framework isn't supported, instead of letting them go through with the installation and then getting warnings. Chances are, some users won't pay attention to those warnings anyway.

@ViktorHofer
Copy link
Member

@Varorbc as you know, we already had this in length discussion in #107081 and open-telemetry/opentelemetry-dotnet#3448. Yes, the current situation isn't great. As long as our packages support .NET Standard (so that class libraries which target .NET Standard can consume them) we need to rely on warnings. Note that initially the warning was even an error but we had to dial back on that. If we would want better UX around this, we would need a new tooling feature (NuGet packages indicating compatibility holes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.ServiceProcess needs-author-action An issue or pull request that requires more info or actions from the author.
Projects
None yet
Development

No branches or pull requests

4 participants