Removing assembly information from logger name in log4net - log4net

I am working on my log4net logging system, and I'm having trouble figuring out a way to get rid of assembly information in the %logger entry. The logging pattern looks like this conversionPattern value="[%60logger]] %message%newline", but when the line is printed out in the log, the logger is showing assembly information such as Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]. I believe that this is being caused by the fact that the logger is being created from a generic type, but I'm not sure. I need to get rid of that assembly information, but I don't want to changed every instance of GetLogger.

%logger should printout the name of the logger, only if that name contains the Version=1.0.0.0, Culture=neutral, PublicKeyToken=null than that is also printed. Check what you do when you get your loggers:
LogManager.GetLogger(typeof(Program).FullName); //Gives name + Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
If you want the type name, do something like:
LogManager.GetLogger(typeof(Program); //Gives name only
Test program to see the names returned:
class Program
{
static void Main(string[] args)
{
Console.WriteLine(typeof(GenericClass<Program>));
Console.WriteLine(typeof(GenericClass<Program>).Name);
Console.WriteLine(typeof(GenericClass<Program>).FullName);
Console.WriteLine(typeof(GenericClass<Program>).ToString());
Console.ReadKey();
}
class GenericClass<T> { }
}
Output:
ConsoleApp2.Program+GenericClass`1[ConsoleApp2.Program]
GenericClass`1
ConsoleApp2.Program+GenericClass`1[[ConsoleApp2.Program, ConsoleApp2, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
ConsoleApp2.Program+GenericClass`1[ConsoleApp2.Program]

Related

How do I pass an object from an azure data factory lookup to a notebook so I can use the object/json within a python script

I am using Azure Data Factory for the first time.
I have a lookup with a source dataset that is a table from azure table storage
I have a notebook which has a Base Parameter called 'input' with the value:
#activity('Lookup1').output
The notebook path refers to a python script that does nothing yet.
When I try and debug the pipeline I get and error:
{
"errorCode": "2105",
"message": "The value type 'System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxx],[System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=xxx]]', in key 'input' is not expected type 'System.String'",
"failureType": "UserError",
"target": "Notebook1"
}
I would like to be able to use the json object in the python script. Do I have to change the Base Parameter some way to serialise the object?
You can convert it to a string using #string:
https://learn.microsoft.com/nl-nl/azure/data-factory/control-flow-expression-language-functions#conversion-functions
This should work: #string(activity('Lookup1').output)
This converts the object to a json string, you can probably parse that in your notebook.

Import/Export Recipe in Orchard CMS

I have been facing many issues whenever I try to import the changes.
We have three orchard instances for different environments. Changes made in one should be migrated to remaining two instances. For this, I am using import/export module in orchard CMS(v 1.6.0.0).
The export file contains only the changes I made in CMS1 => CMS1.xml and those which are already there are deleted from the file. If I update Resource text ie., "Export Untouched" to "Export Modified" and save changes to the XML file, then when I import this file to CMS2 and CMS3 instances, those imports are not working.
NOTE: I did not change the Key, I just updated the value.
Exception:
thread:[11] ERROR - NullReferenceException thrown from <>f__AnonymousType4`2 by <>f__AnonymousType4`2
[[Orchard.ContentManagement.ContentPart, Orchard.Framework, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null],
[Orchard.ContentPicker.Fields.ContentPickerField, Orchard.ContentPicker, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]
server: XXX.YYY.com operation : /XXXCMS/Admin/ImportExport/Export exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Orchard.ContentManagement.DefaultContentManager.GetItemMetadata(IContent content) in d:\Builds\29\XXX\MP_2_0_XXXCMS_Support\Sources\XXX\Main\Source\Webs\Webx\XXXX_YYYYY2.0\Orchard\ContentManagement\DefaultContentManager.cs:line 513 at Orchard.ContentPicker.Drivers.ContentPickerFieldDriver.<Exporting>b__13(ContentItem x) at System.Linq.Enumerable.
<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x) at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext() at System.Linq.Buffer`1.
.ctor(IEnumerable`1 source) at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source) at Orchard.ContentPicker.Drivers.ContentPickerFieldDriver.Exporting(ContentPart part, ContentPickerField field, ExportContentContext context) at Orchard.ContentManagement.Drivers.ContentFieldDriver`1.<>c__DisplayClass1c.<Orchard.ContentManagement.Drivers.IContentFieldDriver.Exporting>b__1b(ContentPart part, TField field)
in d:\Builds\29\XXX\MP_2_0_XXXCMS_Support\Sources\XXX\Main\Source\Webs\Webx\XXX2.0\Orchard\ContentManagement\Drivers\ContentFieldDriver.cs:line 67 at
Orchard.ContentManagement.Drivers.ContentFieldDriver`1.<>c__DisplayClass25.<Process>b__23(<>f__AnonymousType4`2 pf) in
d:\Builds\29\XXX\MP_2_0_XXXCMS_Support\Sources\XXX\Main\Source\Webs\Webx\XXXX_YYYY2.0\Orchard\ContentManagement\Drivers\ContentFieldDriver.cs:line 80 at
Orchard.InvokeExtensions.Invoke[TEvents](IEnumerable`1 events, Action`1 dispatch, ILogger logger) in d:\Builds\29\XXX\MP_2_0_XXXX_Support\Sources\XXX\Main\Source\Webs\Webx\Project 2.0\Orchard\InvokeExtensions.cs:line 17

What is System.Windows.ni.dll?

I'm working on a WP8 app that uses a ScheduledTaskAgent to update a Live Tile. It's a pretty simple app, really. Problem is that while I've directly copied the code from the WP7 project to the WP8 project, it won't launch the ScheduledTask. Not only that, but I get an error if I'm debugging and I try to launch the scheduled task for testing.
'System.InvalidOperationException' occurred in System.Windows.ni.dll
Not only that, but it doesn't give me any stack to look through, and says that the source is not available, that I can look at the disassembly in the disassembly window, which means nothing to me. So, not a very helpful error, IMO.
I tried putting a break point in the constructor of the scheduled task, and it never makes it there. If I comment out the launch for test, no error. But of course, putting the app in my phone, it never launched, leaving it overnight.
Here's my code:
var taskName = "TileUpdater";
var oldTask = ScheduledActionService.Find(taskName) as PeriodicTask;
if (oldTask != null)
{
ScheduledActionService.Remove(taskName);
}
if (useLiveTile)
{
//GenerateTileInfo();
PeriodicTask task = new PeriodicTask(taskName);
task.Description = AppResources.BackgroundTaskDescription;
oldTask = ScheduledActionService.Find(taskName) as PeriodicTask;
if (oldTask == null)
{
ScheduledActionService.Add(task);
}
#if DEBUG
ScheduledActionService.LaunchForTest(taskName, TimeSpan.FromSeconds(10));
#endif
}
The code works fine in the WP7 version. :/
This is in my WMAppManifest.xml file:
<ExtendedTask Name="BackgroundTask">
<BackgroundServiceAgent Specifier="ScheduledTaskAgent"
Name="xxxScheduledTask"
Source="xxxScheduledTask"
Type="xxxScheduledTask.SecheduledAgent" />
</ExtendedTask>
In my scheduled task, the only thing I'm doing is calling a procedure that generates the tile info, updating the tile, and for the moment, I'm re-running the launch for test, so I can watch to see if it updates again, though I've had this commented out - I uncommented it to paste here, but that was commented out. Here is my OnInvoke method:
GenerateTileInfo();
#if DEBUG
ScheduledActionService.LaunchForTest(task.ToString(), TimeSpan.FromSeconds(60));
#endif
NotifyComplete();
The GenerateInfo method doesn't do anything that would cause a problem, but of course, it's never getting there anyway. I did test my generating of the tile info, and implementing it, by placing that code in the MainPage.xaml.cs and calling it for now, to see if it worked, and the code I'm calling works fine. So if I open the app, the tile gets updated. Now I need to get the Background Task to work.
Any help that anyone can offer is greatly appreciated. One other clue is that last night I was getting an error that involved not being able to locate a pdb file - I think it was Microsoft.Phone.pdb, but whatever it was, it also referred to the System.Windows.ni.dll file, but now I'm not getting that pdb issue, just this InvalidOperationException. Last night the Debugging Symbols (I don't know what that means) were not loading. Today they are. I don't know what I did to fix it. Could have been a restart, for all I know.
Also, I tried creating a new project and copying my code to a new project, thinking I may have a corrupted project file, but the error I'm getting now is the same as I was getting earlier today that prompted me to create the new project.
Again, any help is appreciated. Thanks.
(Edit - New comments added below this point 12/29 at 11:34 am EST)
=================================================================================
I tried another expriment. I created a new project, and copy/pasted code from http://www.jeffblankenburg.com/2011/11/25/31-days-of-mango-day-25-background-agents/ to see if I could debug the app. I did have to make a few minor changes to the code that Jeff Blankenburg wrote, because he states that when you add the scheduled task project, it will automatically add to the WMAppManifest.xml file the following code, which it didn't. I did that manually.
I also changed the StandardTileData type to FlipTileData (since that is what was default in the WP8 project) in the code that is pasted to the ScheduledAgent.cs.
Other than that, the only thing I did that Jeff doesn't mention in his article is to add the necessary using directives.
Given the results of this experiment, I think I might be looking at somehow my Visual Studio install being corrupted. Would you concur? I'm thinking that doing an uninstall/reinstall of VS2012 and the phone sdk are what's in order here, but since it takes so long, I wanted to get another opinion. Thanks.
Update (1/4/2012)
===============================================================
Uninstalled VS, went through the registry, then reinstalled VS2012, and phone SDK. Here's what I get now - at least now it will show me the stack trace:
[Native to Managed Transition]
System.Windows.ni.dll!MS.Internal.JoltHelper.OnUnhandledException(object sender, System.UnhandledExceptionEventArgs args)
[Managed to Native Transition]
mscorlib.ni.dll!System.Reflection.RuntimeAssembly.nLoad(System.Reflection.AssemblyName fileName, string codeBase, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly locationHint, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks)
mscorlib.ni.dll!System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(System.Reflection.AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, System.Reflection.RuntimeAssembly reqAssembly, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool throwOnFileNotFound, bool forIntrospection, bool suppressSecurityChecks)
mscorlib.ni.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, System.IntPtr pPrivHostBinder, bool forIntrospection)
mscorlib.ni.dll!System.Reflection.RuntimeAssembly.InternalLoad(string assemblyString, System.Security.Policy.Evidence assemblySecurity, ref System.Threading.StackCrawlMark stackMark, bool forIntrospection)
mscorlib.ni.dll!System.Reflection.Assembly.Load(string assemblyString)
Microsoft.Phone.ni.dll!Microsoft.Phone.BackgroundAgentActivator.LoadEntryPointAssembly(string assemblyName)
Microsoft.Phone.ni.dll!Microsoft.Phone.BackgroundAgentActivator.LoadAgent(string assemblyName, string typeName)
Microsoft.Phone.ni.dll!Microsoft.Phone.BackgroundAgentActivator.Microsoft.Phone.IBackgroundAgentActivator.CreateBackgroundAgent(string assembly, string typeinfo)
Microsoft.Phone.ni.dll!Microsoft.Phone.BackgroundAgentDispatcher.AgentRequest.Invoke()
Microsoft.Phone.ni.dll!Microsoft.Phone.BackgroundAgentDispatcher.InvocationThread()
mscorlib.ni.dll!System.Threading.ThreadHelper.ThreadStart_Context(object state)
mscorlib.ni.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state)
mscorlib.ni.dll!System.Threading.ThreadHelper.ThreadStart()
[Native to Managed Transition]
Also considered that I was using the low memory emulator and had forgotten that background agents are not allowed in low mem devices, but which emulator (or device) I use makes no difference.
After all this time of fighting with it, I've got the problem resolved. In copying the code from one project to another, I forgot to add a reference to the ScheduledTask project in the main project.
I also learned a couple other things in the process of working on sample code to try to get it to work outside my project. First, when you add a ScheduledTask project it doesn't seem to add the necessary metadata to the WMAppManifest.xml file, so you need to add that manually. The other thing is that when dealing with background agents, the error messages can be pretty cryptic, and may not say a thing about what the problem really is.
From now on, when I see an error like I've seen here (I've seen several pretty cryptic errors, all seeming the same, but not quite) when working on Scheduled Tasks, that will be a prompt to be sure I've got a reference to the second project, and be sure the necessary info is in WMAppManifext.xml (including spelling - if you misspell it, it won't be underlined).
Yeah, there's no way this code snippet runs on WP7.5 SDK. task.ToString() will be the type name ("Microsoft.Phone.Scheduler.PeriodicTask") and as such not the right value.
Change:
ScheduledActionService.LaunchForTest(task.ToString(), TimeSpan.FromSeconds(60));
To:
ScheduledActionService.LaunchForTest(task.Name, TimeSpan.FromSeconds(60));
And it works fine.
To answer your question: *.ni.dlls are NGENed .net dlls. The framework gets NGENed and deployed to the phone so most exceptions you'll see will come from *.ni frameworks dlls. I'm guessing you just saw a generic exception.
How are you getting on with this? I have a very similar issue ('System.InvalidOperationException' occurred in System.Windows.ni.dll" when I go into the Background agent code... it was working fine in WP7... the app is still WP7 except that now I am running under VS2012 and have installed the WP8 SDK.
Funny thing is that I have another app that works just fine - exactly the same scenario and environment.
Have you got your issue sorted yet? It's been very frustrating.
The ".ni." stands for Native Images, surrounding .NET specifically.
I found this when a BackgroundDownload.exe started running and I started tracking. This came out of one of its logs.
1,"fusion","GAC",0
1,"WinRT","NotApp",1
3,"System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System\556b21e2d636701016ad76fe3776a505\System.ni.dll",0
3,"System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Core\f8a689485cf213780df744fde2c54190\System.Core.ni.dll",0
3,"System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Configuration\d577fd286e51f472414996f5144aaaa9\System.Configuration.ni.dll",0
3,"System.Xml, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Xml\b7630f847e13fc7dd88ab8a8862c2b7a\System.Xml.ni.dll",0
3,"System.Security, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Security\68e68081542c0d5baa15a846cf2ca458\System.Security.ni.dll",0
3,"System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Drawing\74f4937603f11ad21e91b4aed570fd4f\System.Drawing.ni.dll",0
3,"System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Windows.Forms\56eb2160cb5e0e733dd0c2366d3de3d2\System.Windows.Forms.ni.dll",0
3,"System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Runtime\89b3e92a43e17d474b9cbc6747c76fa0\System.Runtime.ni.dll",0
3,"System.Reflection, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Reflection\aaf8c507950277bf496287476935feeb\System.Reflection.ni.dll",0
3,"System.Numerics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Numerics\efa65924471acfbcd2b23cceae87e730\System.Numerics.ni.dll",0
3,"System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Runteb92aa12#\ddf4d9ca9e105b351ad6a99442e5edd9\System.Runtime.Serialization.ni.dll",0
3,"System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Data\7331e242363acc7a26bec36a4a703e6c\System.Data.ni.dll",0
3,"System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Xml.Linq\2ca98da3b8de00d4eaf9599d6316c284\System.Xml.Linq.ni.dll",0
3,"SMDiagnostics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\SMDiagnostics\614b71bb8864202da9d3e6dcbc0be4a3\SMDiagnostics.ni.dll",0
3,"C:\WINDOWS\system32\WinMetadata\Windows.Networking.winmd","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\Windows.Networking\c98b01a13bd7a97270a1775b1cd0cf4f\Windows.Networking.ni.dll",1
3,"System.Runtime.InteropServices.WindowsRuntime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a","C:\WINDOWS\assembly\NativeImages_v4.0.30319_64\System.Runtbff93e24#\16fa2326f490f06c2d7a427861e635b6\System.Runtime.InteropServices.WindowsRuntime.ni.dll",0

System.IO.FileNotFoundException in SimpleData

I am using Simple Data (1.0.0-rc0) like Simple.DataDatabase.Default.Licenses.All().ToList<License>() to get a list of licenses. It works fine and all in my productions environment (VS2010, IIS7.5) but once deployed to live server it throws :
`System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExportsCore[T](String contractName)
at Simple.Data.MefHelper.Compose[T](String contractName)
at Simple.Data.AdapterFactory.DoCreate(String adapterName, IEnumerable1 settings)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Simple.Data.CachingAdapterFactory.Create(String adapterName, IEnumerable1 settings)
at Simple.Data.DatabaseOpener.OpenDefaultMethod()
at Simple.Data.DatabaseOpener.OpenDefault()`
`System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.VisualStudio.Shell, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'`
The server is running a freshly installed Windows Server 2008 R2.I have been going at this for the last two days without any progress at all. Did I perhaps miss something crucial during server setup?
This is an issue with MEF. One of the assemblies in your bin folder has a reference to Microsoft.VisualStudio.Shell, and when MEF tries to do its thing and it can't follow all the references, it throws that error.
This has been the cause of several bug reports recently, and the next release will have a change to the MEF code which will stop it from happening.
As a workaround in the meantime, you can either track down the assembly with the reference and remove it, or put that assembly in the bin folder. I'd recommend the former, since adding that assembly might be the start of a whole chain of adding more and more.

Failure Loading Of Event Receiver Assembly

I have the following code snippet in my feature.xml
<Feature Id="0c272f81-49c0-440a-a544-677d51a8ffe4"
ReceiverAssembly="FeaturedMasterPage, Version 1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5"
ReceiverClass="FeaturedMasterPage.FeatureEventReciever"
Title="Branding202"
Scope="Web"
Version="1.0.0.0"
Hidden="FALSE"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location="Branding202\Module.xml" />
<ElementFile Location="Branding202\Branding202.Master" />
</ElementManifests>
</Feature>
My FeatureEventReciever.cs says:-
using System;
using System.Collections.Generic;
using Microsoft.SharePoint;
using System.Text;
using System.Diagnostics;
namespace FeaturedMasterPage
{
class FeatureEventReciever:SPFeatureReceiver
{
public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
try
{
//My Code
}
catch (Exception)
{
throw;
}
}
public override void FeatureDeactivating(SPFeatureReceiverProperties properties)
{
try
{
//My Code
}
catch (Exception)
{
throw;
}
}
public override void FeatureInstalled(SPFeatureReceiverProperties properties) { }
public override void FeatureUninstalling(SPFeatureReceiverProperties properties) { }
}
}
When i try to deploy the solution...it gives me the following error:-
Error 1 Feature '0c272f81-49c0-440a-a544-677d51a8ffe4' could not be installed because the loading of event receiver assembly "FeaturedMasterPage, Version 1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5" failed: System.IO.FileLoadException: Could not load file or assembly 'FeaturedMasterPage\, Version 1.0.0.0\, Culture\=Neutral\, PublicKeyToken\=9f4da00116c38ec5' or one of its dependencies. The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
File name: 'FeaturedMasterPage\, Version 1.0.0.0\, Culture\=Neutral\, PublicKeyToken\=9f4da00116c38ec5'
at System.Reflection.AssemblyName.nInit(Assembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
0 0
I have already spent whole day troubleshooting this. I have installed the dll using gacutil.
Any help would be appreciated.
Maybe it's just something gone wrong in StackOverflow automatic formatting, but I don't see the "equals" sign in your assembly's full name (at the ReceiverAssembly="...." part).
Should be
FeaturedMasterPage, Version=1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5
What I see is
FeaturedMasterPage, Version 1.0.0.0, Culture=Neutral, PublicKeyToken=9f4da00116c38ec5
Unfortunately I doubt the issue is with your code but rather the path, of which only you can fix.
Verify your assembly name.
Verify your full class name.
Verify your assembly is getting included in the solution file.
If you get past number three then it's a SharePoint issue but judging by the errors, I can almost guarantee you that it's simply a bad reference.
Can you try loading the assembly manually via PowerShell?
Try to rename the Assembly by right clicking the project name >> Properties >> from the Application tab rename both of the "Assembly Name" and "Default namespace" to be the same name. I faced this problem before and that was the solution for it. Hope it helps you.

Resources