Use manual pdb file loading for debug symbols in C#
This commit is contained in:
@@ -2463,7 +2463,19 @@ namespace FlaxEngine
|
||||
Marshal.Copy(data, raw, 0, len);
|
||||
|
||||
using MemoryStream stream = new MemoryStream(raw);
|
||||
Assembly assembly = scriptingAssemblyLoadContext.LoadFromStream(stream);
|
||||
#if !BUILD_RELEASE
|
||||
var pdbPath = Path.ChangeExtension(assemblyPath, "pdb");
|
||||
Assembly assembly;
|
||||
if (File.Exists(pdbPath))
|
||||
{
|
||||
using FileStream pdbStream = new FileStream(Path.ChangeExtension(assemblyPath, "pdb"), FileMode.Open);
|
||||
assembly = scriptingAssemblyLoadContext.LoadFromStream(stream, pdbStream);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
assembly = scriptingAssemblyLoadContext.LoadFromStream(stream);
|
||||
}
|
||||
NativeLibrary.SetDllImportResolver(assembly, NativeLibraryImportResolver);
|
||||
|
||||
// Assemblies loaded via streams have no Location: https://github.com/dotnet/runtime/issues/12822
|
||||
|
||||
@@ -225,6 +225,7 @@ namespace Flax.Build
|
||||
args.Add("/target:library");
|
||||
args.Add("/platform:AnyCPU");
|
||||
args.Add("/debug+");
|
||||
args.Add("/debug:portable");
|
||||
args.Add("/errorreport:prompt");
|
||||
args.Add("/preferreduilang:en-US");
|
||||
args.Add("/highentropyva+");
|
||||
@@ -239,13 +240,8 @@ namespace Flax.Build
|
||||
#if USE_NETCORE
|
||||
args.Add("/langversion:11.0");
|
||||
args.Add("-nowarn:8632"); // Nullable
|
||||
if (buildData.Configuration == TargetConfiguration.Release)
|
||||
args.Add("/debug:portable");
|
||||
else
|
||||
args.Add("/debug:embedded"); // Embed pdb information into dll for proper stack trace information on C# exception in game code
|
||||
#else
|
||||
args.Add("/langversion:7.3");
|
||||
args.Add("/debug:portable");
|
||||
#endif
|
||||
if (buildOptions.ScriptingAPI.IgnoreMissingDocumentationWarnings)
|
||||
args.Add("-nowarn:1591");
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace Flax.Build.Projects.VisualStudio
|
||||
|
||||
csProjectFileContent.AppendLine(string.Format(" <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == '{0}' \">", configuration.Name));
|
||||
csProjectFileContent.AppendLine(" <DebugSymbols>true</DebugSymbols>");
|
||||
csProjectFileContent.AppendLine(string.Format(" <DebugType>{0}</DebugType>", configuration.Configuration == TargetConfiguration.Release ? "portable" : "embedded"));
|
||||
csProjectFileContent.AppendLine(" <DebugType>portable</DebugType>");
|
||||
csProjectFileContent.AppendLine(string.Format(" <Optimize>{0}</Optimize>", configuration.Configuration == TargetConfiguration.Release ? "true" : "false"));
|
||||
csProjectFileContent.AppendLine(string.Format(" <OutputPath>{0}\\</OutputPath>", outputPath));
|
||||
csProjectFileContent.AppendLine(string.Format(" <BaseIntermediateOutputPath>{0}\\</BaseIntermediateOutputPath>", intermediateOutputPath));
|
||||
|
||||
Reference in New Issue
Block a user