Giter VIP home page Giter VIP logo

Comments (10)

Taritsyn avatar Taritsyn commented on June 19, 2024

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.

vladimir-angelov-1337 avatar vladimir-angelov-1337 commented on June 19, 2024

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.

Taritsyn avatar Taritsyn commented on June 19, 2024

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.

vladimir-angelov-1337 avatar vladimir-angelov-1337 commented on June 19, 2024

@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.

Taritsyn avatar Taritsyn commented on June 19, 2024

How do you deploy native assemblies?

Give an example of invalid SCSS file.

from libsasshost.

vladimir-angelov-1337 avatar vladimir-angelov-1337 commented on June 19, 2024
.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.

Taritsyn avatar Taritsyn commented on June 19, 2024

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.

vladimir-angelov-1337 avatar vladimir-angelov-1337 commented on June 19, 2024

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.

Taritsyn avatar Taritsyn commented on June 19, 2024

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.

Taritsyn avatar Taritsyn commented on June 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.