Roslyn has no reference to System.Runtime

By request of Dejan in the comment section, I’ll post the answer (to my problem) as a real answer. I’ve found out what the problem was! The compiler was correct all along. A blog post of smack0007 triggered me of trying something else. Instead of using the Facade dll, try referencing the necessary dll’s manually. … Read more

Delegate caching behavior changes in Roslyn

Yes. The most important part is that the method containing lambda implementation is now an instance method. You can see a delegate as a middleman receiving an instance call through Invoke and dispatching that call according to the calling convention of the implementing method. Note that there are platform ABI requirements that specify how arguments … Read more

Is there code generation API for TypeScript?

Try ts-morph. Only been working with it for about an hour but it seems really capable. import {Project, Scope, SourceFile} from “ts-morph”; const project = new Project(); const sourceFile = project.createSourceFile(`./target/file.ts`); const classDeclaration = sourceFile.addClass({ name: ‘SomeClass’ }); const constr = classDeclaration.addConstructor({}); constr.setBodyText(‘this.myProp = myProp’); classDeclaration.addProperty({ name: ‘myProp’, type: ‘string’, initializer: ‘hello world!’, scope: Scope.Public … Read more

Roslyn throws The language ‘C#’ is not supported

Most likely it’s because you don’t reference Microsoft.CodeAnalysis.CSharp.Workspaces in your code, i.e. you never use a type or method in this dll, so MSBuild thinks it’s not needed (see e.g. this question). So what you could do is e.g. add the following line somewhere in your class library project: var _ = typeof(Microsoft.CodeAnalysis.CSharp.Formatting.CSharpFormattingOptions); Then MSBuild … Read more

Why do we get possible dereference null reference warning, when null reference does not seem to be possible?

This is effectively a duplicate of the answer that @stuartd linked, so I’m not going to go into super deep details here. But the root of the matter is that this is neither a language bug nor a compiler bug, but it’s intended behavior exactly as implemented. We track the null state of a variable. … Read more

run single *.cs script from command line

I found another solution on Scott Hanselman’s blog: https://www.hanselman.com/blog/CAndNETCoreScriptingWithTheDotnetscriptGlobalTool.aspx It relies on a .NET CLI tool called dotnet-script, you can find its repository below: https://github.com/filipw/dotnet-script To use, it, first install it using dotnet tool install -g dotnet-script Then you can run dotnet script and use it as a REPL or run dotnet script file.csx to … Read more

Compiler Error Message: The compiler failed with error code -532462766

And the winner is ASP.NET Dynamic Compilation These lines in web.config where the cause. I only wish I knew how they got there. Was it a nu-get package or the VS2017 compilation? Remove these lines to resolve this error: <system.codedom> <compilers> <compiler language=”c#;cs;csharp” extension=”.cs” type=”Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″ warningLevel=”4″ compilerOptions=”/langversion:6 /nowarn:1659;1699;1701″ /> <compiler language=”vb;vbs;visualbasic;vbscript” … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)