diff --git a/Source/Engine/Engine/NativeInterop.cs b/Source/Engine/Engine/NativeInterop.cs index e9041f55f..2297140af 100644 --- a/Source/Engine/Engine/NativeInterop.cs +++ b/Source/Engine/Engine/NativeInterop.cs @@ -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 diff --git a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs index f0530ba49..1ddc390f4 100644 --- a/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs +++ b/Source/Tools/Flax.Build/Build/DotNet/Builder.DotNet.cs @@ -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"); diff --git a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs index 57717d16e..3038f7147 100644 --- a/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs +++ b/Source/Tools/Flax.Build/Projects/VisualStudio/CSSDKProjectGenerator.cs @@ -220,7 +220,7 @@ namespace Flax.Build.Projects.VisualStudio csProjectFileContent.AppendLine(string.Format(" ", configuration.Name)); csProjectFileContent.AppendLine(" true"); - csProjectFileContent.AppendLine(string.Format(" {0}", configuration.Configuration == TargetConfiguration.Release ? "portable" : "embedded")); + csProjectFileContent.AppendLine(" portable"); csProjectFileContent.AppendLine(string.Format(" {0}", configuration.Configuration == TargetConfiguration.Release ? "true" : "false")); csProjectFileContent.AppendLine(string.Format(" {0}\\", outputPath)); csProjectFileContent.AppendLine(string.Format(" {0}\\", intermediateOutputPath));