Skip to content
Permalink
Browse files

[XamlC] process symbols if DebugType is set (#925)

  • Loading branch information...
StephaneDelcroix authored and Jason Smith committed May 16, 2017
1 parent b9b97c4 commit f01cf880403f649cf6d6ccc71d930eae646bc698
@@ -74,6 +74,7 @@
Assembly = "$(IntermediateOutputPath)$(TargetFileName)"
ReferencePath = "@(ReferencePath)"
DebugSymbols = "$(DebugSymbols)"
DebugType = "$(DebugType)"
Verbosity = "4"
KeepXamlResources = "true"
OptimizeIL = "true" />
@@ -64,6 +64,7 @@
ReferencePath = "@(ReferencePath)"
Verbosity = "2"
OptimizeIL = "true"
DebugSymbols = "$(DebugSymbols)" />
DebugSymbols = "$(DebugSymbols)"
DebugType = "$(DebugType)"/>
</Target>
</Project>
@@ -43,9 +43,12 @@ public override bool Execute(out IList<Exception> thrownExceptions)
// resolver.AddAssembly (p);
}
}

var debug = DebugSymbols || (!string.IsNullOrEmpty(DebugType) && DebugType.ToLowerInvariant() != "none");

using (var assemblyDefinition = AssemblyDefinition.ReadAssembly(Assembly, new ReaderParameters {
ReadWrite = true,
ReadSymbols = DebugSymbols,
ReadSymbols = debug,
AssemblyResolver = resolver
})) {
foreach (var module in assemblyDefinition.Modules) {
@@ -147,7 +150,7 @@ public override bool Execute(out IList<Exception> thrownExceptions)
}
Logger.LogString(1, "Writing the assembly... ");
assemblyDefinition.Write(new WriterParameters {
WriteSymbols = DebugSymbols
WriteSymbols = debug
});
}
Logger.LogLine(1, "done.");
@@ -16,12 +16,8 @@ public class XamlCTask : XamlTask
public bool KeepXamlResources { get; set; }
public bool OptimizeIL { get; set; }

bool outputGeneratedILAsCode;
[Obsolete("OutputGeneratedILAsCode is obsolete as of version 2.3.4. This option is no longer available.")]
public bool OutputGeneratedILAsCode {
get { return outputGeneratedILAsCode; }
set { outputGeneratedILAsCode = value; }
}
public bool OutputGeneratedILAsCode { get; set; }

internal string Type { get; set; }
internal MethodDefinition InitCompForType { get; private set; }
@@ -38,6 +34,7 @@ public override bool Execute(out IList<Exception> thrownExceptions)
if (!string.IsNullOrEmpty(ReferencePath))
Logger.LogLine(1, "ReferencePath: \t{0}", ReferencePath.Replace("//", "/"));
Logger.LogLine(3, "DebugSymbols:\"{0}\"", DebugSymbols);
Logger.LogLine(3, "DebugType:\"{0}\"", DebugType);
var skipassembly = true; //change this to false to enable XamlC by default
bool success = true;

@@ -68,10 +65,12 @@ public override bool Execute(out IList<Exception> thrownExceptions)
}
}

var debug = DebugSymbols || (!string.IsNullOrEmpty(DebugType) && DebugType.ToLowerInvariant() != "none");

var readerParameters = new ReaderParameters {
AssemblyResolver = resolver,
ReadWrite = !ReadOnly,
ReadSymbols = DebugSymbols,
ReadSymbols = debug,
};

using (var assemblyDefinition = AssemblyDefinition.ReadAssembly(Path.GetFullPath(Assembly),readerParameters)) {
@@ -199,9 +198,10 @@ public override bool Execute(out IList<Exception> thrownExceptions)

Logger.LogLine(2, "");

if (outputGeneratedILAsCode)
#pragma warning disable 0618
if (OutputGeneratedILAsCode)
Logger.LogLine(2, " Decompiling option has been removed. Use a 3rd party decompiler to admire the beauty of the IL generated");

#pragma warning restore 0618
resourcesToPrune.Add(resource);
}
if (!KeepXamlResources) {
@@ -228,7 +228,7 @@ public override bool Execute(out IList<Exception> thrownExceptions)
Logger.LogString(1, "Writing the assembly... ");
try {
assemblyDefinition.Write(new WriterParameters {
WriteSymbols = DebugSymbols,
WriteSymbols = debug,
});
Logger.LogLine(1, "done.");
} catch (Exception e) {
@@ -24,6 +24,7 @@ public abstract class XamlTask : AppDomainIsolatedTask
public string ReferencePath { get; set; }
public int Verbosity { get; set; }
public bool DebugSymbols { get; set; }
public string DebugType { get; set; }

internal XamlTask()
{

0 comments on commit f01cf88

Please sign in to comment.
You can’t perform that action at this time.