dotnet / dotnet/dotnet-api-docs

CodeDom.Compiler.CodeDomProvider.CreateProvider("JScript") does not return JavaScript provider

Open
#8,796 5 comments 0 reactions 0 assignees View on GitHub
area-System.CodeDom documentation help wanted Pri3
Dominant language
C#
Stars
949
Forks
1.7k
Avg merge
3d 27m
Merged PRs (30d)
49

Description

Hi,
We are converting .Net4.8 tests to net6.0 and noticed following problem:
It is not possible to create javascript provider using:

System.CodeDom.Compiler.CodeDomProvider.CreateProvider("JScript");
Using "JS", "javascript", "jscript") does not work as well.

Error we get:
System.CodeDom.Compiler.CodeDomProvider+ConfigurationErrorsException
There is no CodeDom provider defined for the language.
at System.CodeDom.Compiler.CodeDomProvider.GetCompilerInfo(String language)
at System.CodeDom.Compiler.CodeDomProvider.CreateProvider(String language)

We can see that different version of System.CodeDom is used for Net48 and different for Net6:
![image](https://user-images.githubusercontent.com/22520055/212911306-69c5bdb1-bb31-4ee2-bf67-b41924b00090.png)

There is no problem for Net48 and we can see after decompiling library that there is a method:

this.AddCompilerInfo(new CompilerInfo(compilerParams3, codeDomProviderTypeName3)
{
_compilerLanguages = new string[3]
{
"js",
"jscript",
"javascript"
},

but this is absent for version 6.0.0 and 7.0.0:
https://github.com/dotnet/runtime/blob/main/src/libraries/System.CodeDom/src/System/CodeDom/Compiler/CodeDomProvider.cs

According to: https://learn.microsoft.com/pl-pl/dotnet/api/system.codedom.compiler.codedomprovider?view=dotnet-plat-ext-7.0
This should work:
provider = CodeDomProvider.CreateProvider("JScript");

but it does not.
Can you please add provider for JavaScript?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.