Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 02:47
    tmat synchronize #64160
  • 02:24
    tmat synchronize #64892
  • 02:24

    tmat on revert-64801-revert-64749-ProjectProps

    IntegrationTestWorkaround (compare)

  • 00:38
    svick commented #65751
  • 00:04
    dotnet-bot auto_merge_enabled #65752
  • 00:04
    dotnet-bot assigned #65752
  • 00:04
    dotnet-bot labeled #65752
  • 00:04
    dotnet-bot labeled #65752
  • 00:04
    dotnet-bot review_requested #65752
  • 00:04
    dotnet-bot review_requested #65752
  • 00:04
    dotnet-bot review_requested #65752
  • 00:04
    dotnet-bot review_requested #65752
  • 00:04
    dotnet-bot opened #65752
  • Dec 03 23:57
    tmat synchronize #64892
  • Dec 03 23:57

    tmat on revert-64801-revert-64749-ProjectProps

    Fix (compare)

  • Dec 03 22:54
    felipepassion commented #58973
  • Dec 03 22:53
    felipepassion commented #58973
  • Dec 03 22:34
    federico-r-figueredo edited #65751
  • Dec 03 22:33
    federico-r-figueredo edited #65751
  • Dec 03 22:33
    dotnet-issue-labeler[bot] labeled #65751
timiil
@timiil
Is there any opensource solution that use Roslyn to 'obfuscation' or 'protect' .NET PE ?
Bernd Baumanns
@bernd5
roslyn only emits IL - but it doesn't modify it
Yair Halberstadt
@YairHalberstadt

IsNullableTypeOrTypeParameter (https://sourceroslyn.io/#Microsoft.CodeAnalysis.CSharp/Symbols/TypeSymbolExtensions.cs,113) checks if a constraint type is a nullable type.

But how is this ever possible since structs can't be constraints? Is it only if the constraint is defined in a different language?

Mohammad Hamdy Ghanem
@VBAndCs
Languages are getting more complex (esp C#). It would be helpful for beginners and maybe old dves as mine if ther is an action named explain or whatever to lower a code block to a classic simple C#/VB code and show it in a readoly code window. Pattern matching expressions are in top of things that may need explanation. I may go far and say every new concept since Roslyn can be considered hard and nee to be explained. This can be a useful educational feature, and ease the pain for new team members that joins a large project. VS offers to simplify expressions which in most cases means shorten them into a complex modern syntax! We may need an action on the opposite direction. This seems a lot of work, but it can make use of the Roslyn code itself if it lowers these statements.
timiil
@timiil

roslyn only emits IL - but it doesn't modify it

i am looking for some 'name obfuscation Analyzer' or 'string encrypt Analyzer' ... 'XXX protect sourcecode Analyzer' things that build from roslyn...

Bernd Baumanns
@bernd5
if you have the csharp source you can write some rewriters which renames locals and non public types / methods
something like this
Bernd Baumanns
@bernd5
I would avoid arabic chars
timiil
@timiil
:)
Bernd Baumanns
@bernd5
I would name them a1, a2, a3....
but unicode should work, too.
or perhaps something like obf_local_1
timiil
@timiil
are not these task can be done by Analyzer??
Bernd Baumanns
@bernd5
no, an analyzer produces just diagnostic AFAIK
it would be a pre compile step
Yair Halberstadt
@YairHalberstadt
@VBAndCs that's basically what decompilers do - e.g. sharplab
timiil
@timiil
who produce the tons of 'Change Code Suggestion' in the vs ??
Bernd Baumanns
@bernd5
these are called "Code Fix"
timiil
@timiil
may be my missunderstanding that these are from roslyn
Bernd Baumanns
@bernd5
the are developed by the VS team
no they are from roslyn - that is right
timiil
@timiil
so , how can i write some anti human reading CodeFix rule ?
Bernd Baumanns
@bernd5
CodeFix is more than you need - a CodeFix adds some VS integration code
timiil
@timiil
oh, sounds bad. sounds that related by IDE, but not dotnet CLR
Bernd Baumanns
@bernd5
you could write a simple console app which loads the original source and produces "obfuscated" source which is than compiled to IL via the normal build pipeline
Yes, CodeFixes are IDE related - but what you want is not IDE related
timiil
@timiil
thanks for your kindly reply, a lot of knowlege knowed toninght and i should keep learning more
Bernd Baumanns
@bernd5
When you write your obfuscator you have to care about e.g. nameof() and reflection
because those names would change, too.
If you need further help - please ask.
timiil
@timiil
sure , very thanks :)
Yair Halberstadt
@YairHalberstadt
@timiil most obfuscators work with raw IL. They already exist so not sure why you would roll your own
timiil
@timiil
one reason is , IL changing this very hacking, and the opensource solution is so few amount.
Yair Halberstadt
@YairHalberstadt
Modifying IL is much safer, since it's easier to know what's safe to change and what's not.
Bernd Baumanns
@bernd5
yes - on IL level getting all semantics is quite complicated
but renaming locals would be very simple for example
Yair Halberstadt
@YairHalberstadt
For example you might rename an internal method named GetEnumerator and break a foreach.
timiil
@timiil
the second reason is , i think we have the source code, so if we use some skillful rewrite rule onto the sourcecode, and then build from roslyn, that sounds is very ...Nature
Bernd Baumanns
@bernd5
@timiil should the produced assembly be usable by other assemblies?
timiil
@timiil
who is behind 'dotnet build' ?? is 'MSBuild' or 'roslyn'
Bernd Baumanns
@bernd5
both 😃
MSBuild calls roslyn
timiil
@timiil

@timiil should the produced assembly be usable by other assemblies?

yes, that is exectly what i thinking on.

Bernd Baumanns
@bernd5
Than GetEnumerator would break not only on source level - but on IL level, too.
timiil
@timiil
and as we know, we even have opensource dotnet decomplier
Bernd Baumanns
@bernd5
You mean ILSpy?
timiil
@timiil
so , the pluzzle may be , decomplie -> rewrite source text -> complie on the air -> use it ?
Bernd Baumanns
@bernd5
not really
decompiling is quite hard