十大接单网站,效果图网站密码破解,阿里云服务器如何实现一个空间绑定两个不同主体的网站,任务网站的接口怎么做本文告诉大家如何使用 Infer# 开源库配合 GitHub 的 Action 实现自动分析代码缺陷#xff0c;如找到可空引用或线程安全等问题这是一个在 GitHub 上完全开源的仓库#xff0c;请看 https://github.com/microsoft/infersharp刚好今天收到了 Infer# 发布 1.2 版本博客#xff… 本文告诉大家如何使用 Infer# 开源库配合 GitHub 的 Action 实现自动分析代码缺陷如找到可空引用或线程安全等问题这是一个在 GitHub 上完全开源的仓库请看 https://github.com/microsoft/infersharp刚好今天收到了 Infer# 发布 1.2 版本博客请看 Infer# v1.2: Interprocedural Memory Safety Analysis For C# - .NET Blog关于 GitHub 的 Action 的基础入门请看 dotnet 部署 github 的 Action 进行持续集成使用的方法非常简单只需要在 GitHub 的 Action 的配置文件里面添加如下代码- name: Run Infer# uses: microsoft/infersharpactionv1.2with:binary-path: 输出二进制文件夹路径如我在 https://github.com/dotnet-campus/AsyncWorkerCollection 开源仓库上的配置代码如下- name: Run Infer# uses: microsoft/infersharpactionv1.2with:binary-path: AsyncWorkerCollection/bin/Release/netcoreapp3.1此输出的二进制文件夹路径里面要求是包含 dll 和 pdb 文件通过 dll 进行分析通过 pdb 从而告诉你是哪个文件效果如下可以看到输出了资源没有释放和线程安全问题Found 3 issuesIssue Type(ISSUED_TYPE_ID): #Thread Safety Violation(THREAD_SAFETY_VIOLATION): 2Dotnet Resource Leak(DOTNET_RESOURCE_LEAK): 1Analysis Result#0
/home/runner/work/AsyncWorkerCollection/AsyncWorkerCollection/AsyncWorkerCollection/AsyncTaskQueue_/AsyncTaskQueue.cs:72: error: Dotnet Resource LeakLeaked { n$1 - 1 } resource(s) in method AwaitableTask AsyncTaskQueue.GetExecutableTask(Action) at type(s) System.Threading.Tasks.Task.#1
/home/runner/work/AsyncWorkerCollection/AsyncWorkerCollection/AsyncWorkerCollection/DoubleBuffer_/DoubleBufferLazyInitializeTask.cs:47: warning: Thread Safety ViolationUnprotected write. Non-private method DoubleBufferLazyInitializeTask1T.OnInitialized() writes to field this.dotnetCampus.Threading.DoubleBufferLazyInitializeTask1T._isInitialized outside of synchronization.Reporting because this access may occur on a background thread.#2
/home/runner/work/AsyncWorkerCollection/AsyncWorkerCollection/AsyncWorkerCollection/DoubleBuffer_/DoubleBufferLazyInitializeTask.cs:41: warning: Thread Safety ViolationRead/Write race. Non-private method DoubleBufferLazyInitializeTask1T.OnInitialized() reads without synchronization from this.dotnetCampus.Threading.DoubleBufferLazyInitializeTask1T._isInitialized. Potentially races with write in method DoubleBufferLazyInitializeTask1T.OnInitialized().Reporting because this access may occur on a background thread.Found 3 issuesIssue Type(ISSUED_TYPE_ID): #Thread Safety Violation(THREAD_SAFETY_VIOLATION): 2Dotnet Resource Leak(DOTNET_RESOURCE_LEAK): 1此工具只能在 Linux 下运行官方有制作好一个 docker 文件可以从 https://github.com/microsoft/infersharpaction 拉到。但是问题不大因为此工具是对输出文件进行分析的所以可以在 Windows 平台上进行构建只是将输出的二进制文件使用此工具在现有的仓库加添加此工具的例子请看 https://github.com/dotnet-campus/AsyncWorkerCollection/pull/66