In the web.config, there is the declare of the Elmah section.
<section name="security" requirePermission="false" type="Elmah.SecuritySectionHandler, Elmah"/>
This means that the class of Elmah.SecuritySectionHandler will handle the section information.
But I opened the Elmah.dll and tried to find this class. I can't find this class in the assembly. Why?
Probably because it is marked as internal. See the source code from the Elmah repository for SecuritySectionHandler.cs.
Related
I have two files in a Unity3d project. One is a test script that runs in edit mode. The other is a single class with static functions that I'd like to call from the test scripts.
here's my test script:
using UnityEngine;
using UnityEngine.TestTools;
using NUnit.Framework;
using System.Collections;
public class NewTestScript
{
[Test]
public void TestAnotherStaticFunction()
{
int a = NewBehaviourScript.FunctionUnderTest(1);
int b = 1;
// Use the Assert class to test conditions.
Assert.IsTrue(a == b);
}
}
here's my function under test:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NewBehaviourScript : MonoBehaviour
{
/// <summary>
/// the stupidest function in the world,
/// used to verify tests.
/// </summary>
public static int FunctionUnderTest(int a)
{
return a;
}
}
This gives me the error from the Unity compiler (I'm not building outside of Unity):
Assets/TestS/NewTestScript.cs(12,17): error CS0103: The name `NewBehaviourScript' does not exist in the current context
These are running in edit-mode.
I've tried adding and removing the SuperTestNameSpace namespace from the function under test and the calling code.
I've attempted adding/removing files from the .asmdef file that was autogenerated by unity, although this usually leads to other compile errors.
My previous unit test experience is largely in Visual Studio or VSCode, and I'm trying to get my unity3d test experience to match my prior test environment experiences.
Is there a fundamentally limited functionality in the edit-mode tests, or am I missing something stupid?
Further elaboration on the assemblies involved. It looks like there are two assemblies at play here: Assembly-CSharp.dll contains my code under test and TestS.dll contains my testing code. I believe my questions boils down to: how do I add a reference from the TestS.dll assembly to the Assembly-CSharp.dll. I'd know how to do this in Visual Studio (either via the context menu in VS or directly editing the csproj file), however I don't see how to do it in Unity3d. Any edit I make to the csproj file is frequently overwritten by unity, and while there is a 'references' section in the inspector (see picture) I can't add Assembly-CSharp.dll as a reference.
These are the inspector settings for TestS.asmdef. While there's an option to add references, I can't add a reference to Assembly-CSharp.dll, which is where my code-under-test lives.
Ok, I figured this out. There were two things going on:
Editor tests need to be underneath a folder called editor. It's really annoying that the unity editor doesn't do this for you.
You need to have an assembly definition for the code under test and add a reference from the test code to the newly created assembly definition. This must be done in the Unity editor UI.
by default, unity adds your script code to an assembly called Assembly-CSharp.dll, and, for reasons unknown, this assembly isn't referenced by my edit mode test code. I'm not sure if this is a bug in Unity or if it's by design, but explicitly creating and referencing the assembly definition has cleared things up.
The main issue is currently you are trying to call the
NewBehaviourScript(1);
constructor which does not exist...
instead of the method
using SuperTestNameSpace;
//...
NewBehaviourScript.FunctionUnderTest(1);
or alternatively with the namespace in the call directly
SuperTestNameSpace.NewBehaviourScript.FunctionUnderTest(1);
Also make sure the filename matches exactly the class name. So in your case it should be
NewBehaviourScript.cs
Note that the .cs is not printed by Unity in the Project view so there it should say NewBehaviourScript.
Why does it not compile with the using SuperTestNameSpace;? What is the error?
If that exception
Assets/TestS/NewTestScript.cs(14,17): error CS0103: The name `NewBehaviourScript' does not exist in the current context
is only shown in VisualStudio but the script compiling fine in Unity especially after adding a new script it helps to simply close and restart VS.
In some cases it also helps to close Unity and VS, remove all files and folders except Assets and ProjectSettings (and if you are under version control anything that belongs to it like e.g. .git, .gitignore, .gitattributes etc) in particular delete the Library, .vs folder and all .csproj and .sln files.
Than open Unity again and let it recompile everything.
Make sure the file that contains your NewBehaviourScript class IS NOT inside an Editor folder.
Move both the scripts in the Assets (root) folder and try again.
I am inundated by the code analysis warning AD0001:
Analyzer
'RefactoringEssentials.CSharp.Diagnostics.FunctionNeverReturnsAnalyzer'
threw an exception of type 'System.NotSupportedException' with message
'Specified method is not supported.'
Of course I tried opening project properties (for each of a dozen projects in the solution), going into Code Analysis tab, clicking Open, typing in AD0001, and un-checking the pesky warning. But it is still being thrown in the hundreds.
How can I do it in for good?
Not sure if this is relevant, but I am also getting just 1 instance of
'RefactoringEssentials.CSharp.Diagnostics.RedundantBaseQualifierAnalyzer'
threw an exception of type 'System.TypeLoadException' with message
'Could not load type
'Microsoft.CodeAnalysis.Shared.Utilities.AbstractSpeculationAnalyzer`9'
from assembly 'Microsoft.CodeAnalysis.Workspaces, Version=2.3.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35'.'.
Argh! Restarting VS is the solution. 456!
I created a DiagnosticAnalyzer + CodeFixProvider that checks all public properties/methods of a class if they have virtual modifier (because of NHibernate proxies). But this should only be done on classes that implements some interface. For now I hardcoded those interfaces into analyzer code. What is the best option to make them configurable via configuration file included in project? Example configuration file:
<VirtualAnalzyer>
<ValidTypes>
<ValidType>IEntity</ValidType>
<ValidType>IVersionedEntity</ValidType>
</ValidTypes>
<VirtualAnalzyer>
I solved it by using additional files. Read this answer on how to include AdditionalFile in csproj.
I am trying to draw an interaction diagram with Doxygen, using the external Mscgen utility.
This is the source file:
/// test.h
/** Interaction diagram.
* Test.
* \msc "Test interaction diagram"
* A,B,C;
* B->C;
* A<-B;
* \endmsc
*/
class A {};
class B {};
class C {};
I installed the mscgen.exe executable, and I set its path in the environment variable.
When running Doxygen, from its log this is all I get in relation to interaction diagrams: "Searching for msc files...".
The final Doxygen output contains a place holder for a missing interaction diagram, and the "Test interaction diagram" label.
I must be missing something in the Doxyfile file. How can I make Doxygen call the mscgen.exe executable?
Looking at the PNG files generated, the one Doxygen is looking for is missing, so I suppose mscgen.exe has not run at all.
This is the Doxygen generated HTML code block:
<div align="center">
<img src="../../msc_inline_mscgraph_1.png" alt="msc_inline_mscgraph_1" border="0" usemap="#msc_inline_mscgraph_1.map">
<map name="msc_inline_mscgraph_1.map" id="msc_inline_mscgraph_1.map"></map>
<div class="caption">
Test interaction diagram</div>
</div>
Try removing the caption. I have the same problem on Windows. I do not have other platforms handy to compare results and see if it is a Windows-only problem. When I do:
#msc "hello, world"
a, b;
a => b;
#endmsc
The figure does not generate. If I remove the caption, like this:
#msc
a, b;
a => b;
#endmsc
The figure generates, but there is no caption. When the caption is present, I see the error:
error: failed to open map file path-on-my-local-computer-redacted/docs/html/inline_mscgraph_2.msc.map for inclusion in the docs!
The interesting part is that the file is not generated when there is no caption either -- the difference is that Doxygen does not seem to care that the map file does not exist. I do not seen an obvious option that controls map file generation.
Sorry, for just a partial answer several months after the original question. I got here Google searching for an answer the same question and hope this will at least let others get sequence charts without captions.
I had the exact same problem and found that a syntax error in the msc-part was the reason. Once I got it error-free, it all build well.
It take me a while to identify the problem. A search took me to a guy's thread "Problem with msc graph" who had the same problem and the solution:
[...]
If there is a syntax error in an msc tag then At the end of the
generation run I get the following error message:
error: failed to open map file [...]
NOTE: I have completely rewritten this question to take into account new information. Please reread if you've already been through this one.
I'm getting errors when using a cfthread from within a custom tag in ColdFusion 10. In the Application log, I get the following entries:
Variable _cffunccfthread_cfThreadTag2ecfm16902001291 is undefined.
The name of the function it's returning as an error is _cffunccfthread_cf[Page Name Calling the CFThreadTag] then a number that doesn't change from request to request. I can duplicate this every time with the following code:
Application.cfc:
component
{
this.name = "CFThreadCustomTagTest";
}
ThePage.cfm:
<cfthread action="run" name="ThreadTestInPage">
<cflog log="Application" text="The thread in the page successfully ran" type="information" />
</cfthread>
<cf_ThreadTag />
ThreadTag.cfm:
<cfif thisTag.ExecutionMode EQ "start">
<cfthread action="run" name="ThreadTest">
<cflog log="Application" text="The thread within the tag successfully ran" type="information" />
</cfthread>
</cfif>
Just drop all three files in a directory in ColdFusion 10 and load ThePage.cfm. I get the following entries in the Application log:
"Severity","ThreadID","Date","Time","Application","Message"
"Information","ajp-bio-8012-exec-1","06/19/12","07:18:11",,"C:\ColdFusion10\cfusion\logs\application.log initialized"
"Information","cfthread-11","06/19/12","07:18:15","CFTHREADCUSTOMTAGTEST","The thread in the page successfully ran"
"Error","cfthread-9","06/19/12","07:18:15",,"THREADTEST: Variable _cffunccfthread_cfThreadTag2ecfm16902001291 is undefined. "
I also noticed that in the error for the thread within the custom tag, it does not contain the application name. While the log entry for the thread in the page does. Notice that the error line simply has ,, for the Application column of the log, while the successful thread has "CFTHREADCUSTOMTAGTEST".
If I change ThreadTag.cfm to wait for the thread within the tag to finish processing, then everything works fine, and I get the two entries in the log as I expect:
<cfif thisTag.ExecutionMode EQ "start">
<cfthread action="run" name="ThreadTest">
<cflog log="Application" text="The thread within the tag successfully ran" type="information" />
</cfthread>
<cfthread action="join" name="ThreadTest" timeout="10" />
<cfdump var="#cfthread#">
</cfif>
And to verify that there are no funky settings anywhere, here's my local development environment's settings summary.
So it seems that if I just throw the thread out there, and don't wait for it to finish, then the thread seems to be looking for something from the parent page that is no longer in memory. At least that's my completely unfounded guess :).
I've also filed a bug with Adobe. Bug number 3218452.
I understand your predicament, but there's no actual question here.
Basically you've found a bug in CF. A few people - myself included - can replicate it.
No-one's missing anything, except for the Adobe engineers who missed including this sort of thing in their regression testing when implementing CF10. That's no indictment of them, really, as I think this is reasonably edge case, perhaps?
The "variable" CF ain't finding is actually the name of the compiled class that the CF compiler makes when compiling the code. It looks like there's a compiler bug to me.
For example, my error is this:
THREADTEST: Variable _cffunccfthread_cfThreadTag2ecfm13713410591 is undefined.
However the compiled class is:
cfThreadTag2ecfm1371341059$func_CFFUNCCFTHREAD_CFTHREADTAG2ECFM13713410591.class
I don't know what part of the class name the variable is supposed to be named for, but I suspect it should be looking for func_CFFUNCCFTHREAD_CFTHREADTAG2ECFM13713410591. Or on the other hand the compiler should not be compiling the ThreadTag.cfm file as a FUNCTION? But I'm guessing... it might need to compile the thread code as a function so as to call it in a separate thread? That's a guess. Either way: it's compiling the code as one thing, and then looking for a different thing. because of a bug.
But bottom line here: yep, you've found a bug. And you've flagged it with Adobe. I dunno what else there is for you to do here?
So basically we now know one cannot have a <cfthread> call in a custom tag (I also tested via <cfmodule>: same problem). You're gonna have to write yer code a different way, using an include or a method or something. Less than ideal, I know, but what can you do?
Footnote:
I looked at the compiled code and it looks like the problem is CF is compiling the class with that func_ prefix, but it's referring to it in its code without. I didn't follow the code all the way to checking everything that's happening, but it looks to me like there are references to it trying to load _cffunccfthread_cfThreadTag2ecfm13713410591 rather than the correct name: func_CFFUNCCFTHREAD_CFTHREADTAG2ECFM13713410591.class.
Dan,
Please look on this page:
http://help.adobe.com/en_US/ColdFusion/10.0/Developing/WSc3ff6d0ea77859461172e0811cbec0b2e1-7ff0.html
And this section "Determining the tag execution mode"
And try the equivalent mode check code <cfswitch expression=#thisTag.ExecutionMode#>
To see if this causes a different compiler code gen. Maybe it will gen code a bit different and the variable will get generated.
Also, another test to try is to put you tag first in "ThePage.cfm" and see if that causes a different code gen as well.
Finally, are you on a newer JVM, as newer ones use the latest Fork/Join features of the Java concurrency approach such as Futures, etc. and they may be causing different code gen. Maybe set your JDK to an older one and see if the code gen is different.
No real answer, but some things to look at.
I ran into this as well.
My solution was to refactor and put the cfthread stuff into a .cfc and call that from the .cfm page.