The Wayback Machine - https://web.archive.org/web/20260106061517/https://github.com/github/codeql/pull/4484
Skip to content

Conversation

@tamasvajk
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the C# label Oct 15, 2020
@tamasvajk tamasvajk force-pushed the feature/custom-assert-methods branch 2 times, most recently from 585fd15 to 599f5bd Compare October 16, 2020 08:56
@tamasvajk tamasvajk force-pushed the feature/custom-assert-methods branch from 599f5bd to 52bdd8b Compare October 16, 2020 10:25
@tamasvajk tamasvajk changed the title WIP: C#: Add support for custom assert methods ([DoesNotReturnIf(true/false)]) C#: Add support for custom assert methods ([DoesNotReturnIf(true/false)]) Oct 16, 2020
@tamasvajk tamasvajk changed the title C#: Add support for custom assert methods ([DoesNotReturnIf(true/false)]) C#: Add support for custom assert methods (DoesNotReturnIfAttribute) Oct 16, 2020
@tamasvajk tamasvajk force-pushed the feature/custom-assert-methods branch 7 times, most recently from 9182cf7 to 52bdd8b Compare October 20, 2020 06:19
@tamasvajk tamasvajk marked this pull request as ready for review October 20, 2020 06:20
@tamasvajk tamasvajk requested a review from a team as a code owner October 20, 2020 06:20

override Class getExceptionClass() {
// The user defines the thrown exception.
any()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a large Cartesian product, so better to return the System.Exception base class.

override predicate hasEntry(ControlFlowElement pred, ControlFlowElement succ, Completion c) {
exists(AssertMethod m |
pred = last(a.getExpr(), c) and
pred = last(a.getAnExpr(), c) and
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CFG splitting logic will not work for assertions with multiple assertion arguments; I will address in a follow-up PR.

@tamasvajk
Copy link
Contributor Author

@tamasvajk
Copy link
Contributor Author

@hvitved
Copy link
Contributor

hvitved commented Oct 29, 2020

There are some nice fixes in the results, for example, we're not reporting on the following that it can be null: https://github.com/dotnet/runtime/blob/45833cb6e43b481cdb1dabe2ce29fca48ee7bf6a/src/libraries/System.Linq.Expressions/src/System/Dynamic/DynamicObject.cs#L465

That's excellent!

@tamasvajk tamasvajk merged commit 64dcfbd into github:main Oct 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants