Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7050661
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:10:13+00:00 2026-05-28T03:10:13+00:00

I am looking for some guidance as to what is going on when using

  • 0

I am looking for some guidance as to what is going on when using proto-buf net with obfuscation (Dotfuscator). One half of the project is a DLL and the other is an EXE elsewhere and using proto-buf NET they exchange data flawlessly. Until I obfuscate the DLL.

At that point P-BN fails without raising an exception, returning variously a 0 length byte array or a foreshortened one depending on what I have fiddled with. The class is fairly simple (VB):

<ProtoContract(Name:="DMailer")> _
Friend Class DMailer

    Private _Lic As Cert
    Private _Sys As Sys
    Private _LList As List(Of LItem)

    ..
    ..
End Class

There are 3 props all decorated with ProtoMember to get/set the constituent class objects. Snipped for brevity.

Again, it works GREAT until I obfuscate the DLL. Then, Dotfuscator renames each of these to null, apparently since they are all Friend, and that seems to choke proto-buff. If I exempt the class from renaming (just the class name, not props/members), it seems to work again. It makes sense that P-BN would only be able to act on objects with a proper name, though when asked to serialize a null named object, it seems like an exception might be in order.

On the other hand, much of the charm of PB-N is supposed to be serialization independent of .NET names working from attributes – at least as I understand it. Yet in this case it only seems to work with classes with names. I tried using the Name qualifier or argument as shown above, to no avail – it apparently doesnt do what I thought it might.

So, I am curious if:

a) …I have basically surmised the problem correctly

b) …There is some other attribute or flag that might facilitate serializing
a null named object

c) …if there are any other insights that would help.

If I exempt all 3 or 4 classes from Dotfuscator renaming (LList is not actually implemented yet, leaving DMailer, Cert and Sys), the DLL seems to work again – at least the output is the correct size. I can live with that, though obscured names would be better: Dotfuscator (CE) either exempts them or sets the names to Null – I cant seem to find a way to force them to be renamed.

Rather than exempt 3 or 4 classes from renaming, one alternative I am considering is to simply store the Serializer output for Cert and Sys as byte arrays or Base64 strings in DMailer instead of classes. Then have the receiver Deserialize each object individually. It is kind of nice to be able to unpack just one thing and have your toys right there as if by magic though.

(many)TIA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:10:14+00:00Added an answer on May 28, 2026 at 3:10 am

    Since there were a few upticks of interest, here is what looks like will work:

    a) No form of reflection will be able to get the list of properties for an obfuscated type.
    I tried walking thru all the types to find the ones with ProtoContract on it, I could find them
    but the property names are all changed to a,m, b, j, g.

    I also tried Me.GetType.GetProperties with the same result.

    You could implement a map from the output to indicate that Employee.FirstName is now a0.j, but distributing this defeats the purpose of obfuscation.

    b) What does work to a degree is to exempt the class NAME from obfuscation. Since PB-N looks for the ProtoMember attributes to get the data, you CAN obfuscate the Property/Member names, just not the CLASS/type name. If the name is something like FederalReserveLogIn, your class/type has a bullseye on it.

    I have had initial success doing the following:

    1) Build a simple class to store a Property Token and value. Store everything as string using ConvertFromInvariantString. Taking a tip from PBN, I used an integer for the token:

    <ProtoMember(propIndex.Foo)>
    Property Foo As String
    

    An enum helps tie everything together later. Store these in a Dictionary(Of T, NameValuePair)

    2) add some accessors. these can perform the type conversions for you:

      Public Sub Add(ByVal Key As T, ByVal value As Object)
            If _col.ContainsKey(Key) Then
                _col.Remove(Key)
            End If
    
            _col.Add(Key, New TValue(value))
    
        End Sub
    
        Public Function GetTItem(Of TT)(key As T) As TT
            If _col.ContainsKey(key) Then
                Return CType(_col(key).TValue, TT)
            Else
                Return Nothing
            End If
        End Function
    

    T is whatever key type you wish to use. Integer results in the smallest output and still allows the subscribing code to use an Enum. But it could be String.

    TT is the original type:

    myFoo = props.GetTItem(Of Long)(propsEnum.Foo)
    

    3) Expose the innerlist (dictionary) to PBN and bingo, all done.

    Its also very easy to add converters for Point, Rectangle, Font, Size, Color and even bitmap.

    HTH

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am looking for some guidance on implementing a password recovery service in ASP.NET
I’m looking for some guidance on structuring JS code in an .net MVC application.
Looking for some guidance on a WCF service I’m prototyping. I have a WCF
I'm looking for some guidance here. On my site I put things in Web
I'm looking for some guidance on how I can recreated a this feature. what
I'm looking for some guidance on how I can recreate this feature. As you
Hi guys looking for some guidance, i have a knowledge of xhtml, css, javascript,
I'm looking for some guidance on how to automat applying a set of permissions
I'm looking for some guidance on how to replace requests for a specific javascript
I'm looking for some technical guidance, perhaps a tutorial. I'm having to cater for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.