Comments (10)
Hello!
It is impossible to determine the causes of this error without seeing source code of the MSBuild task.
… and there's an error in the SCSS.
Try to catch and handle the SassCompilerLoadException
and SassСompilationException
exceptions.
from libsasshost.
This is the build task's code:
CompilationOptions options = SCSSBuilder.BuildDefaultOptions(Configuration, new string[] { includePath });
CompilationResult compilationResult;
try
{
logger.Error("IM ABOUT TO COMPILE THIS SHIT: " + originalPath);
logger.Error("DATA IS");
logger.Error(data);
logger.Error("LETS GOOOOO 4");
compilationResult = SassCompiler.CompileFile(originalPath, null, null, options);
logger.Error("DO YOU SEE THIS MESSAGE?");
foreach(string includedFile in compilationResult.IncludedFilePaths)
{
string relativePath = PathExt.GetRelativePath(Environment.CurrentDirectory, includedFile).Replace('\\', '/');
LoadAndDesginateAsset(relativePath);
}
}
catch(SassСompilationException ex)
{
logger.Error("Failed to compile 1 " + originalPath + ":");
logger.Error("Failed to compile 2 " + originalPath + ":" + ex.Message);
logger.Error("Failed to compile 3 " + originalPath + ":" + ex.Message, ex.File);
logger.Error("Failed to compile 4 " + originalPath + ":" + ex.Message, ex.File, ex.LineNumber);
logger.Error("Failed to compile 5 " + originalPath + ":" + ex.Message, ex.File, ex.LineNumber, ex.ColumnNumber);
return false;
}
catch(Exception ex)
{
logger.Error("Failed to compile " + originalPath + ":" + ex.Message);
return false;
}
finally
{
logger.Error("test");
}
using LibSassHost;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace HTMLExtensions.Shared.Builders
{
public class SCSSBuilder
{
public static CompilationOptions BuildDefaultOptions(string buildConfiguration, string[] includePaths = null)
{
CompilationOptions options = new CompilationOptions();
if(buildConfiguration == "Debug")
{
//options.SourceMap = true;
//options.SourceMapIncludeContents = true;
//options.SourceComments = true;
options.OutputStyle = OutputStyle.Expanded;
}
else
{
options.OutputStyle = OutputStyle.Compressed;
}
//if(OsUtils.IsWin())
//{
// options.LineFeedType = LineFeedType.CrLf;
//}
//else if(OsUtils.IsMacOsX())
//{
// options.LineFeedType = LineFeedType.Cr;
//}
//else
//{
// options.LineFeedType = LineFeedType.Lf;
//}
if(includePaths != null)
{
foreach(string path in includePaths)
{
options.IncludePaths.Add(path);
}
}
return options;
}
}
}
The output from the build task is:
1>MSBUILD : error :
1>MSBUILD : error : LETS GOOOOO 4
1>MSBUILD : error MSB4166: Child node "2" exited prematurely. Shutting down. Diagnostic information may be found in files in "C:\Users\tried\AppData\Local\Temp\" and will be named MSBuild_*.failure.txt. This location can be changed by setting the MSBUILDDEBUGPATH environment variable to a different directory.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
As you can see the exception is not caught and "DO YOU SEE THIS MESSAGE?" doesn't appear in the output log, which leads me to the conclusion that the whole build task process is simply killed due to child process created by SassCompile.CompileFile()
dying after an error or something.
from libsasshost.
Try to implement this logic as a console application and compile an incorrect SCSS file by using it.
Maybe it makes sense for you to install the Web Compiler instead of writing your own MSBuild task?
from libsasshost.
@Taritsyn That's what I am doing right now. Web Compiler is nice, but doesn't cut it for what we are doing. Our custom MSBuild task does a ton of other things as well and it handles importing/exporting .scss files into .dlls as well and so on. I'm 90% positive having a separate console application will workaround the issue for us, but you might want to look into mitigating it somehow either way as other may run into it too. Would be glad to help somehow if possible?
from libsasshost.
How do you deploy native assemblies?
Give an example of invalid SCSS file.
from libsasshost.
.form-item{
width: calc(100% - 40px);
border-radius:0px;
@include border-right-radius(4px);
border-left:none;
color: #484848;
&:focus {
border-left:none;
}
}
"border-right-radius" is undeclared.
Funny thing is, sometimes I see the actual error. Sometimes I get the "Child node prematurely" message. So it's not a matter of whether you're properly discovering the error or not.
from libsasshost.
In a console application I get the following error:
During compilation of SCSS file an error occurred. See details:
Message: Error: no mixin named border-right-radius
on line 4 of ../../../../style.scss
>> @include border-right-radius(4px);
---------------^
Error code: 1
Description: no mixin named border-right-radius
File: C:/temp/style.scss
Line number: 4
Column number: 16
from libsasshost.
Yep, that's the error I get sometimes. That would be the expected behaviour. However a lot of times there is no error, just "Child node '2' exited prematurely".
from libsasshost.
This error is unstable and may be not directly related to the LibSass Host. This error message is quite common: Stack Overflow, MSDN, TechNet and Visual Studio tooling for ASP.NET.
from libsasshost.
Try to set a .NET file manager during MSBuild task initialization:
SassCompiler.FileManager = FileManager.Instance;
This variant has less performance, but may solve your problem.
from libsasshost.
Related Issues (20)
- request: non-static file manager HOT 6
- Unable to load DLL 'libsass' on Windows Server 2008 R2 HOT 2
- How to @import partials HOT 1
- SassСompilationException contains cyrillic character HOT 4
- [BUG] Upgrade to v1.3.1 adds `/c/` to paths HOT 7
- Combining a string of sass with an scss file HOT 5
- `@use` rule doesn't compile HOT 6
- application o virtual directory HOT 2
- On azure webapp getting "An attempt was made to load a program with an incorrect format" HOT 2
- Error: File to import not found or unreadable HOT 23
- LibSassBuilder HOT 2
- Support for Memory<char> as parameter and result CSS
- Sass Modules Support HOT 8
- .NET 6 on Apple Silicon HOT 7
- How to utilize with Blazor? HOT 2
- Updating System.Buffers in .Net Framework project breaks dll-mapping to libsasshost version HOT 2
- Calling from Powershell, cannot load dependent assemblies HOT 4
- Variables are not compiled when scss is compiled HOT 3
- The type initializer for 'LibSassHost.SassCompiler' threw an exception HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libsasshost.