-
Notifications
You must be signed in to change notification settings - Fork 88
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
TypeScrambler fails when scrambling generic class #5
Comments
Error is raised by TypeSig.ScopeType is null and because there is no exception handling here it throw an error |
Ah yes. As an attempted work around I added a Either way it should work. 😉 |
I don't think |
I'll run it against my test cases and get back to you. |
From my tests it seems is simply not compatible with generic types at all. class Test<T>
{
T _value;
public Test(T t)
{
// The field has the same type as the parameter.
this._value = t;
}
public void Write()
{
Console.WriteLine(this._value);
}
}
class Program
{
static void Main(string[] args)
{
Test<int> test1 = new Test<int>(5);
// Call the Write method.
test1.Write();
// Use the generic type Test with a string type parameter.
Test<string> test2 = new Test<string>("cat");
test2.Write();
Console.ReadKey();
}
} will inevitably fail and throw an error when TypeScrambler is selected. It seems to be a very sloppy project. I might remove it and prefer to code my own from scratch. |
Where did you get this thing from? I only got it in my repository from yours. |
@mkaring he got it from here: https://github.com/BahNahNah/ConfuserExPlugins |
The problem is still present. The issue occurs because that I think the basic method on how this works is the problem here. The analyzing part of the scrambler needs to annotate the methods that are selected for scrambling and the rewriter phase needs to update them based on the the annotations. Also it is absolutely required to rename the All in all I think most of the scrambler is usable. Just the part how the phases communicate needs to be improved to some extend. |
Last commit should have fixed this bug @mkaring thanks to 2 PR |
That is still not it. It still messes up the analysis stage of the renamer, because the method references don't match anymore. See: |
Bit late but ive started a rewrite to make it a bit more readable. For whatever reason its corrupting the assembly and debugging it isnt giving me much help as to why. Removing this line stops it crashing so its from applying the generics incorrectly. Its late so its probably just a stupid mistake somewhere, ill try and fix it when i get time. Edit: fixed. Working . And I've added some more stuff. |
People, we might just need a Pull Request here no ? Otherwise we just might put that protection in the bin ? |
Describe the bug
The type scrambler causes and error together with the renaming when handling methods in a generic class, because it does not handle the generic parameters of the class itself properly.
To Reproduce
Steps to reproduce the behavior:
AnalyzePhase
raises the error.Expected behavior
Should work without errors.
Additional context
My best guess is that the scrambler does not consider the generic parameter of the class at this point.
The result of the UnitTest, including the error is here:
https://ci.appveyor.com/project/mkaring/confuserex/build/13#L289
The text was updated successfully, but these errors were encountered: