• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

SamboyCoding / Cpp2IL / 15052278841

15 May 2025 06:16PM UTC coverage: 34.038% (-0.4%) from 34.453%
15052278841

push

github

SamboyCoding
Support injecting anything
* Nested types
* Events
* Properties
* Assemblies

Support additional metadata in injected assemblies

Make setter for TypeAnalysisContext::OverrideBaseType public

TypeAnalysisContext::InterfaceContexts as list rather than array

Fix sign bug

Support generic parameters on type contexts and method contexts

Make GenericParameterTypeAnalysisContext instances unique

Revert change to Il2CppGenericParameter::Index

Use attributes to determine if injected methods are static
* Also add hide by sig attribute for injected constructors

Support overrides on injected methods

In ControlFlowGraphOutputFormat, exclude injected assemblies

Ensure injected assemblies can't delete existing assemblies

Backing field on .NET Standard for injected method overrides

Implement requested change

1774 of 6622 branches covered (26.79%)

Branch coverage included in aggregate %.

147 of 196 new or added lines in 27 files covered. (75.0%)

53 existing lines in 2 files now uncovered.

4155 of 10797 relevant lines covered (38.48%)

188267.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

78.13
/Cpp2IL.Core/Model/Contexts/GenericParameterTypeAnalysisContext.cs
1
using System;
2
using System.Collections.Generic;
3
using System.Linq;
4
using System.Reflection;
5
using Cpp2IL.Core.Utils;
6
using LibCpp2IL.BinaryStructures;
7
using LibCpp2IL.Metadata;
8

9
namespace Cpp2IL.Core.Model.Contexts;
10

11
public class GenericParameterTypeAnalysisContext : ReferencedTypeAnalysisContext
12
{
13
    private readonly Il2CppGenericParameter? definition;
14

15
    public sealed override string DefaultName { get; }
2,260✔
16

17
    public sealed override string DefaultNs => "";
×
18

19
    public int Index { get; }
212,244✔
20

21
    public override Il2CppTypeEnum Type { get; }
212,244✔
22

23
    public GenericParameterAttributes Attributes { get; }
2,260✔
24

25
    private List<TypeAnalysisContext>? _constraintTypes;
26
    public List<TypeAnalysisContext> ConstraintTypes
27
    {
28
        get
29
        {
30
            _constraintTypes ??= definition?.ConstraintTypes.Select(t => DeclaringAssembly.ResolveIl2CppType(t)).ToList() ?? [];
2,635!
31
            return _constraintTypes;
2,260✔
32
        }
33
    }
34

NEW
35
    public HasGenericParameters Owner { get; }
×
36

37
    /// <summary>
38
    /// This should only be used by the initializers for <see cref="TypeAnalysisContext.GenericParameters"/> and <see cref="MethodAnalysisContext.GenericParameters"/>.
39
    /// It ensures that generic parameters are only held by their owners.
40
    /// </summary>
41
    internal GenericParameterTypeAnalysisContext(Il2CppGenericParameter genericParameter, HasGenericParameters owner)
42
        : this(genericParameter.Name ?? "T", genericParameter.genericParameterIndexInOwner, genericParameter.Type, genericParameter.Attributes, owner)
10,915!
43
    {
44
        definition = genericParameter;
10,915✔
45
    }
10,915✔
46

47
    public GenericParameterTypeAnalysisContext(string name, int index, Il2CppTypeEnum type, GenericParameterAttributes attributes, HasGenericParameters owner) : base(owner.CustomAttributeAssembly)
10,915✔
48
    {
49
        if (type is not Il2CppTypeEnum.IL2CPP_TYPE_VAR and not Il2CppTypeEnum.IL2CPP_TYPE_MVAR)
10,915!
50
            throw new ArgumentException($"Generic parameter type is not a generic parameter, but {type}", nameof(type));
×
51

52
        DefaultName = name;
10,915✔
53
        Index = index;
10,915✔
54
        Type = type;
10,915✔
55
        Attributes = attributes;
10,915✔
56
        Owner = owner;
10,915✔
57
    }
10,915✔
58
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc