{"id":329069,"date":"2022-02-04T15:01:13","date_gmt":"2022-02-04T15:01:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=329069"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=329069","title":{"rendered":"<span>\u0418\u0433\u0440\u0430 \u0441 null: \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 MonoGame \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c PVS-Studio<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0443\u0436\u0435 \u043d\u0435 \u0440\u0430\u0437 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0438 \u0434\u0432\u0438\u0436\u043a\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0433\u0440. \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u0443 MonoGame \u2013 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 gamedev-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C#.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"440\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5f2\/385\/d7f\/5f2385d7ff05966672ce6c7c58ef9324.png\" data-width=\"780\"\/><figcaption><\/figcaption><\/figure>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<figure class=\"\"><img decoding=\"async\" src=\"\/img\/image-loader.svg\" height=\"63\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/17b\/286\/b63\/17b286b63686ca0f636b3a39d5a4fe56.png\" data-width=\"300\"\/><figcaption><\/figcaption><\/figure>\n<p>MonoGame \u2013 \u044d\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0433\u0440. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u0439\u043d\u044b\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Microsoft_XNA\">XNA<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0441\u044f Microsoft \u0434\u043e 2013 \u0433\u043e\u0434\u0430.<\/p>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043d\u0435\u043b\u0438\u0448\u043d\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0438 \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <a href=\"https:\/\/pvs-studio.com\/ru\/pvs-studio\/\">PVS-Studio<\/a> :). \u041d\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u0436\u0435 \u043b\u0438\u0448\u043d\u0438\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u044e \ud83d\ude42 PVS-Studio \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 7.16 \u0438 <a href=\"https:\/\/github.com\/MonoGame\/MonoGame\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 MonoGame<\/a> \u043e\u0442 12.01.2022.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u043f\u0430\u0440\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2013 DotNetZip \u0438 NVorbis. \u0420\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u044f \u043f\u0440\u0438\u0432\u0451\u043b \u0438\u0445 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0412\u044b \u0436\u0435 \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/manual\/0014\/\">\u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u043a\u043e\u0434<\/a>.<\/p>\n<h3>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/h3>\n<p><strong>Issue 1<\/strong><\/p>\n<pre><code class=\"cs\">public void Apply3D(AudioListener listener, AudioEmitter emitter)  {   ....   var i = FindVariable(\"Distance\");   _variables[i].SetValue(distance);   ....   var j = FindVariable(\"OrientationAngle\");   _variables[j].SetValue(angle);   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3106\/\">V3106<\/a> Possible negative index value. The value of &#8216;i&#8217; index could reach -1. MonoGame.Framework.DesktopGL(netstandard2.0) Cue.cs 251<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>i<\/em>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 -1.<\/p>\n<p>\u042d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f* *\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <em>FindVariable<\/em>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<pre><code class=\"cs\">private int FindVariable(string name) {   \/\/ Do a simple linear search... which is fast   \/\/ for as little variables as most cues have.   for (var i = 0; i &lt; _variables.Length; i++)   {     if (_variables[i].Name == name)     return i;   }    return -1; } <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e -1. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>IndexOutOfRangeException<\/em>.<\/p>\n<p><strong>Issue 2<\/strong><\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <em>Apply3D<\/em>:<\/p>\n<pre><code class=\"cs\">public void Apply3D(AudioListener listener, AudioEmitter emitter) {   ....   lock (_engine.UpdateLock)   {     ....     \/\/ Calculate doppler effect.     var relativeVelocity = emitter.Velocity - listener.Velocity;     relativeVelocity *= emitter.DopplerScale;   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3137\/\">V3137<\/a> The &#8216;relativeVelocity&#8217; variable is assigned but is not used by the end of the function. MonoGame.Framework.DesktopGL(netstandard2.0) Cue.cs 266<\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u041f\u0440\u0438 \u0431\u0435\u0433\u043b\u043e\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u043a\u043e\u0433\u043e-\u0442\u043e \u043c\u043e\u0433\u043b\u043e \u0441\u043c\u0443\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <em>lock<\/em>-\u0431\u043b\u043e\u043a\u0435, \u043d\u043e&#8230; \u0434\u043b\u044f <em>relativeVelocity<\/em> \u044d\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0438 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043c\u0435\u0436\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435* relativeVelocity* \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043b\u044e.<\/p>\n<p><strong>Issue 3<\/strong><\/p>\n<pre><code class=\"cs\">private void SetData(int offset, int rows, int columns, object data) {   ....   if(....)   {     ....   }   else if (rows == 1 || (rows == 4 &amp;&amp; columns == 4))    {     \/\/ take care of shader compiler optimization     int len = rows * columns * elementSize;     if (_buffer.Length - offset > len)           len = _buffer.Length - offset;    \/\/  &lt;=     Buffer.BlockCopy(data as Array,                      0,                      _buffer,                      offset,                      rows*columns*elementSize);   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3137\/\">V3137<\/a> The &#8216;len&#8217; variable is assigned but is not used by the end of the function. MonoGame.Framework.DesktopGL(netstandard2.0) ConstantBuffer.cs 91<\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>len<\/em> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"cs\">int len = rows * columns * elementSize; <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0433\u043b\u044f\u0434\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u0434, \u0442\u043e \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u043e \u0434\u0435\u0436\u0430\u0432\u044e, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<\/p>\n<pre><code class=\"cs\">Buffer.BlockCopy(data as Array, 0,                  _buffer,                  offset,                  rows*columns*elementSize);    \/\/ &lt;= <\/code><\/pre>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, <em>len<\/em> \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>Issue 4<\/strong><\/p>\n<pre><code class=\"cs\">protected virtual object EvalSampler_Declaration(....) {   if (this.GetValue(tree, TokenType.Semicolon, 0) == null)     return null;            var sampler = new SamplerStateInfo();   sampler.Name = this.GetValue(tree, TokenType.Identifier, 0) as string;   foreach (ParseNode node in Nodes)     node.Eval(tree, sampler);            var shaderInfo = paramlist[0] as ShaderInfo;   shaderInfo.SamplerStates.Add(sampler.Name, sampler);    \/\/ &lt;=            return null; } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3156\/\">V3156<\/a> The first argument of the &#8216;Add&#8217; method is not expected to be null. Potential null value: <a href=\"http:\/\/sampler.Name\">sampler.Name<\/a>. MonoGame.Effect.Compiler ParseTree.cs 1111<\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 <em>Add<\/em> \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0432 \u043d\u0435\u0433\u043e <em>null<\/em> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 <em>Add<\/em> \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <a href=\"http:\/\/sampler.Name\"><em>sampler.Name<\/em><\/a> \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>null<\/em>.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043f\u043e\u043b\u0435 <em>shaderInfo.SamplerStates<\/em>:<\/p>\n<pre><code class=\"cs\">public class ShaderInfo {   ....    public Dictionary&lt;string, SamplerStateInfo> SamplerStates =      new Dictionary&lt;string, SamplerStateInfo>(); } <\/code><\/pre>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044c,* <em>\u0430<\/em> Add* \u2013 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, <em>null<\/em> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043b\u044e\u0447\u043e\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f <a href=\"http:\/\/sampler.Name\"><em>sampler.Name<\/em><\/a>. \u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 <em>null<\/em> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435:<\/p>\n<pre><code class=\"cs\">sampler.Name = this.GetValue(tree, TokenType.Identifier, 0) as string; <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <em>as<\/em> \u0431\u0443\u0434\u0435\u0442 <em>null<\/em>, \u0435\u0441\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <em>GetValue<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em> \u0438\u043b\u0438 \u043d\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0442\u0438\u043f\u0430 <em>string<\/em>. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0442\u0430\u043a\u043e\u0435 \u0431\u044b\u0442\u044c? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043d\u0443\u0442\u0440\u044c <em>GetValue<\/em>:<\/p>\n<pre><code class=\"cs\">protected object GetValue(ParseTree tree,                           TokenType type,                           ref int index) {   object o = null;   if (index &lt; 0) return o;    \/\/ left to right   foreach (ParseNode node in nodes)   {     if (node.Token.Type == type)     {       index--;       if (index &lt; 0)       {         o = node.Eval(tree);         break;       }     }   }   return o; } <\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <em>null<\/em> \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>index<\/em> \u043c\u0435\u043d\u044c\u0448\u0435 0;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 <em>type<\/em> \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 <em>nodes<\/em>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 <em>null<\/em> \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>as<\/em>.<\/p>\n<p><strong>Issue 5<\/strong><\/p>\n<pre><code class=\"cs\">internal void Update() {   if (GetQueuedSampleCount() > 0)   {     BufferReady.Invoke(this, EventArgs.Empty);   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3083\/\">V3083<\/a> Unsafe invocation of event &#8216;BufferReady&#8217;, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. MonoGame.Framework.DesktopGL(netstandard2.0) Microphone.OpenAL.cs 142<\/p>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <em>GetQueuedSampleCount<\/em>. \u0415\u0441\u043b\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <em>NullReferenceException<\/em>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u0442\u0430\u043a\u043e\u0432\u0430, \u0447\u0442\u043e \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f &#171;<em>GetQueuedSampleCount() > 0<\/em>&#187; \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432, \u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 <em>BufferReady<\/em> \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">public event EventHandler&lt;EventArgs> BufferReady; <\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 <em>public<\/em> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <em>BufferReady<\/em> \u0432 \u043b\u044e\u0431\u043e\u043c \u043a\u043e\u0434\u0435, \u0447\u0442\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0448\u0430\u043d\u0441 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445.<\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u0430\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>null<\/em> \u0432 \u0441\u0430\u043c\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0441\u043f\u0430\u0441\u0430\u0435\u0442, \u0432\u0435\u0434\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <em>BufferReady<\/em> \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e.<\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u2013 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Elvis operator &#8216;?.&#8217; \u0432 \u0432\u044b\u0437\u043e\u0432 <em>Invoke<\/em>:<\/p>\n<pre><code class=\"cs\">BufferReady?.Invoke(this, EventArgs.Empty); <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c <em>BufferReady<\/em> \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439:<\/p>\n<pre><code class=\"cs\">EventHandler&lt;EventArgs> bufferReadyLocal = BufferReady; if (bufferReadyLocal != null)   bufferReadyLocal.Invoke(this, EventArgs.Empty); <\/code><\/pre>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 <em>public<\/em> \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0440\u0435\u0434\u043a\u043e, \u043d\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0432\u0430\u0440\u043d\u044b\u043c\u0438. \u0422\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u043e \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u0435\u043c\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435 <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3083\/\">V3083<\/a>.<\/p>\n<p><strong>Issue 6<\/strong><\/p>\n<pre><code class=\"cs\">public override TOutput Convert&lt;TInput, TOutput>(   TInput input,   string processorName,   OpaqueDataDictionary processorParameters) {   var processor = _manager.CreateProcessor(processorName,                                                  processorParameters);   var processContext = new PipelineProcessorContext(....);   var processedObject = processor.Process(input, processContext);   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3080\/\">V3080<\/a> Possible null dereference. Consider inspecting &#8216;processor&#8217;. MonoGame.Framework.Content.Pipeline PipelineProcessorContext.cs 55<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u043c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <em>processor.Process<\/em>.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <em>processor<\/em> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c <em>_manager.CreateProcessor<\/em>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cs\">public IContentProcessor CreateProcessor(                     string name,                     OpaqueDataDictionary processorParameters) {   var processorType = GetProcessorType(name);   if (processorType == null)     return null;   .... } <\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e <em>CreateProcessor<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434 <em>GetProcessorType<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em>. \u0427\u0442\u043e \u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438 \u043d\u0430 \u0435\u0433\u043e \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">public Type GetProcessorType(string name) {   if (_processors == null)     ResolveAssemblies();    \/\/ Search for the processor type.   foreach (var info in _processors)   {     if (info.type.Name.Equals(name))       return info.type;   }    return null; } <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <em>null<\/em>, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0422\u043e\u0433\u0434\u0430 \u0435\u0441\u043b\u0438 <em>GetProcessorType<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em>, \u0442\u043e \u0438 <em>CreateProcessor<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <em>processor<\/em>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a <em>NullReferenceException<\/em> \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u043c\u0435\u0442\u043e\u0434\u0430: <em>processor.Process<\/em>.<\/p>\n<p>\u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u043c\u0435\u0442\u043e\u0434\u0443 <em>Convert<\/em> \u0438\u0437 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f. \u0412\u044b \u0437\u0430\u043c\u0435\u0442\u0438\u043b\u0438, \u0447\u0442\u043e \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 <em>override<\/em>? \u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0438\u0437 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0412\u043e\u0442 \u0441\u0430\u043c \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434:<\/p>\n<pre><code class=\"cs\">\/\/\/ &lt;summary> \/\/\/ Converts a content item object using the specified content processor. \/\/\/.... \/\/\/ &lt;param name=\"processorName\">Optional processor  \/\/\/ for this content.&lt;\/param> \/\/\/.... public abstract TOutput Convert&lt;TInput,TOutput>(   TInput input,   string processorName,   OpaqueDataDictionary processorParameters ); <\/code><\/pre>\n<p>\u041a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u043a\u043e \u0432\u0445\u043e\u0434\u043d\u043e\u043c\u0443 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0443 <em>processorName<\/em> \u0443\u0432\u0435\u0440\u044f\u0435\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430, \u0447\u0442\u043e \u044d\u0442\u043e\u0442 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442, \u0443\u0432\u0438\u0434\u0435\u0432 \u0442\u0430\u043a\u043e\u0439 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0439 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b, \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u0440\u0435\u043d, \u0447\u0442\u043e \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f\u0445 \u043a\u043e\u043d\u0442\u0440\u0430\u043a\u0442\u0430 \u0431\u044b\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>null<\/em> \u0438\u043b\u0438 \u043f\u0443\u0441\u0442\u043e\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0438. \u041d\u043e \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a \u043d\u0435\u0442.<\/p>\n<p>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043d\u0430\u0439\u0442\u0438 \u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0445 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u043f\u0440\u043e\u0431\u043b\u0435\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<ul>\n<li>\n<p>\u0434\u043b\u044f \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u043f\u0443\u0441\u0442\u043e\u0435 \u0438 \u043d\u0435 <em>null<\/em> \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u043e\u043f\u0440\u0435\u043a\u0438 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044e \u043a \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u0432 <em>null<\/em>-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438, \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a <em>NullReferenceException<\/em>.<\/p>\n<\/li>\n<\/ul>\n<p><strong>Issue 7<\/strong><\/p>\n<pre><code class=\"cs\">public MGBuildParser(object optionsObject) {   ....   foreach(var pair in _optionalOptions)   {     var fi = GetAttribute&lt;CommandLineParameterAttribute>(pair.Value);     if(!string.IsNullOrEmpty(fi.Flag))       _flags.Add(fi.Flag, fi.Name);   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3146\/\">V3146<\/a> Possible null dereference of &#8216;fi&#8217;. The &#8216;FirstOrDefault&#8217; can return default null value. MonoGame.Content.Builder CommandLineParser.cs 125<\/p>\n<p>\u042d\u0442\u043e \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u043c <em>NullReferenceException<\/em>, \u0442\u0430\u043a \u043a\u0430\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>FirstOrDefault<\/em> \u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043e \u043d\u0430 <em>null<\/em>.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043d\u0430\u0439\u0434\u0451\u043c \u044d\u0442\u043e\u0442 \u0432\u044b\u0437\u043e\u0432 <em>FirstOrDefault<\/em>. \u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>fi<\/em> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u043e\u043c <em>GetAttribute<\/em>. \u0412\u044b\u0437\u043e\u0432 <em>FirstOrDefault<\/em> \u0438\u0437 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u0430\u043c, \u043f\u043e\u0438\u0441\u043a \u043d\u0435 \u0437\u0430\u043d\u044f\u043b \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438:<\/p>\n<pre><code class=\"cs\">static T GetAttribute&lt;T>(ICustomAttributeProvider provider)                          where T : Attribute {   return provider.GetCustomAttributes(typeof(T),false)                  .OfType&lt;T>()                  .FirstOrDefault(); } <\/code><\/pre>\n<p>\u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>null<\/em>-\u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0434\u043b\u044f \u0437\u0430\u0449\u0438\u0442\u044b \u043e\u0442 <em>NullReferenceException<\/em>:<\/p>\n<pre><code class=\"cs\">if(!string.IsNullOrEmpty(fi?.Flag)) <\/code><\/pre>\n<p>\u0422\u043e\u0433\u0434\u0430, \u0435\u0441\u043b\u0438 <em>fi<\/em> \u2013 <em>null<\/em>, \u0442\u043e \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u0442\u044c\u0441\u044f \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <em>Flag<\/em>, \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0430 <em>null<\/em>. \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c <em>IsNullOrEmpty<\/em> \u0434\u043b\u044f <em>null<\/em>-\u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u0439 <em>false<\/em>.<\/p>\n<p><strong>Issue 8<\/strong><\/p>\n<pre><code class=\"cs\">public GenericCollectionHelper(IntermediateSerializer serializer,                                Type type) {   var collectionElementType = GetCollectionElementType(type, false);   _contentSerializer =                  serializer.GetTypeSerializer(collectionElementType);   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3080\/\">V3080<\/a> Possible null dereference inside method at &#8216;type.IsArray&#8217;. Consider inspecting the 1st argument: collectionElementType. MonoGame.Framework.Content.Pipeline GenericCollectionHelper.cs 48<\/p>\n<p>PVS-Studio \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u0432 \u043c\u0435\u0442\u043e\u0434 <em>serializer.GetTypeSerializer<\/em> \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f <em>collectionElementType<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>null<\/em>. \u0412\u043d\u0443\u0442\u0440\u0438 \u043c\u0435\u0442\u043e\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430, \u0438 \u044d\u0442\u043e \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439* NullReferenceException*.<\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043c, \u0447\u0442\u043e \u0432 <em>ContentTypeSerializer<\/em> \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c <em>null<\/em>:<\/p>\n<pre><code class=\"cs\">public ContentTypeSerializer GetTypeSerializer(Type type) {   ....   if (type.IsArray)   {     ....   }   .... } <\/code><\/pre>\n<p>\u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <em>type<\/em> \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u0435\u043d <em>null<\/em>, \u0442\u043e \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0443 <em>IsArray<\/em> \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u044b\u0439 *collectionElementType *\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <em>GetCollectionElementType<\/em>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043c\u0435\u0442\u043e\u0434\u0430 \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<pre><code class=\"cs\">private static Type GetCollectionElementType(Type type,                                              bool checkAncestors) {   if (!checkAncestors        &amp;&amp; type.BaseType != null        &amp;&amp; FindCollectionInterface(type.BaseType) != null)     return null;    var collectionInterface = FindCollectionInterface(type);   if (collectionInterface == null)     return null;    return collectionInterface.GetGenericArguments()[0]; } <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442 \u0432 \u043e\u0434\u043d\u0443 \u0438\u0437 \u0434\u0432\u0443\u0445 \u0443\u0441\u043b\u043e\u0432\u043d\u044b\u0445 \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d <em>null<\/em>. \u0414\u0432\u0430 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a <em>NullReferenceException,<\/em> \u043f\u0440\u043e\u0442\u0438\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f \u0441 \u0432\u043e\u0437\u0432\u0440\u0430\u0442\u043e\u043c \u043d\u0435 <em>null<\/em>-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043d\u043e \u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0435\u0442.<\/p>\n<p><strong>Issue 9<\/strong><\/p>\n<pre><code class=\"cs\">class Floor0 : VorbisFloor {   int _rate;   ....   int[] SynthesizeBarkCurve(int n)   {     var scale = _bark_map_size \/ toBARK(_rate \/ 2);     ....   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3041\/\">V3041<\/a> The expression was implicitly cast from &#8216;int&#8217; type to &#8216;double&#8217; type. Consider utilizing an explicit type cast to avoid the loss of a fractional part. An example: double A = (double)(X) \/ Y;. MonoGame.Framework.DesktopGL(netstandard2.0) VorbisFloor.cs 113<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0440\u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <em>_rate<\/em> \u043d\u0430 2 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0442\u0438 \u043d\u0435\u043e\u0436\u0438\u0434\u0430\u0435\u043c\u0430\u044f \u043f\u043e\u0442\u0435\u0440\u044f \u0434\u0440\u043e\u0431\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430. \u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u0434\u0430 NVorbis.<\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0441\u0432\u044f\u0437\u043d\u043e \u0441\u043e \u0432\u0442\u043e\u0440\u044b\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u043c\u0435\u0442\u043e\u0434\u0430 <em>toBARK<\/em> \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">static float toBARK(double lsp) <\/code><\/pre>\n<p>\u041f\u043e\u043b\u0435 <em>_rate<\/em> \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f <em>int<\/em>, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u0442\u0438\u043f\u0430 \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0436\u0435 \u0442\u0438\u043f\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0446\u0435\u043b\u043e\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u044b\u043c \u2013 \u0434\u0440\u043e\u0431\u043d\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u043d\u0430. \u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u043b\u043e\u0441\u044c, \u0442\u043e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 <em>double<\/em> \u043c\u043e\u0436\u043d\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043b\u0438\u0442\u0435\u0440\u0430\u043b <em>d<\/em> \u043a \u0447\u0438\u0441\u043b\u0443 \u0438\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0432 \u0432\u0438\u0434\u0435 \u0441 \u0442\u043e\u0447\u043a\u043e\u0439:<\/p>\n<pre><code class=\"cs\">var scale = _bark_map_size \/ toBARK(_rate \/ 2d); var scale = _bark_map_size \/ toBARK(_rate \/ 2.0); <\/code><\/pre>\n<p><strong>Issue 10<\/strong><\/p>\n<pre><code class=\"cs\">internal int InflateFast(....) {   ....   if (c > e)   {     \/\/ if source crosses,     c -= e; \/\/ wrapped copy     if (q - r > 0 &amp;&amp; e > (q - r))     {       do       {         s.window[q++] = s.window[r++];       }       while (--e != 0);     }     else     {       Array.Copy(s.window, r, s.window, q, e);       q += e; r += e; e = 0;    \/\/ &lt;=     }     r = 0; \/\/ copy rest from start of window    \/\/ &lt;=   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3008\/\">V3008<\/a> The &#8216;r&#8217; variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 1309, 1307. MonoGame.Framework.DesktopGL(netstandard2.0) Inflate.cs 1309<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439, \u0438\u043c\u0435\u044e\u0449\u0435\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u043e\u0435, \u043d\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0435 \u043d\u0435 \u0431\u044b\u043b\u043e \u043d\u0438\u043a\u0430\u043a \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e. \u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0438\u0437 \u043a\u043e\u0434\u0430 DotNetZip.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0439\u0434\u0451\u0442 \u0432 <em>else<\/em>-\u0432\u0435\u0442\u043a\u0443, \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>r<\/em> \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0443\u043c\u043c\u044b <em>r<\/em> \u0438 <em>e<\/em>. \u041d\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0432\u0435\u0442\u043a\u0438 \u043f\u0435\u0440\u0432\u0430\u044f \u0436\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442 <em>r<\/em> \u0434\u0440\u0443\u0433\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0435. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0443\u043c\u043c\u044b \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0435\u0440\u044f\u043d, \u0434\u0435\u043b\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u044b\u043c\u0438.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u0430\u043c\u044b\u0435 \u0440\u0430\u0437\u043d\u044b\u0435, \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0430\u044e\u0442 \u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u0441\u0430\u043c\u044b\u0445 \u0440\u0430\u0437\u043d\u044b\u0445 \u0443\u0440\u043e\u0432\u043d\u0435\u0439. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0440\u0430\u0437\u0431\u043e\u0440\u0435 \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u043b\u0438\u0441\u044c \u0438 \u0441 \u043f\u0440\u043e\u0441\u0442\u044b\u043c\u0438 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u0430\u043c\u0438, \u0438 \u0441 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e\u043f\u0430\u0441\u043d\u044b\u043c\u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u0413\u043b\u044f\u0434\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0437 \u043d\u0438\u0445, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u0432\u043e\u043e\u0431\u0449\u0435 \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c. \u0412\u0435\u0434\u044c \u043f\u043e \u043a\u043e\u0434\u0443 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u043a\u0430\u043a\u043e\u0439-\u043b\u0438\u0431\u043e \u043c\u0435\u0442\u043e\u0434 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>null<\/em>, \u0430 \u0434\u0440\u0443\u0433\u043e\u0439 \u043c\u0435\u0442\u043e\u0434 \u044d\u0442\u043e\u0442 <em>null<\/em> \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442.<\/p>\n<p>\u0421\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043d\u0435\u0438\u0434\u0435\u0430\u043b\u0435\u043d, \u043d\u043e \u0432\u0441\u0451 \u0436\u0435 \u043e\u043d \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b (\u0438 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0445!). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0432\u0430\u043c <a href=\"https:\/\/pvs-studio.com\/pvs-studio\/try-free\/?utm_source=habr&amp;utm_medium=articles&amp;utm_content=monogame&amp;utm_term=link_try-free\">\u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440<\/a> \u0438 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0432\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u2013 \u0432\u0434\u0440\u0443\u0433 \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u0439\u0434\u0451\u0442\u0441\u044f?<\/p>\n<p>\u0411\u043e\u043b\u044c\u0448\u043e\u0435 \u0441\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0443\u0432\u0438\u0434\u0438\u043c\u0441\u044f \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u044c\u044f\u0445!<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Vadim Kuleshov. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/csharp\/0915\/\">Playing with null: Checking MonoGame with the PVS-Studio analyzer<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/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\/company\/pvs-studio\/blog\/649777\/\"> https:\/\/habr.com\/ru\/company\/pvs-studio\/blog\/649777\/<\/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_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio \u0443\u0436\u0435 \u043d\u0435 \u0440\u0430\u0437 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0434\u043b\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a, \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u043e\u0432 \u0438 \u0434\u0432\u0438\u0436\u043a\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0433\u0440. \u041f\u0440\u0438\u0448\u043b\u043e \u0432\u0440\u0435\u043c\u044f \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u0443 MonoGame \u2013 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0439 gamedev-\u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u044f\u0437\u044b\u043a\u0435 C#.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>MonoGame \u2013 \u044d\u0442\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u043c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u043c \u043a\u043e\u0434\u043e\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0439 \u0434\u043b\u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0433\u0440. \u042f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0434\u0435\u0439\u043d\u044b\u043c \u043d\u0430\u0441\u043b\u0435\u0434\u043d\u0438\u043a\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/en.wikipedia.org\/wiki\/Microsoft_XNA\">XNA<\/a>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0441\u044f Microsoft \u0434\u043e 2013 \u0433\u043e\u0434\u0430.<\/p>\n<p>\u0414\u0443\u043c\u0430\u044e, \u043d\u0435\u043b\u0438\u0448\u043d\u0438\u043c \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c \u0438 \u043f\u0440\u043e \u0442\u043e, \u0447\u0442\u043e \u0442\u0430\u043a\u043e\u0435 <a href=\"https:\/\/pvs-studio.com\/ru\/pvs-studio\/\">PVS-Studio<\/a> :). \u041d\u043e \u0435\u0441\u043b\u0438 \u0434\u0430\u0436\u0435 \u043b\u0438\u0448\u043d\u0438\u043c \u0434\u043b\u044f \u043d\u0430\u0448\u0438\u0445 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u0442\u043e \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0430\u043f\u043e\u043c\u043d\u044e \ud83d\ude42 PVS-Studio \u2014 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043a\u043e\u0434\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u044c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0435 \u0441 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439. \u0412 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0431\u044b\u043b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u0435\u0440\u0441\u0438\u0438 7.16 \u0438 <a href=\"https:\/\/github.com\/MonoGame\/MonoGame\">\u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 MonoGame<\/a> \u043e\u0442 12.01.2022.<\/p>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u043f\u0430\u0440\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0434\u043b\u044f \u043a\u043e\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u2013 DotNetZip \u0438 NVorbis. \u0420\u0430\u0434\u0438 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430 \u044f \u043f\u0440\u0438\u0432\u0451\u043b \u0438\u0445 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u0412\u044b \u0436\u0435 \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438 \u043c\u043e\u0436\u0435\u0442\u0435 \u043b\u0435\u0433\u043a\u043e <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/manual\/0014\/\">\u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0438\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u043a\u043e\u0434<\/a>.<\/p>\n<h3>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430<\/h3>\n<p><strong>Issue 1<\/strong><\/p>\n<pre><code class=\"cs\">public void Apply3D(AudioListener listener, AudioEmitter emitter)  {   ....   var i = FindVariable(\"Distance\");   _variables[i].SetValue(distance);   ....   var j = FindVariable(\"OrientationAngle\");   _variables[j].SetValue(angle);   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3106\/\">V3106<\/a> Possible negative index value. The value of &#8216;i&#8217; index could reach -1. MonoGame.Framework.DesktopGL(netstandard2.0) Cue.cs 251<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>i<\/em>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0430\u044f \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430, \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 -1.<\/p>\n<p>\u042d\u0442\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f* *\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043c\u0435\u0442\u043e\u0434\u0430 <em>FindVariable<\/em>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0435\u0433\u043e \u0432\u043d\u0443\u0442\u0440\u0438:<\/p>\n<pre><code class=\"cs\">private int FindVariable(string name) {   \/\/ Do a simple linear search... which is fast   \/\/ for as little variables as most cues have.   for (var i = 0; i &lt; _variables.Length; i++)   {     if (_variables[i].Name == name)     return i;   }    return -1; } <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043d\u0430\u0439\u0442\u0438 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u0441 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430, \u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0451\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0432\u043d\u043e -1. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0447\u0438\u0441\u043b\u0430 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0438\u043d\u0434\u0435\u043a\u0441\u0430 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0432\u044b\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u043d\u0438\u044e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f <em>IndexOutOfRangeException<\/em>.<\/p>\n<p><strong>Issue 2<\/strong><\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u044b\u043b\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <em>Apply3D<\/em>:<\/p>\n<pre><code class=\"cs\">public void Apply3D(AudioListener listener, AudioEmitter emitter) {   ....   lock (_engine.UpdateLock)   {     ....     \/\/ Calculate doppler effect.     var relativeVelocity = emitter.Velocity - listener.Velocity;     relativeVelocity *= emitter.DopplerScale;   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3137\/\">V3137<\/a> The &#8216;relativeVelocity&#8217; variable is assigned but is not used by the end of the function. MonoGame.Framework.DesktopGL(netstandard2.0) Cue.cs 266<\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u041f\u0440\u0438 \u0431\u0435\u0433\u043b\u043e\u043c \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435 \u043a\u043e\u0433\u043e-\u0442\u043e \u043c\u043e\u0433\u043b\u043e \u0441\u043c\u0443\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <em>lock<\/em>-\u0431\u043b\u043e\u043a\u0435, \u043d\u043e&#8230; \u0434\u043b\u044f <em>relativeVelocity<\/em> \u044d\u0442\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u043d\u0430\u0447\u0438\u0442, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u0430 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \u0438 \u043d\u0435 \u0443\u0447\u0430\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043c\u0435\u0436\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435* relativeVelocity* \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d\u043e \u043a\u0430\u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043f\u043e\u043b\u044e.<\/p>\n<p><strong>Issue 3<\/strong><\/p>\n<pre><code class=\"cs\">private void SetData(int offset, int rows, int columns, object data) {   ....   if(....)   {     ....   }   else if (rows == 1 || (rows == 4 &amp;&amp; columns == 4))    {     \/\/ take care of shader compiler optimization     int len = rows * columns * elementSize;     if (_buffer.Length - offset > len)           len = _buffer.Length - offset;    \/\/  &lt;=     Buffer.BlockCopy(data as Array,                      0,                      _buffer,                      offset,                      rows*columns*elementSize);   }   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3137\/\">V3137<\/a> The &#8216;len&#8217; variable is assigned but is not used by the end of the function. MonoGame.Framework.DesktopGL(netstandard2.0) ConstantBuffer.cs 91<\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u043e \u0435\u0449\u0451 \u043e\u0434\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043a\u043e\u0433\u0434\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438\u0441\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043d\u043e \u043d\u0438\u043a\u0430\u043a \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u0430\u043b\u0435\u0435.<\/p>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>len<\/em> \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c:<\/p>\n<pre><code class=\"cs\">int len = rows * columns * elementSize; <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0433\u043b\u044f\u0434\u0438\u0442\u0435\u0441\u044c \u0432 \u043a\u043e\u0434, \u0442\u043e \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u0435\u0442\u0438\u0442\u044c \u0447\u0443\u0432\u0441\u0442\u0432\u043e \u0434\u0435\u0436\u0430\u0432\u044e, \u0432\u0435\u0434\u044c \u044d\u0442\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u0434\u0435 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0440\u0430\u0437:<\/p>\n<pre><code class=\"cs\">Buffer.BlockCopy(data as Array, 0,                  _buffer,                  offset,                  rows*columns*elementSize);    \/\/ &lt;= <\/code><\/pre>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, <em>len<\/em> \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u044d\u0442\u043e\u0433\u043e \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>Issue 4<\/strong><\/p>\n<pre><code class=\"cs\">protected virtual object EvalSampler_Declaration(....) {   if (this.GetValue(tree, TokenType.Semicolon, 0) == null)     return null;            var sampler = new SamplerStateInfo();   sampler.Name = this.GetValue(tree, TokenType.Identifier, 0) as string;   foreach (ParseNode node in Nodes)     node.Eval(tree, sampler);            var shaderInfo = paramlist[0] as ShaderInfo;   shaderInfo.SamplerStates.Add(sampler.Name, sampler);    \/\/ &lt;=            return null; } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3156\/\">V3156<\/a> The first argument of the &#8216;Add&#8217; method is not expected to be null. Potential null value: <a href=\"http:\/\/sampler.Name\">sampler.Name<\/a>. MonoGame.Effect.Compiler ParseTree.cs 1111<\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043c\u0435\u0442\u043e\u0434 <em>Add<\/em> \u043d\u0435 \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u043d \u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 \u0432 \u043d\u0435\u0433\u043e <em>null<\/em> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430. \u0412 \u0442\u043e \u0436\u0435 \u0432\u0440\u0435\u043c\u044f \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0439 \u0432 <em>Add<\/em> \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <a href=\"http:\/\/sampler.Name\"><em>sampler.Name<\/em><\/a> \u043c\u043e\u0436\u0435\u0442 \u0438\u043c\u0435\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>null<\/em>.<\/p>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u0437\u0433\u043b\u044f\u043d\u0435\u043c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043d\u0430 \u043f\u043e\u043b\u0435 <em>shaderInfo.SamplerStates<\/em>:<\/p>\n<pre><code class=\"cs\">public class ShaderInfo {   ....    public Dictionary&lt;string, SamplerStateInfo> SamplerStates =      new Dictionary&lt;string, SamplerStateInfo>(); } <\/code><\/pre>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u044d\u0442\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u044c,* <em>\u0430<\/em> Add* \u2013 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, <em>null<\/em> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043a\u043b\u044e\u0447\u043e\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044f.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043b\u044e\u0447\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u043e\u043b\u044f <a href=\"http:\/\/sampler.Name\"><em>sampler.Name<\/em><\/a>. \u041f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 <em>null<\/em> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u0441\u0432\u043e\u0435\u043d \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435:<\/p>\n<pre><code class=\"cs\">sampler.Name = this.GetValue(tree, TokenType.Identifier, 0) as string; <\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0447\u0435\u0440\u0435\u0437 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <em>as<\/em> \u0431\u0443\u0434\u0435\u0442 <em>null<\/em>, \u0435\u0441\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 <em>GetValue<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em> \u0438\u043b\u0438 \u043d\u0435 \u044d\u043a\u0437\u0435\u043c\u043f\u043b\u044f\u0440 \u0442\u0438\u043f\u0430 <em>string<\/em>. \u041c\u043e\u0436\u0435\u0442 \u043b\u0438 \u0442\u0430\u043a\u043e\u0435 \u0431\u044b\u0442\u044c? \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432\u043d\u0443\u0442\u0440\u044c <em>GetValue<\/em>:<\/p>\n<pre><code class=\"cs\">protected object GetValue(ParseTree tree,                           TokenType type,                           ref int index) {   object o = null;   if (index &lt; 0) return o;    \/\/ left to right   foreach (ParseNode node in nodes)   {     if (node.Token.Type == type)     {       index--;       if (index &lt; 0)       {         o = node.Eval(tree);         break;       }     }   }   return o; } <\/code><\/pre>\n<p>\u0418\u0442\u0430\u043a, \u044d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <em>null<\/em> \u0432 \u0434\u0432\u0443\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ol>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>index<\/em> \u043c\u0435\u043d\u044c\u0448\u0435 0;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043f\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u043d\u043e\u043c\u0443 <em>type<\/em> \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 <em>nodes<\/em>.<\/p>\n<\/li>\n<\/ol>\n<p>\u0421\u0442\u043e\u0438\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443 \u043d\u0430 <em>null<\/em> \u0434\u043b\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>as<\/em>.<\/p>\n<p><strong>Issue 5<\/strong><\/p>\n<pre><code class=\"cs\">internal void Update() {   if (GetQueuedSampleCount() > 0)   {     BufferReady.Invoke(this, EventArgs.Empty);   } } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3083\/\">V3083<\/a> Unsafe invocation of event &#8216;BufferReady&#8217;, NullReferenceException is possible. Consider assigning event to a local variable before invoking it. MonoGame.Framework.DesktopGL(netstandard2.0) Microphone.OpenAL.cs 142<\/p>\n<p>\u0421\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u043c \u0432\u044b\u0437\u043e\u0432\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f, \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043d\u0435 \u0438\u043c\u0435\u044e\u0449\u0435\u0433\u043e \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u043e\u0434\u0430 <em>GetQueuedSampleCount<\/em>. \u0415\u0441\u043b\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432 \u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u044f, \u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <em>NullReferenceException<\/em>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0436\u0435 \u043b\u043e\u0433\u0438\u043a\u0430 \u0442\u0430\u043a\u043e\u0432\u0430, \u0447\u0442\u043e \u0438\u0441\u0442\u0438\u043d\u043d\u043e\u0441\u0442\u044c \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f &#171;<em>GetQueuedSampleCount() > 0<\/em>&#187; \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u043f\u043e\u0434\u043f\u0438\u0441\u0447\u0438\u043a\u043e\u0432, \u0442\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u043e\u0441\u0442\u0430\u0451\u0442\u0441\u044f. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u044f. \u0421\u043e\u0431\u044b\u0442\u0438\u0435 <em>BufferReady<\/em> \u043e\u0431\u044a\u044f\u0432\u043b\u0435\u043d\u043e \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n<pre><code class=\"cs\">public event EventHandler&lt;EventArgs> BufferReady; <\/code><\/pre>\n<p>\u0412\u0430\u0436\u043d\u043e \u043e\u0442\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 <em>public<\/em> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u0435 <em>BufferReady<\/em> \u0432 \u043b\u044e\u0431\u043e\u043c \u043a\u043e\u0434\u0435, \u0447\u0442\u043e \u043f\u043e\u0432\u044b\u0448\u0430\u0435\u0442 \u0448\u0430\u043d\u0441 \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u0435\u043c \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u043f\u043e\u0442\u043e\u043a\u0430\u0445.<\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0434\u0430\u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>null<\/em> \u0432 \u0441\u0430\u043c\u043e \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043d\u0435 \u0441\u043f\u0430\u0441\u0430\u0435\u0442, \u0432\u0435\u0434\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <em>BufferReady<\/em> \u043c\u0435\u0436\u0434\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0438 \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u043e.<\/p>\n<p>\u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u2013 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 Elvis operator &#8216;?.&#8217; \u0432 \u0432\u044b\u0437\u043e\u0432 <em>Invoke<\/em>:<\/p>\n<pre><code class=\"cs\">BufferReady?.Invoke(this, EventArgs.Empty); <\/code><\/pre>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d, \u0442\u043e \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u0438\u0441\u0432\u043e\u0438\u0442\u044c <em>BufferReady<\/em> \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043d\u0435\u0439:<\/p>\n<pre><code class=\"cs\">EventHandler&lt;EventArgs> bufferReadyLocal = BufferReady; if (bufferReadyLocal != null)   bufferReadyLocal.Invoke(this, EventArgs.Empty); <\/code><\/pre>\n<p>\u041e\u0448\u0438\u0431\u043a\u0438 <em>public<\/em> \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u0432 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u043c \u043a\u043e\u0434\u0435 \u043c\u043e\u0433\u0443\u0442 \u043f\u043e\u044f\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0440\u0435\u0434\u043a\u043e, \u043d\u043e \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0447\u0435\u043d\u044c \u043a\u043e\u0432\u0430\u0440\u043d\u044b\u043c\u0438. \u0422\u0430\u043a\u0438\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0441\u043b\u043e\u0436\u043d\u043e \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0442\u0435\u043c\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c\u0438 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u0432 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043a \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0435 <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3083\/\">V3083<\/a>.<\/p>\n<p><strong>Issue 6<\/strong><\/p>\n<pre><code class=\"cs\">public override TOutput Convert&lt;TInput, TOutput>(   TInput input,   string processorName,   OpaqueDataDictionary processorParameters) {   var processor = _manager.CreateProcessor(processorName,                                                  processorParameters);   var processContext = new PipelineProcessorContext(....);   var processedObject = processor.Process(input, processContext);   .... } <\/code><\/pre>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.com\/ru\/docs\/warnings\/v3080\/\">V3080<\/a> Possible null dereference. Consider inspecting &#8216;processor&#8217;. MonoGame.Framework.Content.Pipeline PipelineProcessorContext.cs 55<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u043c \u0440\u0430\u0437\u044b\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0438 \u043f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435 <em>processor.Process<\/em>.<\/p>\n<p>\u041e\u0431\u044a\u0435\u043a\u0442 \u043a\u043b\u0430\u0441\u0441\u0430 <em>processor<\/em> \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u0432\u044b\u0437\u043e\u0432\u043e\u043c <em>_manager.CreateProcessor<\/em>. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0430\u0441\u0442\u044c \u0435\u0433\u043e \u043a\u043e\u0434\u0430:<\/p>\n<pre><code class=\"cs\">public IContentProcessor CreateProcessor(                     string name,                     OpaqueDataDictionary processorParameters) {   var processorType = GetProcessorType(name);   if (processorType == null)     return null;   .... } <\/code><\/pre>\n<p>\u0418\u0437 \u043a\u043e\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u0435\u0442, \u0447\u0442\u043e <em>CreateProcessor<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u0438 \u043c\u0435\u0442\u043e\u0434 <em>GetProcessorType<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em>. \u0427\u0442\u043e \u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438 \u043d\u0430 \u0435\u0433\u043e \u043a\u043e\u0434:<\/p>\n<pre><code class=\"cs\">public Type GetProcessorType(string name) {   if (_processors == null)     ResolveAssemblies();    \/\/ Search for the processor type.   foreach (var info in _processors)   {     if (info.type.Name.Equals(name))       return info.type;   }    return null; } <\/code><\/pre>\n<p>\u042d\u0442\u043e\u0442 \u043c\u0435\u0442\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c <em>null<\/em>, \u0435\u0441\u043b\u0438 \u0432 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438 \u043d\u0435 \u0431\u044b\u043b \u043d\u0430\u0439\u0434\u0435\u043d \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442. \u0422\u043e\u0433\u0434\u0430 \u0435\u0441\u043b\u0438 <em>GetProcessorType<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em>, \u0442\u043e \u0438 <em>CreateProcessor<\/em> \u0432\u0435\u0440\u043d\u0451\u0442 <em>null<\/em>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <em>processor<\/em>. \u0412 \u0438\u0442\u043e\u0433\u0435 \u044d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a <em>NullReferenceExce<\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-329069","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329069","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=329069"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329069\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=329069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=329069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=329069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}