I have this code:
public UnityResolver(IUnityContainer container)
{
if (container == null) throw new ArgumentNullException("container");
_container = container;
}
Visual Studio shows 3 grey dots and suggests to simplify the null check.
It makes the method this:
_container = container ?? throw new ArgumentNullException("container");
That don't build...
What's going on here? Why does it think it can simplify this and why is it simplifying it to something that doesn't build.
The error is gives is:
1>L:\SL1-(SentiLAN)-SentiLAN v1 - Current System\SentilanCore\WEB API with Plugins\APITest2\App_Start\UnityConfig.cs(31,39,31,44): error CS1525: Invalid expression term 'throw'
1>L:\SL1-(SentiLAN)-SentiLAN v1 - Current System\SentilanCore\WEB API with Plugins\APITest2\App_Start\UnityConfig.cs(31,39,31,44): error CS1002: ; expected
Its a compiler issue, code is valid. they updated the version and fixed the error in the latest update(few hours ago). you can download the update if the notification pops up or from the website.
Or simply update the Microsoft compiler version, since it wasn't included in the VS 2017...
Install-Package Microsoft.Net.Compilers -Version 2.3.0
is the latest i think
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With