When you obfuscate strings then any error messages etc generating a
trace message will obviously display obfuscated data.
You need to de-obfuscate the message by using the mapping file that is
generated when you obfuscated the assembly. I wrote my own program to do
this and I think there is an example in the documentation somewhere.
Here's my cs project file that should help you on the way:
sing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Eziriz;
using System.IO;
using DevExpress.XtraEditors;
namespace DeObfuscate
{
public partial class MainForm : DevExpress.XtraEditors.XtraForm
{
string nrmapFile = "";
public MainForm()
{
InitializeComponent();
}
/*** Deobfuscate an obfuscated text/stack strace ***/
public string deObfuscateText(string obfuscated_text, string
mapping_filename)
{
StackTraceDeobfuscator STD = new
StackTraceDeobfuscator(mapping_filename);
return STD.DeobfuscateText(obfuscated_text);
}
private void simpleButtonGo_Click(object sender, EventArgs e)
{
if (String.IsNullOrEmpty(nrmapFile))
{
XtraMessageBox.Show("Select the nrmap file first");
return;
}
this.memoEditOutPut.EditValue = "";
this.memoEditOutPut.EditValue =
deObfuscateText(this.memoEditInPut.EditValue.ToString(), nrmapFile);
}
private void buttonEdit1_ButtonClick(object sender,
DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
if (!String.IsNullOrEmpty(this.buttonEdit1.Text))
{
ofd.InitialDirectory =
Path.GetFullPath(buttonEdit1.Text.ToString());
}
else
{
ofd.InitialDirectory = @"D:\DeObfuscate";
}
ofd.Filter = "nrmap files (*.nrmap)|*.nrmap|All files (*.*)|*.*";
ofd.Title = "Select a nrmap file";
if (ofd.ShowDialog() == DialogResult.OK)
{
buttonEdit1.EditValue = ofd.FileName;
nrmapFile = ofd.FileName;
//path = System.IO.Path.GetDirectoryName(ofd.FileName.FileName);
}
}
private void btnClearText_Click(object sender, EventArgs e)
{
this.memoEditInPut.Text = string.Empty;
I think it may be a coding issue as obfuscating will obfuscate your
code, not variables. Your description of your code indicates that you
read one file into a variable, another file into a variable and then
compare parts of the two variables. Whether they are xml files or not
doesn't matter. If however you have defined some strings as constants
and are comparing variables with those constants then it is possible
those constants you have defined have been obfuscated as you have
written them into your code. In your case the '=' sign may be just part
of an obfuscated string but it is being interpreted as a instruction by
the CLR.
I suppose you have enabled every obfuscation option there is. Without
examining the code segment causing you grief and not knowing what .Net
Reactor settings you have enabled it is not possible to be more helpful.
There is an option that I have never used myself and that is the ability
to exclude an item from obfuscation. You need to decorate your code with
a flag - do a google search for general instructions on how to do this.
What I showed you in my previous post was the code I use to read a log
file containing obfuscated strings and replace the obfuscated text with
the original. It has nothing to do with the problem you are now describing.
Glen.