We can also hover the markers in the right-hand gutter to see the issue found there, including a preview. We can hover the icon and get a summary of potential issues. If it’s red, our code will either not compile or has a serious error that needs fixing. If there’s a yellow exclamation mark, we have some potential issues. Rider also displays code analysis results in the top-right corner of the editor. In this case, we’re casting a Person to a Customer, which could result in a NullReferenceException at runtime. Hovering over an inspection shows us what the issue is. We’ll see our code get underlined with a “squiggle”, its color based on the severity of the code inspection result (hint, suggestion, warning, error). We can access code analysis in a number of places, but let’s start with a place where it’s very obvious: in the editor. It may show suggestions too, helping us make our code better. If it detects a potential issue, it will show a warning. Rider looks at individual statements and at our overall solution architecture. What if we could detect potential issues while writing code?Ĭode Analysis continuously looks at what we are doing and tries to determine what we want to achieve. We have to attach a profiler to figure out whether we implemented the Disposable pattern correctly. For example, to detect runtime errors we have to run our application, click through it and see if things are okay. There’s a downside to these three ways of validating code: they all require an explicit action.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |