Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C#: Compile against the reference assemblies in the standalone extractor (if possible) #13970

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

michaelnebel
Copy link
Contributor

No description provided.

@github-actions github-actions bot added the C# label Aug 15, 2023
@michaelnebel
Copy link
Contributor Author

Uh. I am trying to replace the .NET runtime dll's with the corresponding references assemblies, but the DB-CHECK fails: https://github.com/github/semmle-code/actions/runs/5876713182/job/15935436224
Any ideas or recommendation on, what we can do about that (@hvitved @tamasvajk)?

@tamasvajk
Copy link
Contributor

Uh. I am trying to replace the .NET runtime dll's with the corresponding references assemblies, but the DB-CHECK fails: https://github.com/github/semmle-code/actions/runs/5876713182/job/15935436224 Any ideas or recommendation on, what we can do about that (@hvitved @tamasvajk)?

Regarding

+[VALUE_NOT_IN_TYPE] predicate extractor_messages(@extractor_message id, int severity, string origin, string text, string entity, @location_default location, string stack_trace): Value 155 of field location is not in type @location_default. The value is however in the following types: @assembly. Appears in tuple (110334,5,"C# extractor","Failed to resolve target for implicit operator invocation for a parameter default.","",155,"")
+	Relevant element: location=155
+		Full ID for 155: @"System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e#file:////home/runner/work/semmle-code/semmle-code/target/intree/codeql  integration  tests  dist  csharp/csharp/tools/linux64/System.Private.CoreLib.dll;assembly"

Maybe we should change the scheme and have @location location instead of @location_default location. This is how it's defined in the DB scheme: @location = @location_default | @assembly;

Regarding:

+[VALUE_NOT_IN_TYPE] predicate tuple_element(@tuple_type tuple, int index, @field field): Value 23650 of field tuple is not in type @tuple_type. The value is however in the following types: @class_type. Appears in tuple (23650,0,125865)
+	Relevant element: tuple=23650
+		Full ID for 23650: @"(Item1:(23646),Item2:(23646));tuple". The ID may expand to @"(Item1:{@"{@"{@"(17).Numerics;namespace"}.IBinaryInteger`1;type"}_0;typeparameter"},Item2:{@"{@"{@"(17).Numerics;namespace"}.IBinaryInteger`1;type"}_0;typeparameter"});tuple"
+	Relevant element: field=125865
+		Full ID for 125865: @"(23646) (110998).Item1;field". The ID may expand to @"{@"{@"{@"(17).Numerics;namespace"}.IBinaryInteger`1;type"}_0;typeparameter"} {@"{@"{@"(15).System;namespace"}.ValueTuple`2;type"}<{@"{@"(21343).IBinaryInteger`1;type"}_0;typeparameter"},{@"{@"(21343).IBinaryInteger`1;type"}_0;typeparameter"}>;type"}.Item1;field"

This is odd. Is it possible that Roslyn is not returning the correct type kind? This is what we have in the extractor:

case TypeKind.Class: return Kinds.TypeKind.CLASS;
case TypeKind.Struct:
    return ((INamedTypeSymbol)Symbol).IsTupleType && !constructUnderlyingTupleType
        ? Kinds.TypeKind.TUPLE
        : Kinds.TypeKind.STRUCT;

At the same time, we do have ;tuple at the end of the ID, so we seem to be able to figure it out in another place:

type.IsTupleType ? TupleType.Create(cx, type) : (IEntity)NamedType.Create(cx, type);

@michaelnebel
Copy link
Contributor Author

@tamasvajk : Thank you very much for the pointers! They are extremely helpful!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants