-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Hi!
I'm using libsass-net to compile a top level SCSS file which imports about 20 ancestor files (code attached). I'm seeing intermittent NullReferenceExceptions maybe once every 5-10 compilations and the point of failure varies (i.e. the import after which it dies). Here's the stack trace:
System.NullReferenceException: Object reference not set to an instance of an object.
at LibSass.Compiler.SassExterns64.sass_compile_data_context(SassSafeDataContextHandle data_context)
at LibSass.Compiler.Context.SassSafeDataContextHandle.CompileInternalContext()
at LibSass.Compiler.Context.SassSafeContextHandle.CompileContext()
Given this, I assume it's something going wrong inside libsass itself. I can reliably reproduce this by periodically making requests to our endpoint which compiles that top level file. I would guess that it's unrelated to concurrency as I'm waiting a few seconds in between. However, it's quite possible that libsass is being dodgy and sharing some state between compilations.
I attempted to debug it and track it down by building libsass 3.3.6 from source with logging statements attached. Didn't have much luck though. This is possibly the same issue as #60.
I haven't lodged a bug report with libsass as I'm unsure whether it's still a bug in their latest version. How much effort do you think would be required to bring libsass-net up to date so that it works with 3.5.4? I might end up giving it a shot.
var compilerOptions = new SassOptions
{
Data = topLevelScss,
EmbedSourceMap = true,
OutputStyle = SassOutputStyle.Expanded,
Importers = new[] { BuildImportResolver(scssResources) },
};var sassCompiler = new SassCompiler(compilerOptions);
var compilationResult = sassCompiler.Compile();