Exemplo n.º 1
0
 public EmitContext(AssemblyModule module, ITypeSymbol emitType)
     : base(module.CompileContext)
 {
     Module   = module;
     EmitType = GetTypeSymbol(emitType);
     _valueTableStack.Push(module.RootTable);
     RootTable = module.RootTable;
     DebugInfo = new AssemblyDebugInfo();
 }
        /// <summary>
        /// Record assembly short name, and it's associated PDB file.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="assembly"></param>
        /// <param name="ctx"></param>
        private static void AppendAssemblyName(StringBuilder builder, Assembly assembly, ExceptionReportingContext ctx)
        {
            var assemblyName    = assembly.FullName;
            int idxShortNameEnd = assemblyName.IndexOf(",");

            if (idxShortNameEnd > 0)
            {
                assemblyName = assemblyName.Substring(0, idxShortNameEnd);
            }

            // Make sure if two assemblies have the same short name, that we differentiate
            // them using a counter (e.g. "Assembly#2")

            AssemblyReportInfo info;
            var originalAssemblyName = assemblyName;
            var counter = 1;

            while (ctx.AssemblyInfo.TryGetValue(assemblyName, out info))
            {
                if (Object.ReferenceEquals(info.Assembly, assembly))
                {
                    break;
                }
                assemblyName = string.Format(CultureInfo.InvariantCulture, "{0}#{1}", originalAssemblyName, ++counter);
            }

            builder.Append(assemblyName);

            // Read information about associated PDB file from assembly

            if (info == null)
            {
                ctx.AssemblyInfo.Add(assemblyName, info = new AssemblyReportInfo()
                {
                    Assembly = assembly, ShortName = originalAssemblyName
                });
#if !SILVERLIGHT
                info.DebugInfo = AssemblyDebugInfo.ReadAssemblyDebugInfo(assembly);
#endif
            }
        }
Exemplo n.º 3
0
    void Start()
    {
        var info = new AssemblyDebugInfo("UnityEngine.dll");

        File.WriteAllText("result.json", JsonUtility.ToJson(info, true));
    }