Error CS0234 in VS 2015 with build+intelliSense selected - razor

When I open my mvc project (mvc5) with razor helper file in app_code folder, the compile was successful but in error list I have the error below:
Severity Code Description Project File Line Suppression State
Error CS0234 The type or namespace name 'global_asax' does not exist in the namespace 'ASP' (are you missing an assembly reference?)
The error only appear when the option "Build + IntelliSense" was selected, if I select "Build Only" the error won't show.
Can someone explain why this error occurs and how to eliminate this error? is this a bug in VS2015 since this issue does not occur in vs2013? should I be concerned with this error?
bty the error points to the code below
public RazorHelper() {
}
protected static ASP.global_asax ApplicationInstance {
get {
return ((ASP.global_asax)(Context.ApplicationInstance));
}
}

Related

services.AddDatabaseDeveloperPageExceptionFilter(); error code: CS1061

i'm coding like below
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<SchoolContext>(options =>
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));
services.AddDatabaseDeveloperPageExceptionFilter();
services.AddControllersWithViews();
}
but i got a error message
Error CS1061 'IServiceCollection' does not contain a definition for 'AddDatabaseDeveloperPageExceptionFilter'
and no accessible extension method 'AddDatabaseDeveloperPageExceptionFilter' accepting a first argument of type
'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)
AspCore_DB C:\Startup.cs 30 Active
this code is officially introduced in the MS guide and i just followed. i'm working on MS Visual studio 2019 v16.8.2
After doing some research I found that this is in the Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore library.

TagHelpers not working when assembly is dynamically loaded in ASP.NET core 2.1

I'm using ASP.NET core 2.1. I load all the assemblies that have the Views dynamically from a plugins folder. I use the following code for that. The Views get loaded correctly.
services.AddMvc().
AddRazorPagesOptions(o => o.AllowAreas = true).
SetCompatibilityVersion(CompatibilityVersion.Version_2_1).
ConfigureApplicationPartManager(ConfigureApplicationParts);
private void ConfigureApplicationParts(ApplicationPartManager apm)
{
var pluginsPath = Path.Combine(_env.WebRootPath, "Plugins");
var assemblyFiles = Directory.GetFiles(pluginsPath, "*.dll", SearchOption.AllDirectories);
foreach (var assemblyFile in assemblyFiles)
{
var assembly = Assembly.LoadFile(assemblyFile);
if (assemblyFile.EndsWith(".Views.dll"))
{
apm.ApplicationParts.Add(new CompiledRazorAssemblyPart(assembly));
}
else
{
apm.ApplicationParts.Add(new AssemblyPart(assembly));
}
}
}
The views have some custom taghelpers.
The _ViewImports.cshtml file looks like
#addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
#addTagHelper *, MyTagHelpers
The problem is that the custom tag helpers don't get loaded and gives an error:
Error: Could not load file or assembly MyTagHelpers
The reason I get the error may be the Razor View Engine may be looking for the DLL in the bin folder of the main app and it can't find the DLL and gives this error.
What should I do in the startup to say the taghelpers are available in a DLL and can be loaded from there? Should I use TagHelperFeatureProvider to do it?
UPDATE: I moved the tag helpers to a separate DLL called MyTagHelpers.Common and dropped in the plugins folder. I'm not getting any assembly not found error anymore, but the tag helpers are not working.
After 2 days trying to resolve this - please note - the 'assembly name' is the compiled (assembled?) .DLL name which would normally match the project name which may not match the namespace name/prefix!
So if your project name is not the same as the namespace as mine was, then the #addTagHelper reference is the project name which is being used to create the compiled .DLL - see your build output to check.
And therefore, this is also usually the same as the prefix for your .csproj file which is why the official documentation says to create a new app.

How to remove error created using cocos2d-x v2.2.3 (Language cpp) for windows phone?

I'm trying to run my Game created using cocos2d-x-v2.2.3 (language cpp) for windows phone. But it shows following error.
error C2440: 'type cast' : cannot convert from 'void (__cdecl StartScene::* )(void)' to 'cocos2d::extension::SEL_CCControlHandler'
If I include pch.h file in all class file above error is removed then new error created. The error is
"Cannot open include file: 'pch.h': No such file or directory"
Though pch.h and pch.cpp are presented in CocosDenshion. In this circumstances what should i do?
Thanks in Advance
i think this because you use wrong function, fowllow this (CCObject::SEL_CCControlHandler)(CCObject, CCControlEvent) so the func you use must have func(CCObject*, CCControlEvent),

Dart confusing TYPE error

I am building a web application using dart with web_ui.
Everything was working fine until i added the web_ui pub, and now, when I am trying to run a build.dart file I get an error:
Uncaught Error: type 'AttributeName' is not a subtype of type 'String' of 'name'.
What does this mean?
From what I understand, this means there is somewhere an instance named 'name' of class 'AttributeName' that is extending 'String' class.
I searched my entire project and there is nowhere a class named 'AttributeName', nowhere an instance of 'name'.
I have the latest Dart editor and SDK:
Dart Editor version 0.4.7_r21658
Dart SDK version 0.4.7.5_r21658
EDIT:
this is my build.dart file:
import 'package:web_ui/component_build.dart';
import 'dart:io';
void main() {
build(new Options().arguments, ['web/menyplattan.html']);
}
Also, i updated all the pubs
This message looks like web_ui is failing a type check.
The similar SO question MarioP links to has a stacktrace showing this message coming from within the web ui library itself.
Do you have an xmlns attribute in your html?
Have a look at this web-ui issue.
AttributeName is defined within the html5lib library. Perhaps web-ui is expecting a newer version of this library but getting an older one. Make sure you've done a pub install. You can also try deleting your packages folder and doing a fresh pub install.
This could be caused by out-of-date packages, but it could also be a bug in web-ui. See if you can get a stacktrace and file a bug report, or post it on the web-ui mailing list.

method in Report Builder custom assembly not found

I'm trying to use a custom assembly in Report Builder 2.0. I have added the assembly to the report via Report Properties > References. When I try to call a public static method in the assembly, I get this message:
'ExtractTag' is not a member of 'ReportsClassLibrary.ReportsClassLibraryTools'.
The expression I'm trying to use to call the method is:
=ReportsClassLibrary.ReportsClassLibraryTools.ExtractTag("ID", "ID:incorrect", false)
And the method signature in the assembly is:
public static string ExtractTag(string tagToFind, string tags, bool caseSensitive)
That method is within the ReportsClassLibrary namespace and in the ReportsClassLibraryTools class.
I don't know if for some reason my report is looking an older version of the assembly that did not have this method, or if the problem is something else. I've tried removing the assembly from the report, rebuilding the assembly, and re-adding it to the report.
Edit: looks like a deeper problem. My assembly compiles, but when running a test case that calls that method, the test fails with a System.MissingMethodException. Guess I'm having an assembly problem, not a Report Builder problem...
Turned out it was a problem with the Global Assembly Cache in Vista. The old version of my assembly was cached, so the new method ExtractTag wasn't part of the assembly. I had to run:
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\gacutil.exe" /i bin\Debug\ReportsClassLibrary.dll