JS

Thursday, March 21, 2024

Error (ESLint) i.CLIEngine is not a constructor in Visual Studio 2019

To correct the ESLint error 'i.CLIEngine is not a constructor' in Visual Studio 2019 with ESLint version 8.57.0, you can follow these steps:


1. Navigate to the following file path and open the file in a text editor: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\ServiceHub\Services\TypeScriptLintingService\TypeScriptLintingService.all.js. It is recommended to create a backup of the original file before proceeding.


2. Locate the function e.prototype.eslint within the file and replace it with the following code:


e.prototype.eslint = function(e) {

return new Promise(async (resolve) => {

try {

var config = JSON.parse(e);

var ESLintModule = this.dynamicRequire(config.linterPath + n.sep + "node_modules" + n.sep + "eslint");

var results = [];


if (ESLintModule.ESLint) {

var options = {

cwd: config.projectRoot,

resolvePluginsRelativeTo: config.linterPath

};


var eslintInstance = new ESLintModule.ESLint(options);

results = await eslintInstance.lintText(config.fileContents, { filePath: config.fileName });

} else {

var optionsLegacy = {

cwd: config.projectRoot,

ignorePattern: ["wwwroot/lib/**", "**/node_modules/**", "**/bower_components/**", "**/jspm_packages/**"],

resolvePluginsRelativeTo: config.linterPath

};


if (config.parserPath) {

optionsLegacy.parser = config.parserPath;

}


results = new ESLintModule.CLIEngine(optionsLegacy).executeOnText(config.fileContents, config.fileName).results;

}


var report = results[0];

if (report) {

report.messages.forEach(this.addRuleIdToParseError);

var validMessages = report.messages.filter((message) => message.ruleId != null);

validMessages.forEach(this.addLocationInfoFromSourceCode);

resolve({ lintMessages: validMessages });

} else {

resolve({});

}

} catch (error) {

resolve({ errorMessage: error.message });

}

});

}


3. After making the changes, save the file and restart Visual Studio to apply the update.


Saturday, July 15, 2023

Power Automate Desktop error: The request content is not valid and could not be deserialized: 'Unexpected character encountered while parsing value: %. Path '', line 0, position 0.'

 When you use "Invoke web service" action with URL that has special character "%", you can escape this character with "%%". But when you run, this error happens.

I got this error and I tried many methods. Only one method helped me to solve this. I turned the option "Encode request body" to Off in the Advanced setting of "Invoke web service" action.








Sunday, September 12, 2021

Tips for setting lookup value of using Dynamics 365 Web API

 Working with Dynamics 365 CRM, when you set a value for lookup field, maybe you will get the error “Invalid property ‘your_field' was found in entity ‘the_entity’. ---> Microsoft.OData.ODataException: Does not support untyped value in non-open type” or error “An undeclared property ‘your_field' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values.”. This means you are not setting this field incorrectly.

The first situation is you are not using the field schema name.

The second situation is you are not setting it correctly. There are several situations with the lookup field to do this:

  • Non-activity entity/table, single lookup field (lookup to only one table)

entity[<your_schema_field_name>@odata.bind] = “/<entity_logical_name in plural>(<entity_id>)”

For example: A custom field new_account lookups to account table

entity[new_accountid@odatabind] = “/accounts(b2ce603e-5bb9-eb11-8236-0022481736ba)”

  • Activity entity/table, single lookup field

entity[<your_schema_field_name>_<ActivityName>@odata.bind] = “/<entity_logical_name in plural>(<entity_id>)”

For example:

entity[new_accountid_PhoneCall@odatabind] = “/accounts(b2ce603e-5bb9-eb11-8236-0022481736ba)”

entity[new_accountid_Task@odatabind] = “/accounts(b2ce603e-5bb9-eb11-8236-0022481736ba)" 

  • For regarding field

entity[<your_schema_field_name>_<entity_lookup_logical_name>@odata.bind] = “/<entity_logical_name in plural>(<entity_id>)”

For example:

entity[regardingobjectid_account@odatabind] = “/accounts(b2ce603e-5bb9-eb11-8236-0022481736ba)” 

Sunday, June 20, 2021

Error 0x80131500 when installing SQL Server Integration Service Project Extension in Visual Studio 2019

If you install SQL Server Integration Service Project extension in Visual Studio 2019 and get this error 0x80131500, you can check the log in folder  %TEMP%\SsdtisSetup. From the log detail of files in this folder, you can know more about the error detail.

Monday, June 14, 2021

Container with WSL

  • Install Docker with WSL
With WSL 2, we can setup Docket Desktop and enable WSL 2 based engine.

First you install WSL 2. Then you download Docker Desktop from https://www.docker.com/products/docker-desktop and install it. After that, you have to log out and log in again to run Docker Desktop. Then, right click on the Docker icon on the system tray and select Setting. Enable the option Use the WSL 2 based engine to configure Docker run under WSL 2 rather than a Virtual Machine.


 For the tab Resources, we can configure which Linux distro to access Docker from.

  • Setup Kubernetes
In the Docker Desktop settings, we can enable the Kubernetes option to setup the Kubernetes cluster.






Sunday, June 13, 2021

WSL Tips

  • Access Linux files from Windows
            After installing WSL and Linux distro, if you type \\WSL$ on the address bar of Windows Explorer, you can see all Linux distro that are installed on your machine. And from that, you can access to the file system of the Linux distro from Windows.

 

  • Access Windows files from Linux
            WSL automatically mount the Windows drive as /mnt. To access C drive, we can use /mnt/c
  • Export/Import a Distro
            If we work with multiple projects and each project need different set of tools, then we can clone the base distro by export and import with a new name.
            Export: wsl --export ...
            Import: wsl --import ...
  • Create a custom Distro from a docker container
    • Firstly, we pull a container from Docker hub 
    • Second step is to start the container with docker run  command.
    • Third step: we add user for WSL
                    useradd -m YOURUSERNAME
                    passwd YOURUSERNAME
    • Then we add /etc/wsl.conf file to let WSL know the user we created
                    echo -e "[user] \ndefault=YOURUSERNAME" > /etc/wsl.conf
    • If we want to add more configuration, we can add at this step.
    • After finish adding the configurations, we can export the Docker container to the Tar file using docker export command.
    • Then we use wsl --import  command to import the Tar file. And now we have a new Distro to run.
  • Create a custom Distro from a docker container using Docker file
            For the manual steps above, we can build a Docker file to create a custom Distro.

Error (ESLint) i.CLIEngine is not a constructor in Visual Studio 2019

To correct the ESLint error 'i.CLIEngine is not a constructor' in Visual Studio 2019 with ESLint version 8.57.0, you can follow thes...