Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 19:15
    runfoapp[bot] edited #61367
  • 19:15
    runfoapp[bot] edited #61367
  • 19:04
    msftbot[bot] milestoned #65804
  • 19:04
    msftbot[bot] milestoned #65804
  • 19:04

    RikkiGibson on main

    Use `dotnet` instead of `.dotne… (compare)

  • 19:03
    RikkiGibson closed #65803
  • 19:03
    RikkiGibson closed #65804
  • 19:00
    runfoapp[bot] edited #64672
  • 19:00
    runfoapp[bot] edited #64672
  • 19:00
    runfoapp[bot] edited #61367
  • 19:00
    runfoapp[bot] edited #61367
  • 18:46
    runfoapp[bot] edited #64672
  • 18:46
    runfoapp[bot] edited #64672
  • 18:45
    runfoapp[bot] edited #61367
  • 18:45
    runfoapp[bot] edited #61367
  • 18:31
    runfoapp[bot] edited #64672
  • 18:31
    runfoapp[bot] edited #64672
  • 18:30
    runfoapp[bot] edited #61367
  • 18:30
    runfoapp[bot] edited #61367
  • 18:25
    alrz synchronize #65874
CyrusNajmabadi
@CyrusNajmabadi
There are many similar ideas in both.
For example PropertyInfo in reflection, and IPropertySymbol in Roslyn.
Roslyn has no runtime querying concept though*. It's all (mostly) about the information at compile time.
Michael Fry
@nth-commit

Thanks :)

Yeah I understand. Although a large portion of System.Reflection is to do with statically available info (obviously I don't expect roslyn to be able to give me runtime values if there isn't a program running, so there's no representation of CreateInstance, SetValue, GetValue etc.).

For example PropertyInfo in reflection, and IPropertySymbol in Roslyn

This is the stuff I want to hear about :D. I just want to know if these kinds of relationships are documented somewhere - and is it a value that the roslyn team hold or is any symmetry between the APIs incidental?

CyrusNajmabadi
@CyrusNajmabadi
Both? :-)
Both the language and the bcl need to represent things from metadata. And metadata in c# is produced from source. So there's are just common ways of representing those entities.
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.