What happened to HttpConfiguration.EnableSystemDiagnosticsTracing - asp.net-web-api

I am using the new WebTools 2012.2, and the help files says to add config.EnableSystemDiagnosticsTracing to your Global.asax.
However, this method doesnt exist on HttpConfiguration.

The EnableSystemDiagnosticsTracing extension is part of the Tracing package. Do you have the Microsoft.AspNet.WebApi.Tracing package installed?
Also make sure to have the using System.Web.Http; namespace.

Documentation: link
To install use:
Install-Package Microsoft.AspNet.WebApi.Tracing
Update-Package Microsoft.AspNet.WebApi.WebHost
After that check the following in your project:
Add dll-file \packages\Microsoft.AspNet.WebApi.Tracing.5.2.2\lib\net45\System.Web.Http.Tracing.dll to your project.
Add the following to WebApiConfig.cs
using System.Web.Http;
using System.Web.Http.Tracing;
And
//tracing
config.EnableSystemDiagnosticsTracing();

Because it is an extension method, you need a using statement where the extension method is declared. So in your Global.asax.cs or whereever you want to call EnableSystemDiagnosticsTracing(), you need to add this at the top:
using System.Web.Http;

Shouldn't it trace by default to the Output window for projects created using WebAPI template, if you have Visual Studio 2012 ASP.NET and Web Tools 2012.2? EnableSystemDiagnosticsTracing does the same.

Related

Xamarin Android Binding Library Custom Namespace Not Recognized

I am creating a Xamarin Android binding library for an existing JAR that contains a single class and following the Xamarin binding library documentation, I am able to successfully rename the namespace using:
<attr path="/api/package[#name='com.company.blah']" name="managedName">Company.Blah</attr>
I also confirmed the namespace is changed in the generated class in the 'obj/Debug' folder:
namespace Company.Blah {
// Metadata.xml XPath class reference: path="/api/package[#name='com.company.blah']/class[#name='NativeClass']"
[global::Android.Runtime.Register ("com/sprylab/android/widget/TextureVideoView", DoNotGenerateAcw=true)]
public partial class NativeClass
{
...
}
}
I face two problems:
I am unable to reference NativeClass from a sample Android project. It's like to doesn't see the namespace at all. The binding project built successfully without errors.
If I remove the package namespace rename setting, it also builds successfully and I am then able to reference it in my sample project but it requires that I fully qualify the class name anywhere it is used:
private com.company.blah.NativeClass nativeClass;
I'm hoping if I can fix #1, then #2 will not show up again. If so, I'm also curious how you prevent fully qualified class names from showing up?
Going into the project settings of the binding library project and clearing the box to the right of the assembly name seemed to do the trick. Looking inside the csproj directly, it is the root namespace.

zend studio auto add namespace not working

i used
The Zend Studio 10.6
,then upgrade it to
12.5
Now when i add new class it does not add namespace class in top of my code
for example:
$test = new test();
i must add
use project\Model\test;
in top of my code manually, but it must add this line automatically.
i active code assistant but problem not solved.
sincerely
It is a bug,reported in zend studio forum
http://forums.zend.com/viewtopic.php?f=59&t=126628

visual studio 2010 inserts using directives inside namespace

I have exactly opposite problem to one described here. In my case Visual Studio inserts using directives inside namespace and I want to prevent this. I did try to uncheck Resharper option:
Languages -> C# -> Formatting Style -> Namespace Imports -> Add using directive to the deepest scope
And it didn't help. Also I tried to temporary disable the Resharper. Still same issue.
Btw, I have StyleCop and StyleCop+ installed as well. Maybe it is causing the issue.
So right now when I go and Add New Item -> Class - it will create new code file with using directives inside namespace. How to change this?
Have you replace your class template file with one that has one or more using directives inside the namespace declaration? If so, you're probably seeing the result of an interesting bit of C# plugin behavior: a newly added using directive is placed after the last recognized using directly already in the file, regardless of where that is.

Microsoft.Phone.Controls.Toolkit unable to import using directive

I have downloaded and installed Microsoft.Phone.Controls.Toolkit and I am able to include it in the xaml page, but I am unable to include it in the C# file(like "using Microsoft.Phone.Controls.Toolkit" ). any idea why this happens?
For the xaml:
xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
You can use the controls in the C# file after you add the code post above.
...try to build and after add
using Microsoft.Phone.Controls.Toolkit;
Did you add the DLL as a reference to the project?

Does Visual Web Part support ObjectDataSource in designer?

I'm trying to upgrade some Sharepoint 2007 webparts to SP2010 using the web part projects built into Visual Studio 2010. Namely, I'm using Visual Web Part to migrate our existing controls, which make extensive use of ObjectDataSource. However, when adding an ODS to the control in the Visual Web Part project, it will not pick up objects in referenced class library projects. I was able to duplicate the problem from a clean setup as follows:
Create a new Visual Web Part
Add a new class library to the solution.
Class code is as follows:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace WebPartODS
{
[System.ComponentModel.DataObject(true)]
public class TestUser
{
[System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select,false)]
public List<int> TestMethod()
{
return new List<int>();
}
}
}
Add the class library project as a reference in the Web Part project
In the VisualWebPart ascx file, add a objectdatasource in the Source view:
<asp:ObjectDataSource ID="TestOD" runat="server"></asp:ObjectDataSource>
Switch to Design view, bring up the "Configure data source" wizard. On the drop down, the class from the library project will not appear.
Is there a step that I am missing here, or is there an issue with trying to do it this way?
Ok, i got it to work. Here is where i got my answer: MSDN Forumn
I originally had a separate class for my business layer. I removed it and put my code in the ascx.cs file. Then I added the following line of code to my page load method.
ObjectDataSource1.TypeName = this.GetType().AssemblyQualifiedName;
I also removed the TypeName from the ascx page.

Resources