.NET ETW - Manifest file not generated - .net-4.5

doing logging component using .NET 4.5
working to log into event log, using ETW
4.5 did include ETW framework into System.Diagnostic.Tracing.*
however samples and external project lead to install Microsft.Diagnostic.Tracing.*
it's really confusing. But for testing purposes, I'm sticking to Microsoft.*
RegisterEvent tool is installed, and attached to the class library containing the custom EventSource, build is good, but I can't see the manifest file (.man) being generated
I'm lost. afaik, I need that .man for manual registration, only then event log will spew out my magic

my custom EventSource is named exactly "EventSource", need to rename to something else like "OMGEventSource"
while trying to fix the initial issue, I switched to using System.Diagnostic.Tracing
however, it's Event class doesn't have Channel property, which is needed by the RegisterEvent tool to generate the man file
have to switch back to use Microsoft.*
in short, forget about System.Diagnostic.Tracing, just stick to Microsoft.*

Related

how to obtain the information about System Configuration in RCP 4

I am trying to obtain information about the system configuration in RCP 4 application. I got a link RCP3 System Configuration which implemented in RCP3 for getting the system configuration. WorkbenchMessages properties and WorkbenchPlugin are used to get the system configuration in RCP3 application but in RCP4 those are not available. How can I implement to get the system configuration?
The ConfigurationInfo class you reference is using the org.eclipse.ui.systemSummarySection extension point and calling the ISystemSummarySection interfaces it defines to get the system summary.
This extension point and the ISystemSummarySection interface do not exist in a plain e4 app so this information is not available using this code.
You may be able to get some of the information by looking at the individual classes that implement ISystemSummarySection and copying the code for those parts that don't use 3.x compatibility mode classes.
For example the ConfigurationLogDefaultSection class just uses System.getProperties() to list the system properties section.

How to access per project / per preset configuration data in vue-cli 3.x?

I'm looking to create a vue-cli 3.x plugin that generates extra files in the project when invoked and templates these based on configuration info entered by the user.
It's rather easy to collect this information from user prompts but it'd be much nicer if users could put this info into some sort of configuration file and have the plugin read it from there.
I understand vue-cli now uses a vue.config.js file on the project level and ~/.vuerc on a more global (preset) level. However, it doesn't look like my generator function would have access to either one of those files.
"The entire preset" should be passed as the third argument to the function when invoking the plugin with module.exports = (api, options, rootOptions) => {} in ./generator/index.js, rootOptions is undefined.
Sililarly, the use of vue.config.js is discussed in the documentation when talking about service plugins, but there's no mention how to use it in a generator function.
Am I missing something obvious here or is there really no officially sanctioned way to do this? Nothing stops me from reading vue.config.js in my function, but this feels hacky. And I wouldn't even know how to find out which preset was used to create the project.
So your problem is that you can't find ~/.vuerc?
I had the same issue and I found the solution here.
The solution is to use the command line
vue config
to see .vuerc, and then use
vue config --delete presets.yourPresetName
to delete your preset.
As well, if you can't type in your preset name in the terminal because it contains a space or an apostrophe, you can use
vue config --edit
to open .vuerc with a text editor and just edit it there

What do you lose by ejecting a React app that was created using create-react-app?

I'm interested in using Hot Module Replacement with a newly created React app.
Facebook Incubator's create-react-app uses Webpack 2 which can be configured to support HMR, however in order to do so, one needs to "eject" the create-react-app project.
As the documentation points out, this is a "one way" operation and cannot be reversed.
If I'm to do this, I want to know what I might be giving up. I've been unable to locate any documentation that explains the potential drawbacks of ejecting.
The current configuration allows your project to get updates from create-react-app core team. Once you eject you no longer get this.
It's kind of like pulling in bootstrap css via CDN as opposed to downloading the source code and injecting it directly into your project.
If you want more control over your webpack, there are ways to configure/customize it without ejecting:
https://www.npmjs.com/package/custom-react-scripts

NServicebus MessageHandlers in a different Project don't get hit

My problem:
I have web project which implements NServicebus and should listen to messages.
Trying to keep my solution tidy I set up a different project for all my messagehandlers.
I now find that these messagehandlers do not get "hit" with messages.
To my understanding NServicebus scans all dll's in the debug folder of the web project to find any classes implementing IHandleMessages<>.
I referenced the messagehandlers class library project in my webproject and it appears in my debug folder, however it does not seem to get hit.
What does work
In a console sample project the inclusion of a referenced project which contains messagehandlers works as expected.
In my web app it works when I move my
messaghandlers to the web app project itself.
Reading through the website http://docs.particular.net/nservicebus/hosting/nservicebus-host/ I found that there are overloads for the Configure.With() method.
However:
I do not know if I need them. They text only seem to suggest that
this will limit the places where NServicebus looks for the
implementations of the interface.
these overloads do not exist in the Configure.WithWeb method which I'm using.
I can solve my problem by moving all the messagehandlers to my web project, but this does not seem like the best solution.
Am I missing something here?
When using NServiceBus in a web project, use NServiceBus.Configure.WithWeb() instead of NServiceBus.Configure.With().
Also, in order to load message handlers in a web application, you need to include the .LoadMessageHandlers() line after .UnicastBus() as described in Hosting NServiceBus in your own Process. Otherwise any IHandleMessages<T> implementations are not loaded and your web application operates as a send-only endpoint.

