Enterprise Library  
Author Message
michael olson





PostPosted: Visual Studio Extensibility, Enterprise Library Top

Has anyone used Enterprise Library in their VSPackage implementations I'm trying to use the Exception Handling Block, but having some difficulties, since the actual application is devenv.exe.

Thanks,

Mike



Visual Studio28  
 
 
Tim Murphy





PostPosted: Visual Studio Extensibility, Enterprise Library Top

Ashish,

I don't recall seeing anything built into EntLib that supports ETW out of the box, but you could always extend the Logging Application Block.

 Tim



 
 
Yu Xiao





PostPosted: Visual Studio Extensibility, Enterprise Library Top

Mike,

I think "Visual Studio Extensibility " forum might be a better place to answer this question.

Thanks,

-Yu



 
 
slush_puppy





PostPosted: Visual Studio Extensibility, Enterprise Library Top

Yes, I've done this and yes, it is complicated. Here's how I made it work...

1. You have to build the EL with a key so that it has strong names.

2. Your EL dlls MUST be registered in the GAC, unless you want to copy them to the devenv.exe directory.

3. You config file won't load automatically, because the executing assembly is devenv.exe. So you have to load it manually by doing the following. The rest just shows how to get to actually handling the exception:

FileConfigurationSource configSource = new FileConfigurationSource(filename);
ExceptionPolicyFactory m_policyFactory = new ExceptionPolicyFactory(configSource);
ExceptionPolicyImpl exceptionPolicy = m_policyFactory.Create(policyName);
exceptionPolicy.HandleException(e);


where filename is the name of the .config file, policyName is the name of the policy to apply and e is the exception to handle.

Hope that helps!






 
 
PareshGheewala





PostPosted: Visual Studio Extensibility, Enterprise Library Top

Hi Ashish,

Enterprise Blocks doesn't directly give you API to use ETW, but you can use logging sink; extending the sink you can provide your custom Event Writer, and as application requires you can use it.

See the way Instrumentation has been done; in a same fashion you do need to use Event Logging. As it is kind of Logging you would use and extend the logging blocks.

You will need to put the configuration block to be able to read the Event configuration and initialize the Event source instance.

http://www.codeproject.com/dotnet/GetLoggingWithEntLib.asp

The above article explain how to create custom sinks and that way you can add the Event tracer. As you know the basic code to write the Event Tracing so it shouldn't be hard to extend and write the custom log writer.

I hope this helps you.

-Paresh.