there is a bug when our project contains an unmanaged dll.
Describe the bug there is a bug when our project contains an unmanaged dll. System.NullReferenceException:“Object reference not set to an instance of an object.” To Reproduce Steps to reproduce the behavior: project contains a unmanaged dll, such as https://github.com/bp74/Zstandard.Net Expected behavior A clear and concise description of what you expected to happen.
Information (please complete the following information):
- OS: [ e.g Ubuntu 16.04, Windows Server 2016, etc ] windows
- Platform [.NET Framework 4.x / .NET Core 2.x , etc] .NET Core 3.x
- RazorLight version [ e.g 2.0-beta9 ] 2.0-beta9
- Are you using the OFFICIAL RazorLight package? https://www.nuget.org/packages/razorlight
- Visual Studio version [ e.g Visual Studio Community 17.8.5 ]
Additional context Add any other context about the problem here.
Can you provide more of the stack trace?
@HamiltonManalo Does your fix for #352 address this?
@jzabroski It may allow a work around by excluding those particular assemblies. @564064202 Could you give an example package/dll you're running into issues with and I will see if I can test against that?
Thanks.
@HamiltonManalo Hi,so sorry ,I'm late. you can use .net core with MySql.Data(Contains libzstandard)
@564064202 I tried to recreate it by adding RazorLight and the Nuget package and compiling templates but wasn't able to recreate it. Could you provide more details on where/how the error occurs and a stack trace? Does it look anything like the stack trace here #352?
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=RazorLight
StackTrace:
at RazorLight.Compilation.RoslynCompilationService.CompileAndEmit(IGeneratedRazorTemplate razorTemplate)
at RazorLight.Compilation.RazorTemplateCompiler.CompileAndEmit(RazorLightProjectItem projectItem)
at RazorLight.Compilation.RazorTemplateCompiler.OnCacheMissAsync(String templateKey)
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at RazorLight.EngineHandler.<CompileTemplateAsync>d__15.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
at RazorLight.EngineHandler.1.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter1.GetResult()
at Common.WebApi.ApiDefaultController.
It may allow a work around by excluding those particular assemblies-->NOT WORK
@HamiltonManalo HI?HOW TO RESOLVE IT
@jzabroski sir ,how to resove it
@564064202 I'm not sure yet. I am releasing 2.0.0-beta10 now, so hopefully that helps you out. You would have to do the guidance in #352 as part of trying it out.
@564064202 I just pushed beta10 up now - it should show up in your feed within the next hour. The underlying theory as to why #352 would help you is it would allow you to exclude arbitrary assemblies from the compilation context. It should work if the issue is identical to #352 where the windows metadata dll is also unmanaged.
@564064202 Unfortunately I wasn't able to recreate the bug by adding MySQL.Data. Could you reproduce the bug in a simple project and provide a repo for it? If you can I will look into it further.
I see, you can use ZStandardNet
when project contains an unmanaged dll
Are you referring to this package https://github.com/bp74/Zstandard.Net
yes ,we pack mysql.data( own),and mysql.data refer it (contains libzstd.dll)
@jzabroski Have you fixed it?
@564064202 I will try to look at this issue this week.
@HamiltonManalo Do you have your code around still from your failed repro attempt? That would help jump start my investigation, thank you.
@codeneno Silly question, but just so we're comparing apples to apples, what version of https://github.com/bp74/Zstandard.Net are you reproducing your problem with? Which TargetFramework?
@564064202 Same - what version of Mysql.Data? I think they're removing some unmanaged dependencies, although I don't know how much remains unmanaged. Your csproj has <TargetFramework>.netcoreapp3.1</TargetFramework> and PackageReferences to Mysql.Data and RazorLight directly?
My csproj has
MySQL.data verison 8.0.21