FacebookSDK - AllowPartiallyTrustedCallers Problem

I'm using the latest version of the FacebookSDK (4.0.2) (facebooksdk.codeplex.com)
And I noticed the Src code is made up of several projects namely:
1)
Samples -> Facebook.Samples.AspWebsite Project
Samples -> Facebook.Samples.MvcFacebookApp Project
Samples -> Facebook.Samples.MvcWebsite Project
2)
Tests -> Facebook.Tests
Tests -> Facebook.Web.Tests
3)
Facebook Project
Facebook.Web Project
Facebook.Web.Mvc Project
Okay, so I am building a Facebook Canvas .Net 4.0 MVC 2 application and am simply using the Facebook.Samples.MvcFacebookApp Project and replacing and adding classes and files as I see fit for my situation. However I have come to the point where my site will be running on a Microsoft Azure cloud and I want to abstract the data layer (database) into it's Project. So I went ahead and created a new Project in the solution called BusinessData and added an EntityDataModel to it, so now the solution looks like this:
1)
Samples -> Facebook.Samples ...
2)
Tests -> Facebook.Tests ...
3)
Facebook Project
Facebook.Web Project
Facebook.Web.Mvc Project
BusinessData Project
-> Business.edmx
Great so now I add a reference to the BusinessData Project to my Facebook.Samples.MvcFacebookApp Project and try and access my database. However I get this error in my TrackUserAttribute.cs class in the Facebook.Samples.MvcFacebookApp Project:
System.MethodAccessException occurred
Message=Attempt by security transparent method 'Facebook.Samples.MvcFacebookApp.Models.TrackUserAttribute..ctor()' to access security critical method 'BusinessData.BusinessEntities..ctor()' failed.
Assembly 'Facebook.Samples.MvcFacebookApp, Version=4.0.2.0, Culture=neutral, PublicKeyToken=null' is marked with the AllowPartiallyTrustedCallersAttribute, and uses the level 2 security transparency model. Level 2 transparency causes all methods in AllowPartiallyTrustedCallers assemblies to become security transparent by default, which may be the cause of this exception.
Source=Facebook.Samples.MvcFacebookApp
StackTrace:
at Facebook.Samples.MvcFacebookApp.Models.TrackUserAttribute..ctor() in C:\Users\rkara\Desktop\FacebookPazooza\ThuziFacebookSDK\Source\Src\Facebook.Samples.MvcFacebookApp\Models\TrackUserAttribute.cs:line 13
InnerException:
After some uneventful research and not being fully understood about CAS Policy and how that has evolved with ASP.Net 4.0 my understanding is that the GlobalAssemblyInfo.cs file contained within all of the projects of the FacebookSDK solution has something to do with it.
This line of code in the GlobalAssemblyInfo.cs file:
#if !(SILVERLIGHT || TESTS)
[assembly: AllowPartiallyTrustedCallers]
#endif
seems to be the culprit. According to this Microsoft expert:
http://www.simple-talk.com/dotnet/.net-framework/whats-new-in-code-access-security-in-.net-framework-4.0---part-i/
BusinessData has SecurityCritical level privileges. My class TrackUserAttribute.cs only has SecurityTransparent, so therefore cannot does not have privileges to invoke methods in the BusinessData assembly. Is this correct?
I've tried all sorts of things to get this thing to work even removing [assembly: AllowPartiallyTrustedCallers] from the GlobalAssemblyInfo.cs file, but I get another problem with the .edmx file itself saying it can't load the metadata, so I assume it still has something to do with full trust privileges etc.
I am sure there is a simple answer to this and am sure the guys who developed this SDK wrapper would have consider the fact that people will be extending their SDK to suit individual needs.
What is the best approach for me to ensure abstraction of my data and anything else I want to abstract without having to tie it into the projects provided?
For now and to continue with development and not be tied up in this for too long I've just stored my entity model (edmx) into the models folder of the Facebook.Samples.MvcFacebookApp. This works for now but I would much rather store the edmx in its own project.
Cheers
Rob
Ok so after I left that problem and moved onto installing log4net as a event logger for my application I came across this site:
http://it.toolbox.com/blogs/daniel-at-work/using-log4net-in-cnet-26794
Essentially I wanted to convert log4net to asp.net 4.0 rather than 1.0/2.0 that it was originally written in. Then after reading through this guys instructions on how he got the old log4net code to work in 4.0 the aha! moment came. Essentially all he needed to do was to put this attribute into his AssemblyInfo.cs file:
[assembly: AllowPartiallyTrustedCallers]
So I did the same for my BusinessData project and updated the AssemblyInfo.cs file there, and hey presto it worked!
After some deep contemplation I figured that what this did was allow my Facebook.Samples.MvcFacebookApp partial privileges to call a SecurityCritical assembly including those objects contained within it. Thus I could go ahead now and call my edmx (EntityDataModel) in this assembly from the Mvc application.
The second fix and is not fully known why this is necessary but it fixes the problem is to copy the connection string from the App.config file to the Web.config file in the Mvc application. For some reason the edmx seemed to try to read from the web.config instead of the App.config for the connection string. So now I have the same connection string in the App.config and Web.config file.
Meh! it works and I'm happy ... moving on!
:-D