{"id":349707,"date":"2023-07-04T09:00:46","date_gmt":"2023-07-04T09:00:46","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=349707"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=349707","title":{"rendered":"<span>\u0418\u0437\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0432 \u043a\u043e\u0434\u0435 AWS SDK \u0434\u043b\u044f .NET<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/83d\/455\/603\/83d45560365447d27877cc75f95a730f.png\" alt=\"1057_AWS_SDK_NET_ru\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/83d\/455\/603\/83d45560365447d27877cc75f95a730f.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0434 \u043d\u0430\u0448\u0438\u043c \u0441\u043a\u0430\u043b\u044c\u043f\u0435\u043b\u0435\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 AWS SDK \u0434\u043b\u044f .NET. \u041c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0447\u0442\u043e \u0432 \u043d\u0438\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0417\u0430\u0432\u0430\u0440\u0438\u0432\u0430\u0439\u0442\u0435 \u043a\u043e\u0444\u0435 \u0438 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043f\u043e\u0443\u0434\u043e\u0431\u043d\u0435\u0435.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"nemnogo-detaley-ob-analize\">\u041d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u043e\u0431 \u0430\u043d\u0430\u043b\u0438\u0437\u0435<\/h2>\n<p>  <\/p>\n<p><strong>\u0427\u0442\u043e \u0437\u0430 \u043f\u0440\u043e\u0435\u043a\u0442?<\/strong><\/p>\n<p>  <\/p>\n<p>AWS.SDK \u0434\u043b\u044f .NET \u2014 \u043f\u0440\u043e\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 Amazon Web Services, Amazon S3, Amazon DynamoDB \u0438 \u0442. \u043f. \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0432\u0437\u044f\u043b \u0441\u043e <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\">\u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430 GitHub<\/a>. \u0415\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u0430 \u0442\u043e\u0447\u043d\u0430\u044f \u0432\u0435\u0440\u0441\u0438\u044f, \u0432\u043e\u0442 SHA \u043a\u043e\u043c\u043c\u0438\u0442\u0430: 93a94821dc8ff7a0073b74def6549728da3b51c7.<\/p>\n<p>  <\/p>\n<p><strong>\u0427\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b\u0438?<\/strong><\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/\">\u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c PVS-Studio<\/a> \u0447\u0435\u0440\u0435\u0437 \u043f\u043b\u0430\u0433\u0438\u043d \u0434\u043b\u044f Visual Studio. <\/p>\n<p>  <\/p>\n<p><strong>\u0427\u0442\u043e-\u0442\u043e \u0435\u0449\u0451?<\/strong><\/p>\n<p>  <\/p>\n<p>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f \u0432\u0430\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u044b\u043c\u0438 \u2014 \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u043a\u043e\u0434 \u043d\u0435 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0441\u044f \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/csharp\/0605\/\">\u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/a>. \u0415\u0441\u043b\u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043c\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c\u0438, \u044f \u0434\u0443\u0431\u043b\u0438\u0440\u043e\u0432\u0430\u043b \u0438\u0445 \u0432 \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0445\u0432\u0430\u0442\u0438\u0442 \u043e \u0434\u0435\u0442\u0430\u043b\u044f\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0440\u0430\u0437\u0431\u043e\u0440\u0443 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043c\u0435\u0441\u0442 \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>  <\/p>\n<h2 id=\"razbor-podozritelnyh-fragmentov-koda\">\u0420\u0430\u0437\u0431\u043e\u0440 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u043e\u0432 \u043a\u043e\u0434\u0430<\/h2>\n<p>  <\/p>\n<p><strong>Issue #1<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public static object GetAttr(object value, string path) {   if (string.IsNullOrEmpty(path)) throw new ArgumentNullException(\"path\");    var parts = path.Split('.');   var propertyValue = value;    for (int i = 0; i &lt; parts.Length; i++)   {     var part = parts[i];      \/\/ indexer is always at the end of path e.g. \"Part1.Part2[3]\"     if (i == parts.Length - 1)     {       ....       \/\/ indexer detected       if (indexerStart >= 0)       {         ....         if (!(propertyValue is IList))            throw              new ArgumentException(\"Object addressing by pathing segment '{part}'                                    with indexer must be IList\");         ....       }     }     if (!(propertyValue is IPropertyBag))       throw         new ArgumentException(\"Object addressing by pathing segment '{part}'                               must be IPropertyBag\");    ....   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Core\/Amazon.Runtime\/Internal\/Endpoints\/StandardLibrary\/Fn.cs#L82\">#1<\/a>, <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Core\/Amazon.Runtime\/Internal\/Endpoints\/StandardLibrary\/Fn.cs#L93\">#2<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3138<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>String literal contains potential interpolated expression. Consider inspecting: part. Fn.cs 82<\/p>\n<p>  <\/p>\n<p>String literal contains potential interpolated expression. Consider inspecting: part. Fn.cs 93<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0437\u0430\u0431\u044b\u043b \u0438\u043d\u0442\u0435\u0440\u043f\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u0418\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u0432\u043c\u0435\u0441\u0442\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>part<\/em> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b <em>{part}<\/em>.<\/p>\n<p>  <\/p>\n<p><strong>Issue #2<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private CredentialsRefreshState Authenticate(ICredentials userCredential) {   ....   ICoreAmazonSTS coreSTSClient = null;   try   {     ....      coreSTSClient =         ServiceClientHelpers.CreateServiceFromAssembly&lt;ICoreAmazonSTS>(....);   }   catch (Exception e)   {     ....   }    var samlCoreSTSClient #if NETSTANDARD     = coreSTSClient as ICoreAmazonSTS_SAML;   if (coreSTSClient == null)   {     throw new NotImplementedException(       \"The currently loaded version of AWSSDK.SecurityToken         doesn't support SAML authentication.\");   } #else     = coreSTSClient; #endif    try   {     var credentials = samlCoreSTSClient.CredentialsFromSAMLAuthentication(....);   }   catch (Exception e)   {     var wrappedException =        new AmazonClientException(\"Credential generation from                                   SAML authentication failed.\",                                  e);      var logger = Logger.GetLogger(typeof(FederatedAWSCredentials));     logger.Error(wrappedException, wrappedException.Message);      throw wrappedException;   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Core\/Amazon.Runtime\/Credentials\/FederatedAWSCredentials.cs#L219\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3019<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>Possibly an incorrect variable is compared to null after type conversion using &#8216;as&#8217; keyword. Check variables &#8216;coreSTSClient&#8217;, &#8216;samlCoreSTSClient&#8217;. FederatedAWSCredentials.cs 219<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u043d\u0443\u0436\u0435\u043d \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0433\u043e \u043f\u043e\u043d\u0438\u043c\u0430\u043d\u0438\u044f \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430. \u0421\u0430\u043c\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0441\u043f\u0440\u044f\u0442\u0430\u043b\u0430\u0441\u044c \u0437\u0434\u0435\u0441\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var samlCoreSTSClient #if NETSTANDARD   = coreSTSClient as ICoreAmazonSTS_SAML; if (coreSTSClient == null) {   throw new NotImplementedException(     \"The currently loaded version of AWSSDK.SecurityToken       doesn't support SAML authentication.\"); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u0445\u043e\u0436\u0435, \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>if<\/em> \u043d\u0430 <em>null<\/em> \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u2014 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c <em>samlCoreSTSClient<\/em>. <\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0438\u0440\u0443\u044e\u0449\u0435\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u2014 <em>samlCoreSTSClient<\/em>;<\/li>\n<li>\u0442\u0438\u043f \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u2014 <em>ICoreAmazonSTS_SAML<\/em>;<\/li>\n<li>\u0442\u0435\u043a\u0441\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u2014 <em>&#171;\u2026 doesn&#8217;t support SAML authentication&#187;<\/em>. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>SAML \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0432\u0435\u0437\u0434\u0435, \u043a\u0440\u043e\u043c\u0435 \u0438\u043c\u0435\u043d\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u2014 <em>coreSTSClient<\/em>. \ud83d\ude42<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u043a\u0430\u043a \u0438\u0437-\u0437\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430, \u0435\u0441\u043b\u0438 \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043d\u0435 \u0443\u0434\u0430\u0451\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 <em>samlCoreSTSClient<\/em>: <\/p>\n<p>  <\/p>\n<ul>\n<li>-> \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>as<\/em><\/li>\n<li>-> \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>samlCoreSTSClient<\/em> \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <em>null<\/em><\/li>\n<li>-> \u0432\u044b\u0431\u0440\u043e\u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>NotImplementedException<\/em> <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 <em>coreSTSClient<\/em>: <\/p>\n<p>  <\/p>\n<ul>\n<li>-> \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>as<\/em><\/li>\n<li>-> \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>coreSTSClient<\/em> \u043d\u0430 \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <em>null<\/em><\/li>\n<li>-> \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <em>CredentialsFromSAMLAuthentication<\/em><\/li>\n<li>-> \u0432\u044b\u0431\u0440\u043e\u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>NullReferenceException<\/em> <\/li>\n<li>-> \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0432 <em>catch<\/em><\/li>\n<li>-> \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b <\/li>\n<li>-> \u0432\u044b\u0431\u0440\u043e\u0441 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>AmazonClientException.<\/em> <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0422\u043e \u0435\u0441\u0442\u044c \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0432\u043e \u0432\u043d\u0435\u0448\u043d\u0438\u0439 \u043a\u043e\u0434 \u043f\u0440\u0438\u043b\u0435\u0442\u0438\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u0438 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435\u043c. <\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u043e\u0431\u0449\u0435 \u0433\u043e\u0432\u043e\u0440\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0435 \u0442\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u043e\u0441\u043b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>as<\/em> \u2014 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0451\u043d\u043d\u044b\u0439 \u043f\u0430\u0442\u0442\u0435\u0440\u043d \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 C#. <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/examples\/v3019\/\">\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u044b<\/a>.<\/p>\n<p>  <\/p>\n<p><strong>Issue #3<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public static class EC2InstanceMetadata {   [Obsolete(\"EC2_METADATA_SVC is obsolete, refer to ServiceEndpoint               instead to respect environment and profile overrides.\")]   public static readonly string EC2_METADATA_SVC = \"http:\/\/169.254.169.254\";    [Obsolete(\"EC2_METADATA_ROOT is obsolete, refer to EC2MetadataRoot               instead to respect environment and profile overrides.\")]   public static readonly string      EC2_METADATA_ROOT = EC2_METADATA_SVC + LATEST + \"\/meta-data\";    [Obsolete(\"EC2_USERDATA_ROOT is obsolete, refer to EC2UserDataRoot               instead to respect environment and profile overrides.\")]   public static readonly string      EC2_USERDATA_ROOT = EC2_METADATA_SVC + LATEST + \"\/user-data\";    [Obsolete(\"EC2_DYNAMICDATA_ROOT is obsolete, refer to EC2DynamicDataRoot               instead to respect environment and profile overrides.\")]   public static readonly string      EC2_DYNAMICDATA_ROOT = EC2_METADATA_SVC + LATEST + \"\/dynamic\";    [Obsolete(\"EC2_APITOKEN_URL is obsolete, refer to EC2ApiTokenUrl               instead to respect environment and profile overrides.\")]   public static readonly string      EC2_APITOKEN_URL = EC2_METADATA_SVC + LATEST + \"\/api\/token\";    public static readonly string     LATEST = \"\/latest\",     AWS_EC2_METADATA_DISABLED = \"AWS_EC2_METADATA_DISABLED\";   .... }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Core\/Amazon.Util\/EC2InstanceMetadata.cs#L57\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3070<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>Uninitialized variable &#8216;LATEST&#8217; is used when initializing the &#8216;EC2_METADATA_ROOT&#8217; variable. EC2InstanceMetadata.cs 57<\/p>\n<p>  <\/p>\n<p>Uninitialized variable &#8216;LATEST&#8217; is used when initializing the &#8216;EC2_USERDATA_ROOT&#8217; variable. EC2InstanceMetadata.cs 60<\/p>\n<p>  <\/p>\n<p>Uninitialized variable &#8216;LATEST&#8217; is used when initializing the &#8216;EC2_DYNAMICDATA_ROOT&#8217; variable. EC2InstanceMetadata.cs 63<\/p>\n<p>  <\/p>\n<p>Uninitialized variable &#8216;LATEST&#8217; is used when initializing the &#8216;EC2_APITOKEN_URL&#8217; variable. EC2InstanceMetadata.cs 66<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u0438 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435\u0439. <\/p>\n<p>  <\/p>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043f\u043e\u043b\u044f <em>EC2_APITOKEN_URL<\/em>, <em>EC2_DYNAMICDATA_ROOT<\/em>, <em>EC2_USERDATA_ROOT<\/em>, <em>EC2_METADATA_ROOT. <\/em>\u041a\u0430\u0436\u0434\u043e\u0435 \u0438\u0437 \u043d\u0438\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u0432 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0435 \u043f\u043e\u043b\u0435 <em>LATEST<\/em>. \u041e\u0434\u043d\u0430\u043a\u043e \u0441\u0430\u043c\u043e \u043f\u043e\u043b\u0435 \u043d\u0430 \u043c\u043e\u043c\u0435\u043d\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0435\u0449\u0451 \u043d\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u043e \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0438\u0436\u0435 \u043f\u043e \u043a\u043e\u0434\u0443. \u041a\u0430\u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u0440\u0438 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043f\u043e\u043b\u0435\u0439 <em>EC2_*<\/em> \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0435 \u0441\u0442\u0440\u043e\u043a\u0430 <em>&#171;\/latest&#187;<\/em>, \u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>default(string)<\/em> \u2014 <em>null<\/em>. <\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u043c \u0432\u044b\u0448\u0435 \u043b\u0435\u0433\u043a\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u043e\u0431\u0440\u0430\u0442\u0438\u0432\u0448\u0438\u0441\u044c \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 API:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var arr = new[] {   EC2InstanceMetadata.EC2_APITOKEN_URL,   EC2InstanceMetadata.EC2_DYNAMICDATA_ROOT,   EC2InstanceMetadata.EC2_USERDATA_ROOT,   EC2InstanceMetadata.EC2_METADATA_ROOT };  foreach(var item in arr)   Console.WriteLine(item);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/wu\/te\/qr\/wuteqrsety2wdcuom8hjufclzf8.png\" alt=\"1057_AWS_SDK_NET_ru\/image2.png\" data-src=\"https:\/\/habrastorage.org\/webt\/wu\/te\/qr\/wuteqrsety2wdcuom8hjufclzf8.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043d\u0438 \u0432 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0435\u0442 \u043b\u0438\u0442\u0435\u0440\u0430\u043b\u0430 <em>&#171;\/latest&#187;<\/em>. <\/p>\n<p>  <\/p>\n<p>\u0410 \u0432\u043e\u0442 \u043e\u0448\u0438\u0431\u043a\u0430 \u044d\u0442\u043e \u0438\u043b\u0438 \u043d\u0435\u0442 \u2014 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0439. \u041f\u043e\u0440\u044f\u0434\u043e\u043a \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0435\u0439 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0438 <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/commit\/8cf5524d5a5cb2b6749c3d1e465770390e420a13\">\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c \u043a\u043e\u043c\u043c\u0438\u0442\u043e\u043c<\/a>. \u0412 \u044d\u0442\u043e\u043c \u0436\u0435 \u043a\u043e\u043c\u043c\u0438\u0442\u0435 \u043f\u043e\u043b\u044f \u0434\u0435\u043a\u043e\u0440\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u043e\u043c <em>Obsolete<\/em>. \u0425\u043e\u0442\u044f \u0435\u0441\u043b\u0438 \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>LATEST<\/em>, \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0435\u0433\u043e \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c. \u0422\u0430\u043a \u043a\u043e\u0434 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0438\u043a\u043e\u0433\u043e \u0441\u043c\u0443\u0449\u0430\u0442\u044c. <\/p>\n<p>  <\/p>\n<p><strong>Issue #4<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public IRequest Marshall(GetObjectTorrentRequest getObjectTorrentRequest) {   IRequest request = new DefaultRequest(getObjectTorrentRequest, \"AmazonS3\");    request.HttpMethod = \"GET\";    if (getObjectTorrentRequest.IsSetRequestPayer())     request.Headers            .Add(S3Constants.AmzHeaderRequestPayer,                   S3Transforms.ToStringValue(getObjectTorrentRequest.RequestPayer                                                                   .ToString()));    if (getObjectTorrentRequest.IsSetRequestPayer())     request.Headers            .Add(S3Constants.AmzHeaderRequestPayer,                  S3Transforms.ToStringValue(getObjectTorrentRequest.RequestPayer                                                                   .ToString()));    if (getObjectTorrentRequest.IsSetExpectedBucketOwner())     request.Headers            .Add(S3Constants.AmzHeaderExpectedBucketOwner,                  S3Transforms.ToStringValue(                   getObjectTorrentRequest.ExpectedBucketOwner));   .... }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Services\/S3\/Custom\/Model\/Internal\/MarshallTransformations\/GetObjectTorrentRequestMarshaller.cs#L43\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>. <\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3029<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>The conditional expressions of the &#8216;if&#8217; statements situated alongside each other are identical. Check lines: 41, 43. GetObjectTorrentRequestMarshaller.cs 41<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u0435 \u0434\u0432\u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>if<\/em> \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u0434\u0443\u0431\u043b\u0438\u0440\u0443\u044e\u0442 \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430 \u043a\u0430\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u044f\u043c\u0438, \u0442\u0430\u043a \u0438 \u0442\u0435\u043b\u0430\u043c\u0438. \u0418\u043b\u0438 \u043e\u0434\u0438\u043d \u0438\u0437 \u043d\u0438\u0445 \u043b\u0438\u0448\u043d\u0438\u0439 \u0438 \u0435\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c, \u0438\u043b\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0435 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f.<\/p>\n<p>  <\/p>\n<p><strong>Issue #5<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public string Region  {    get    {     if (String.IsNullOrEmpty(this.linker.s3.region))     {       return \"us-east-1\";     }     return this.linker.s3.region;    }     set    {     if (String.IsNullOrEmpty(value))     {       this.linker.s3.region = \"us-east-1\";     }     this.linker.s3.region = value;    }  }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Services\/DynamoDBv2\/Custom\/DataModel\/S3Link.cs#L114\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3008<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>The &#8216;this.linker.s3.region&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 116, 114. S3Link.cs 116<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043a\u043e\u0434. \u0421 \u043e\u0434\u043d\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432 \u043d\u0451\u043c \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u2014 \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c <em>Region<\/em> \u043e\u043d\u0430 \u0441\u0435\u0431\u044f \u043d\u0435 \u043f\u0440\u043e\u044f\u0432\u0438\u0442.<\/p>\n<p>  <\/p>\n<p>\u0421\u0430\u043c\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 \u0437\u0430\u0442\u0430\u0438\u043b\u0430\u0441\u044c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 <em>set<\/em>. \u0412 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <em>this.linker.s3.region<\/em> \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>value<\/em>: \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>String.IsNullOrEmpty(value)<\/em> \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 <em>get<\/em> \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430: \u0435\u0441\u043b\u0438 <em>linker.s3.region<\/em> \u2014 <em>null<\/em> \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u0430\u044f \u0441\u0442\u0440\u043e\u043a\u0430, \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u043d\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>&#171;us-east-1&#187;<\/em>. <\/p>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0432\u043e\u0442 \u0447\u0442\u043e. \u0415\u0441\u043b\u0438 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e\u043c <em>Region<\/em>, \u0434\u043b\u044f \u043d\u0435\u0433\u043e \u043d\u0435\u0442 \u0440\u0430\u0437\u043d\u0438\u0446\u044b, \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430 \u0438\u043b\u0438 \u043d\u0435\u0442. \u041d\u043e \u0435\u0451 \u0432 \u043b\u044e\u0431\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<p><strong>Issue #6<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">internal string  GetPreSignedURLInternal(....) {   ....   RegionEndpoint endpoint = RegionEndpoint.GetBySystemName(region);   var s3SignatureVersionOverride      = endpoint.GetEndpointForService(\"s3\",                                      Config.ToGetEndpointForServiceOptions())               .SignatureVersionOverride;    if (s3SignatureVersionOverride == \"4\" || s3SignatureVersionOverride == null)   {     signatureVersionToUse = SignatureVersion.SigV4;   }    var fallbackToSigV2 = useSigV2Fallback &amp;&amp; !AWSConfigsS3.UseSigV4SetExplicitly;   if (   endpoint?.SystemName == RegionEndpoint.USEast1.SystemName        &amp;&amp; fallbackToSigV2)   {     signatureVersionToUse = SignatureVersion.SigV2;   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Services\/S3\/Custom\/AmazonS3Client.Extensions.cs#L111\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3095<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>The &#8216;endpoint&#8217; object was used before it was verified against null. Check lines: 111, 118. AmazonS3Client.Extensions.cs 111<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0421\u0442\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u0440\u044f\u0434\u043e\u043a \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c\u0438 <em>null<\/em>-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u0440\u0438\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u0442 \u0431\u0430\u0433\u0438. \u0411\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f, \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0430 <em>null<\/em>. \u0418 \u0437\u0434\u0435\u0441\u044c \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442\u0441\u044f \u0433\u043e\u043b\u043e\u0432\u043e\u043b\u043e\u043c\u043a\u0438: \u0442\u043e \u043b\u0438 \u044d\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u0430\u044f, \u0430 <em>null<\/em>-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0431\u044b\u0442\u044c \u043d\u0435 \u043c\u043e\u0436\u0435\u0442, \u0442\u043e \u043b\u0438 \u0435\u0449\u0451 \u0447\u0442\u043e&#8230;<\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0430\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u0430\u044f \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044f. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043a \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>endpoint<\/em> \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f \u0431\u0435\u0437\u0443\u0441\u043b\u043e\u0432\u043d\u043e (<em>endpoint.GetEndpointForService<\/em>), \u0430 \u043d\u0438\u0436\u0435 \u043f\u043e \u043a\u043e\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u0430 (<em>endpoint?.SystemName<\/em>).<\/p>\n<p>  <\/p>\n<p><strong>Issue #7<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public class GetObjectMetadataResponse : AmazonWebServiceResponse {   ....   private ServerSideEncryptionMethod      serverSideEncryption;    private ServerSideEncryptionCustomerMethod      serverSideEncryptionCustomerMethod;   ....    public ServerSideEncryptionCustomerMethod       ServerSideEncryptionCustomerMethod    {      get     {       if (this.serverSideEncryptionCustomerMethod == null)         return ServerSideEncryptionCustomerMethod.None;        return this.serverSideEncryptionCustomerMethod;     }     set { this.serverSideEncryptionCustomerMethod = value; }    }    \/\/ Check to see if ServerSideEncryptionCustomerMethod property is set   internal bool IsSetServerSideEncryptionCustomerMethod()   {     return this.serverSideEncryptionCustomerMethod != null;   }    ....    public ServerSideEncryptionMethod      ServerSideEncryptionMethod   {     get      {       if (this.serverSideEncryption == null)         return ServerSideEncryptionMethod.None;        return this.serverSideEncryption;      }     set { this.serverSideEncryption = value; }   }    \/\/ Check to see if ServerSideEncryptionCustomerMethod property is set   internal bool IsSetServerSideEncryptionMethod()   {     return this.serverSideEncryptionCustomerMethod != null;   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u0441\u044b\u043b\u043a\u0438 \u043d\u0430 GitHub: <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Services\/S3\/Custom\/Model\/GetObjectMetadataResponse.cs#L311\">#1<\/a>, <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Services\/S3\/Custom\/Model\/GetObjectMetadataResponse.cs#L334\">#2<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3013<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>It is odd that the body of &#8216;IsSetServerSideEncryptionMethod&#8217; function is fully equivalent to the body of &#8216;IsSetServerSideEncryptionCustomerMethod&#8217; function. GetObjectMetadataResponse.cs 311<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e: \u043e\u0442 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u0441\u0435\u0439\u0447\u0430\u0441 \u043d\u0430\u0447\u043d\u0451\u0442 \u0440\u044f\u0431\u0438\u0442\u044c \u0432 \u0433\u043b\u0430\u0437\u0430\u0445. \u0414\u0443\u043c\u0430\u044e, \u0438\u0437-\u0437\u0430 \u044d\u0442\u043e\u0433\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430.<\/p>\n<p>  <\/p>\n<p>\u0412 \u0442\u0438\u043f\u0435 <em>GetObjectMetadataResponse<\/em> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <em>ServerSideEncryptionMethod<\/em> \u0438 <em>ServerSideEncryptionCustomerMethod<\/em>. \u041e\u043d\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 backing \u043f\u043e\u043b\u044f \u2014<em>serverSideEncryption<\/em> \u0438 <em>serverSideEncryptionCustomerMethod<\/em>:<\/p>\n<p>  <\/p>\n<ul>\n<li><em>ServerSideEncryptionMethod<\/em> -> <em>serverSideEncryption<\/em>;<\/li>\n<li><em>ServerSideEncryptionCustomerMethod<\/em> -> <em>serverSideEncryptionCustomerMethod<\/em>. <\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0410 \u0435\u0449\u0451 \u0435\u0441\u0442\u044c \u043c\u0435\u0442\u043e\u0434\u044b <em>IsSetServerSideEncryptionMethod<\/em> \u0438 <em>IsSetServerSideEncryptionCustomerMethod<\/em>. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c, \u043e\u043d\u0438 \u0442\u043e\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 backing-\u043f\u043e\u043b\u044f <em>serverSideEncryption<\/em> \u0438 <em>serverSideEncryptionCustomerMethod<\/em> \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u2026 \u043d\u043e \u043d\u0435\u0442. \u0418\u0437-\u0437\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043e\u0431\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u043f\u043e\u043b\u0435 \u2014 <em>serverSideEncryptionCustomerMethod<\/em>.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">\/\/ Check to see if ServerSideEncryptionCustomerMethod property is set internal bool IsSetServerSideEncryptionCustomerMethod() {   return this.serverSideEncryptionCustomerMethod != null; }  \/\/ Check to see if ServerSideEncryptionCustomerMethod property is set internal bool IsSetServerSideEncryptionMethod() {   return this.serverSideEncryptionCustomerMethod != null; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <em>IsSetServerSideEncryptionMethod<\/em> \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043f\u043e\u043b\u0435 <em>serverSideEncryption<\/em>.<\/p>\n<p>  <\/p>\n<p><strong>Issue #8<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public string GetDecryptedPassword(string rsaPrivateKey) {   RSAParameters rsaParams;   try   {     rsaParams = new PemReader(                   new StringReader(rsaPrivateKey.Trim())                 ).ReadPrivatekey();   }   catch (Exception e)   {     throw new AmazonEC2Exception(\"Invalid RSA Private Key\", e);   }    RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();   rsa.ImportParameters(rsaParams);    byte[] encryptedBytes = Convert.FromBase64String(this.PasswordData);   var decryptedBytes = rsa.Decrypt(encryptedBytes, false);    string decrypted = Encoding.UTF8.GetString(decryptedBytes);   return decrypted; }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Services\/EC2\/Custom\/Model\/GetPasswordDataResponse.Extensions.cs#L48\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3114<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>IDisposable object &#8216;rsa&#8217; is not disposed before method returns. GetPasswordDataResponse.Extensions.cs 48<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0422\u0438\u043f <em>RSACryptoServiceProvider<\/em> \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <em>IDisposable<\/em>. \u041e\u0434\u043d\u0430\u043a\u043e \u0432 \u044d\u0442\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u0435\u0442\u043e\u0434 <em>Dispose<\/em> \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0438 \u044f\u0432\u043d\u043e, \u043d\u0438 \u043a\u043e\u0441\u0432\u0435\u043d\u043d\u043e (\u0447\u0435\u0440\u0435\u0437 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <em>rsa<\/em> \u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0438 <em>using<\/em>). <\/p>\n<p>  <\/p>\n<p>\u042f \u043d\u0435 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u044d\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435. \u041d\u043e \u0432 \u0446\u0435\u043b\u043e\u043c \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e <em>Dispose<\/em> \u0434\u043b\u044f \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043f\u0430\u0440\u043e\u043b\u044f\u043c\u0438 \u0438 \u0442. \u043f.<\/p>\n<p>  <\/p>\n<p><strong>Issue #9<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public class ResizeJobFlowStep {   ....   public OnFailure? OnFailure   {     get { return  this.OnFailure; }     set { this.onFailure = value; }   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Services\/ElasticMapReduce\/Custom\/Model\/ResizeJobFlowStep.cs#L171\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3010<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>Possible infinite recursion inside &#8216;OnFailure&#8217; property. ResizeJobFlowStep.cs 171<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u0418\u0437-\u0437\u0430 \u043e\u043f\u0435\u0447\u0430\u0442\u043a\u0438 \u0432 <em>get<\/em>-accessor&#8217;\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 <em>OnFailure<\/em> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435 backing-\u043f\u043e\u043b\u0435 <em>onFailure<\/em>, \u0430 \u0441\u0430\u043c\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e \u2014 <em>OnFailure<\/em>. \u041f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0431\u0435\u0441\u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044e <em>StackOverflowException<\/em>. <\/p>\n<p>  <\/p>\n<p>\u041e\u0448\u0438\u0431\u043a\u0443 \u043b\u0435\u0433\u043a\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0432\u0448\u0438\u0441\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c API:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">ResizeJobFlowStep obj = new ResizeJobFlowStep(); _ = obj.OnFailure;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u0434, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u043d\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/6ac\/47c\/82d\/6ac47c82dba77dbd269d790872f5d82a.png\" alt=\"1057_AWS_SDK_NET_ru\/image3.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/6ac\/47c\/82d\/6ac47c82dba77dbd269d790872f5d82a.png\"\/><\/p>\n<p>  <\/p>\n<p><strong>Issue #10<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private static void  writeConditions(Statement statement, JsonWriter generator) {   ....   IList&lt;string> conditionValues = keyEntry.Value;   if (conditionValues.Count == 0)     continue;    generator.WritePropertyName(keyEntry.Key);    if (conditionValues.Count > 1)   {     generator.WriteArrayStart();   }    if (conditionValues != null &amp;&amp; conditionValues.Count != 0)   {     foreach (string conditionValue in conditionValues)     {       generator.Write(conditionValue);     }   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Core\/Amazon.Auth\/AccessControlPolicy\/Internal\/JsonPolicyWriter.cs#L233\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3095<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>The &#8216;conditionValues&#8217; object was used before it was verified against null. Check lines: 233, 238. JsonPolicyWriter.cs 233<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e: \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u0434\u0451\u0442 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0441\u044b\u043b\u043a\u0438 \u0438\u0437 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>conditionValues<\/em>, \u0430 \u0437\u0430\u0442\u0435\u043c \u0435\u0451 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 <em>null<\/em>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0430 \u0431\u044b\u043b\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u0439, \u0443\u0436\u0435 \u043f\u0440\u0438 \u043f\u0435\u0440\u0432\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u2014 <em>conditionValues.Count == 0<\/em> \u2014 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <em>NullReferenceException<\/em>. <\/p>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0448\u0438\u0431\u043a\u0443, \u0442\u0430\u043a \u0438 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 \u043d\u0435\u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <em>null<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041e\u0442\u043c\u0435\u0447\u0443 \u043e\u0434\u043d\u0443 \u0432\u0435\u0449\u044c. \u0423 \u043c\u0435\u043d\u044f \u0441\u043b\u043e\u0436\u0438\u043b\u043e\u0441\u044c \u0432\u043f\u0435\u0447\u0430\u0442\u043b\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043b\u044e\u0431\u044f\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0440\u0430\u0432\u0435\u043d\u0441\u0442\u0432\u043e <em>null<\/em> \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439. \ud83d\ude42 \u041d\u0438\u0436\u0435 \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u044e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">string[] settings    = value.Split(validSeparators, StringSplitOptions.RemoveEmptyEntries);  if (settings == null || settings.Length == 0)     return LoggingOptions.None;<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/6fb0a41e7a4d4ba5e6cd9cf947beb65f06d8e58b\/sdk\/src\/Core\/AWSConfigs.cs#L278\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>. <\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <em>String.Split<\/em> \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>null<\/em>. \u041f\u043e\u0445\u043e\u0436\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0435\u0441\u0442\u044c <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/6fb0a41e7a4d4ba5e6cd9cf947beb65f06d8e58b\/sdk\/src\/Core\/Amazon.Util\/AWSSDKUtils.cs#L587\">\u0437\u0434\u0435\u0441\u044c<\/a>. <\/p>\n<p>  <\/p>\n<p>\u0414\u0440\u0443\u0433\u043e\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u043e\u0445\u043e\u0436\u0435\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">var constructors    = GetConstructors(objectTypeWrapper, validConstructorInputs).ToList();  if (constructors != null &amp;&amp; constructors.Count > 0)<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/6fb0a41e7a4d4ba5e6cd9cf947beb65f06d8e58b\/sdk\/src\/Services\/DynamoDBv2\/Custom\/DataModel\/Utils.cs#LL278C16-L278C16\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041c\u0435\u0442\u043e\u0434 <em>Enumerable.ToList<\/em> \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>null<\/em>, \u0442\u0430\u043a \u0447\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>constructors<\/em> \u043d\u0438\u043a\u043e\u0433\u0434\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e <em>null<\/em>. <\/p>\n<p>  <\/p>\n<p>\u0410 \u043f\u0440\u0438\u043c\u0435\u0440 \u043d\u0438\u0436\u0435 \u0431\u043b\u0438\u0436\u0435 \u043a \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u2014 \u0442\u043e\u0436\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043b\u0438 \u0441\u0441\u044b\u043b\u043a\u0443, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u0435\u0451 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043d\u0430 <em>null<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">TraceSource ts = new TraceSource(testName, sourceLevels); ts.Listeners.AddRange(AWSConfigs.TraceListeners(testName));  \/\/ no listeners? skip if (ts.Listeners == null || ts.Listeners.Count == 0)<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/6fb0a41e7a4d4ba5e6cd9cf947beb65f06d8e58b\/sdk\/src\/Core\/Amazon.Runtime\/Internal\/Util\/Logger.Diagnostic.cs#L143\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u0441\u043b\u0443\u0447\u0430\u0435\u0432, \u043a\u043e\u0433\u0434\u0430 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u043e <em>Listeners<\/em> \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>null<\/em>, \u044f \u043d\u0435 \u043d\u0430\u0448\u0451\u043b. \u0412 .NET \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0442\u0430\u043a \u0438 \u0432\u043e\u0432\u0441\u0435 \u0440\u0430\u0437\u043c\u0435\u0447\u0435\u043d\u043e null-forgiving \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c (<a href=\"https:\/\/github.com\/dotnet\/runtime\/blob\/3181f9c925ba65a7bbab0dc310a8abc1e3bfe68e\/src\/libraries\/System.Diagnostics.TraceSource\/src\/System\/Diagnostics\/TraceSource.cs#L523\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>):<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">public TraceListenerCollection Listeners {   get   {     Initialize();     return _listeners!;   } }<\/code><\/pre>\n<p>  <\/p>\n<p><strong>Issue #11<\/strong><\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private static string GetXamarinInformation() {   var xamarinDevice = Type.GetType(\"Xamarin.Forms.Device, Xamarin.Forms.Core\");   if (xamarinDevice == null)   {     return null;   }    var runtime = xamarinDevice.GetProperty(\"RuntimePlatform\")                             ?.GetValue(null)                             ?.ToString() ?? \"\";    var idiom = xamarinDevice.GetProperty(\"Idiom\")                           ?.GetValue(null)                           ?.ToString() ?? \"\";    var platform = runtime + idiom;    if (string.IsNullOrEmpty(platform))   {     platform = UnknownPlatform;   }    return string.Format(CultureInfo.InvariantCulture, \"Xamarin_{0}\", \"Xamarin\"); }<\/code><\/pre>\n<p>  <\/p>\n<p><a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/blob\/cae0a7b336f1d3d2fdae653095f64a3df82f3cc1\/sdk\/src\/Core\/Amazon.Util\/Internal\/_netstandard\/InternalSDKUtils.netstandard.cs#L70\">\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 GitHub<\/a>.<\/p>\n<p>  <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio \u2014 V3137<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<p>The &#8216;platform&#8217; variable is assigned but is not used by the end of the function. InternalSDKUtils.netstandard.cs 70<\/p>\n<\/div><\/div>\n<p>  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0442\u0440\u043e\u043a\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043e\u0447\u0435\u043d\u044c \u0441\u0442\u0440\u0430\u043d\u043d\u043e. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <em>String.Format<\/em> \u0432 \u0448\u0430\u0431\u043b\u043e\u043d <em>&#171;Xamarin_{0}&#187; <\/em>\u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b <em>&#171;Xamarin&#187;.<\/em> \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>platform<\/em>, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u0435\u0442 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e, \u0438\u0433\u043d\u043e\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f. \u0412\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0442\u0440\u0430\u043d\u043d\u043e. <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0443, \u0447\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>return<\/em> \u0434\u043e\u043b\u0436\u043d\u043e \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">return string.Format(CultureInfo.InvariantCulture, \"Xamarin_{0}\", platform);<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0441\u0442\u0430\u0442\u0438, \u0440\u044f\u0434\u043e\u043c \u0435\u0441\u0442\u044c \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u043c\u0435\u0442\u043e\u0434 \u0441 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435\u043c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e Unity. \u041e\u043d \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043f\u043e \u0441\u0445\u043e\u0436\u0435\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443, \u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0436\u0435 \u0444\u043e\u0440\u043c\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"cs\">private static string GetUnityInformation() {   var unityApplication      = Type.GetType(\"UnityEngine.Application, UnityEngine.CoreModule\");   if (unityApplication == null)   {     return null;   }    var platform = unityApplication.GetProperty(\"platform\")                                 ?.GetValue(null)                                 ?.ToString() ?? UnknownPlatform;    return string.Format(CultureInfo.InvariantCulture, \"Unity_{0}\", platform); }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041e\u0431\u043e \u0432\u0441\u0435\u0445 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 \u044f \u0443\u0432\u0435\u0434\u043e\u043c\u0438\u043b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0435\u0449\u0451 \u0434\u043e \u0432\u044b\u0445\u043e\u0434\u0430 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u0432\u043e\u0442 <a href=\"https:\/\/github.com\/aws\/aws-sdk-net\/issues\/2627\">\u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u0431\u0430\u0433-\u0440\u0435\u043f\u043e\u0440\u0442<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u043d\u0435\u0442 \u043b\u0438 \u0432 \u0432\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043f\u043e\u0445\u043e\u0436\u0438\u0445 \u043f\u0440\u043e\u0431\u043b\u0435\u043c? \u041f\u0440\u043e\u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0439\u0442\u0435 \u043a\u043e\u0434 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e PVS-Studio.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio-download\/?utm_source=website&amp;utm_medium=habr&amp;utm_campaign=article&amp;utm_content=1057\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/de7\/e5a\/3fc\/de7e5a3fcb3f7a0bba414c942598e295.png\" alt=\"getTrialImageLink\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/de7\/e5a\/3fc\/de7e5a3fcb3f7a0bba414c942598e295.png\"\/><\/a><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/companies\/pvs-studio\/articles\/745770\/\"> https:\/\/habr.com\/ru\/companies\/pvs-studio\/articles\/745770\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/83d\/455\/603\/83d45560365447d27877cc75f95a730f.png\" alt=\"1057_AWS_SDK_NET_ru\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/83d\/455\/603\/83d45560365447d27877cc75f95a730f.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0421\u0435\u0433\u043e\u0434\u043d\u044f \u043f\u043e\u0434 \u043d\u0430\u0448\u0438\u043c \u0441\u043a\u0430\u043b\u044c\u043f\u0435\u043b\u0435\u043c \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u043f\u0440\u043e\u0435\u043a\u0442 AWS SDK \u0434\u043b\u044f .NET. \u041c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0441\u0442\u0430 \u0438\u0437 \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f, \u0447\u0442\u043e \u0432 \u043d\u0438\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b. \u0417\u0430\u0432\u0430\u0440\u0438\u0432\u0430\u0439\u0442\u0435 \u043a\u043e\u0444\u0435 \u0438 \u0443\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043f\u043e\u0443\u0434\u043e\u0431\u043d\u0435\u0435.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-349707","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349707","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=349707"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/349707\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=349707"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=349707"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=349707"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}