Visual Studio 2008, ReSharper 7.0.1 and trouble with StyleCop 4.7.40.0

Sep 24, 2012 at 3:28 PM

I just upgraded to 4.7.38 on two machines and in both cases my VS 2008 now fails to start.  I can start in /SafeMode and it starts fine if I uninstall StyleCop.  Is anyone else having this trouble?  What kind of information about my environments would be helpful?  I'm running ReSharper 7.0.1.

Is there anyway to install StyleCop on just VS 2010 and 2012?

This is a great tool and we're totally dependent on it here!

Thanks,
Bruce

Coordinator
Sep 24, 2012 at 3:37 PM
Edited Sep 24, 2012 at 3:40 PM

I'll retest it tomorrow on VS2008. Was 4.7.37 ok?

Sep 25, 2012 at 1:52 AM

The same thing happened to me late today - also running R# 7.0.1. I uninstalled 4.7.38 and started VS 2008 - no errors. Installed 4.7.37 and it works/loads/runs without crashing VS 2008. Guess I should've checked here before just quickly installing the latest. 

Sep 25, 2012 at 11:37 AM
Edited Sep 25, 2012 at 12:25 PM

Win7x64. VS2008 9.0.30729.1 SP. Upgrade R# from R#6.1.1(stylecop 4.7.36) to R#7.0.1. and remove&install stylecop 4.7.38:

 * install 4.7.38 - VS crashes (uninstall stylecop - no errors);

* install 4.7.37 - VS started with exeption "Could not load type ... RegisterConfigurableSeverityAttribute from assembly JetBrains.ReShapre.Feature.Services (this attr placed into JetBrains.ReSharper.Daemon.dll)". VS build failed with MSB errors (error MSB4018:    at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)).

* instlall 4.7.36 - VS started with exeption "Could not load type ... RegisterConfigurableSeverityAttribute from assembly JetBrains.ReShapre.Feature.Services (this attr placed into JetBrains.ReSharper.Daemon.dll)". VS build failed with MSB errors.

Also stylecop 4.7.38 not work with R#6.1.1, VS crashed.

Which stylecop version work with R#7.0.1. ?

Sep 25, 2012 at 11:43 AM

How to stylecop detect R# environment?

Sep 25, 2012 at 2:23 PM

Hey there, I'm also getting Visual Studio 2005 and 2008 application crashes.  I have ReSharper installed as well as three versions of Visual Studio 2005, 2008, and 2010.  I have narrowed it down to StyleCop by uninstalling it and Visual Studio no longer crashing.  Then , just to make sure; I re-installed StyleCop 4.7.38.0 and Visual Studio started crashing again.  I was using StyleCop 4.7.38.0.

Coordinator
Sep 25, 2012 at 2:32 PM

Hi, thanks JeremiahAtNET. Can you confirm if 4.7.37.0 was working fine for you in VS2008 please? As 4.7.38.0 is not crashing VS2008 for me here.

Sep 25, 2012 at 2:43 PM

I had 4.7.36 or 4.7.37 installed before and I believe it was working with all versions of VS.  I'd be happy to try installing 4.7.37 but I can't find it on codeplex and I didn't keep a copy.  Can someone point me to it?

Sep 25, 2012 at 3:16 PM
andyr wrote:

Hi, thanks JeremiahAtNET. Can you confirm if 4.7.37.0 was working fine for you in VS2008 please? As 4.7.38.0 is not crashing VS2008 for me here.

Stylecop 4.7.37.0 not crashing VS2008, but not working in GUI and generate output in IDE build process(error MSB4018). See above.

Coordinator
Sep 26, 2012 at 4:58 PM

I have the issue isolated now. Fix is being prepared.

Sep 27, 2012 at 3:27 PM

Hey there, I havent' had a chance to test 4.7.37.0 but it looks like you have it figured out.  I'll be looking for the next update and I'll post my results here.

Coordinator
Sep 28, 2012 at 10:32 AM

4.7.39 has the fix for this issue.

Sep 28, 2012 at 6:37 PM

Thanks for addressing this so quickly!  Unfortunately, things are still not good for me...  I followed the very good instructions for building (downloaded the latest using TortoiseHG, VerifyBuild.cmd) and after installing some missing pieces (e.g. WiX) I got a clean build.   I installed this (4.7.39) and now VS 2008 starts, but Running StyleCop doesn't appear to do anything.  Nothing in Output or Error List and no errors logged that I can find.  Both VS2010 and VS2012 fail on startup with the same error.  Here are the two rows from the ActivityLog:

34 ERROR SetSite failed for package [StyleCop.VisualStudio.StyleCopVSPackage, StyleCop.VSPackage, Version=4.7.39.0, Culture=neutral, PublicKeyToken=f904653c63bc2738] {629EB7CC-69C2-43AC-9BC9-482B0F810C4E} 8013150a VisualStudio 2012/09/28 18:32:14.091 
35 ERROR End package load [StyleCop.VisualStudio.StyleCopVSPackage, StyleCop.VSPackage, Version=4.7.39.0, Culture=neutral, PublicKeyToken=f904653c63bc2738] {629EB7CC-69C2-43AC-9BC9-482B0F810C4E} 8013150a VisualStudio 2012/09/28 18:32:14.091 

I probably did something wrong in the build and/or install, but I'm not sure what.  Let me know if there is something I can provide to help figure this out.

Thanks!

Coordinator
Sep 28, 2012 at 6:43 PM

Try the 4.7.39.0 msi on the downloads page.

Oct 1, 2012 at 2:37 PM

Well, that's embarrassing.  <blush/>  I swear 4.7.38.0 was still up there when I looked.  Oh well, I got to learn how to build it!

4.7.40.0 is working for me on VS 2008, 2010 and 2012.

Thanks so much for your time and attention to this very excellent tool!

Oct 2, 2012 at 7:33 AM

Stylecop 4.7.40.0 version not work with R#7.0.1. & VS2008. On start VS showing message box "type loading error", but working with R#6.1.1.

Coordinator
Oct 2, 2012 at 8:01 AM

@ssdi: really? 4.7.40 runs the same code for 6.1.1 and 7.0.1 for VS2008. The repro that I had does not fail now with the latest code fixes. Is anyway esle seeing a problem with VS008 starting the StyleCop plugin for ReSharper 7.0.1 please?

Oct 2, 2012 at 9:26 AM
andyr wrote:

@ssdi: really? 4.7.40 runs the same code for 6.1.1 and 7.0.1 for VS2008. The repro that I had does not fail now with the latest code fixes. Is anyway esle seeing a problem with VS008 starting the StyleCop plugin for ReSharper 7.0.1 please?

Stylecop 4.7.40.0 & R#7.0.1.(7.0.1098.2760) & VS2008(SP) on first run VS crashes. On second run IDE-windows settings discarded. StyleCop show message box with message: "An exception occured while loading one of the StyleCop add-ins: System.TypeLoadException, Could not load type 'JetBrains.ReSharper.Deamon.RegisterConfigurableSeverityAttribute' from assembly 'JetBrains.ReSharper.Feature.Services, Version=7.0.1098.2760, Culture=neutral, PublikKeyToken=.....'".

In R#7.0.1.(7.0.1098.2760) RegisterConfigurableSeverityAttribute located into JetBrains.ReSharper.Daemon.dll. See my post above.

Coordinator
Oct 2, 2012 at 11:43 AM

I've just taken a fresh Win7/VS2008 image and installed ReSharper 7.0.1098.2760 and then StyleCop 4.7.40.0. Vs2008 starts and runs fine. Is anyone else getting issues with VS2008, ReSharper 7.0.1 (7.0.1098.2760) and StyleCop 4.7.40 please?

Oct 2, 2012 at 12:12 PM

I'am using not default installation. Install stylecop onto custom location without MsBuild integration.

Oct 2, 2012 at 1:50 PM

4.7.40.0 is working fine for me on VS 2008 (and 2010 and 2012).  Win 7 64, VS 9.0.30739, ReSharper 7.0.1098.

Coordinator
Oct 2, 2012 at 2:51 PM

Just tried it with out Msbuild integration and into a different folder. Still worked fine.

Oct 2, 2012 at 3:09 PM

I have also upgraded to 4.7.40.0 on two machines and everything seems to be working fine:

  • Windows 2008 R2 / VS 2008 9.0.30729.4462 / VS 2010 10.0.40219.1 SP1REL
  • Windows 8 Enterprise / VS 2012 11.050717.1 RTMREL

All seems well for me.

Oct 2, 2012 at 3:15 PM
Edited Oct 2, 2012 at 3:30 PM
andyr wrote:

Just tried it with out Msbuild integration and into a different folder. Still worked fine.

What assumptions about the type loading exception message?

 

P.S. I'am uninstal/install stylecop before/after upgrade R#.

P.P.S. VS2008 started with elevated privilegies.

Coordinator
Oct 2, 2012 at 4:45 PM

The typeload issue suggests that ReSharper is not being located. Maybe uninstall ReSharper, reboot, and re-install and see if that helps you.

Oct 4, 2012 at 11:26 AM
andyr wrote:

The typeload issue suggests that ReSharper is not being located. Maybe uninstall ReSharper, reboot, and re-install and see if that helps you.

Ок. Not working with same message....

In R#7.0.1.(7.0.1098.2760) RegisterConfigurableSeverityAttribute located into JetBrains.ReSharper.Daemon.dll. StyleCop plugin try to locate RegisterConfigurableSeverityAttribute into wrong location (JetBrains.ReSharper.Feature.Services.dll).

 

Coordinator
Oct 4, 2012 at 11:28 AM
Sorry. No more ideas. Working here fine and other people have it working fine too.


~A.

On 4 Oct 2012, at 12:27, ssdi <notifications@codeplex.com> wrote:

From: ssdi

andyr wrote:

The typeload issue suggests that ReSharper is not being located. Maybe uninstall ReSharper, reboot, and re-install and see if that helps you.

Ок. Not working with same message....

In R#7.0.1.(7.0.1098.2760) RegisterConfigurableSeverityAttribute located into JetBrains.ReSharper.Daemon.dll. StyleCop plugin try to locate RegisterConfigurableSeverityAttribute into wrong location (JetBrains.ReSharper.Feature.Services.dll).

Oct 4, 2012 at 11:36 AM

When building solution StyleCopTask write into ErrorList:

Error    3    The "StyleCopTask" task failed unexpectedly.
System.TypeLoadException: Could not load type 'JetBrains.ReSharper.Daemon.RegisterConfigurableSeverityAttribute' from assembly 'JetBrains.ReSharper.Feature.Services, Version=7.0.1098.2760, Culture=neutral, PublicKeyToken=1010a0d8d6380325'.
   at System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType)
   at System.Reflection.Assembly.GetCustomAttributes(Boolean inherit)
   at StyleCop.StyleCopCore.LoadAddins(String path, Byte[] publicKey)
   at StyleCop.StyleCopCore.LoadAddins(String path, Byte[] publicKey)
   at StyleCop.StyleCopCore.Initialize(ICollection`1 addInPaths, Boolean loadFromDefaultPath)
   at StyleCop.StyleCopConsole..ctor(String settings, Boolean writeResultsCache, String outputFile, ICollection`1 addInPaths, Boolean loadFromDefaultPath, Object hostTag)
   at StyleCop.StyleCopTask.Execute()
   at Microsoft.Build.BuildEngine.TaskEngine.ExecuteInstantiatedTask(EngineProxy engineProxy, ItemBucket bucket, TaskExecutionMode howToExecuteTask, ITask task, Boolean& taskResult)    ClientDBSynchronization

Coordinator
Oct 4, 2012 at 11:36 AM
Edited Oct 4, 2012 at 2:25 PM
You could try an older 4.7 that you know was working ok and see if it still works for you.


~A.

 

Oct 4, 2012 at 11:45 AM
andyr wrote:
You could try an older 4.7 that you know was working ok and see if it still works for you.

i'm trying install StyleCop-4.7.4.0.msi, StyleCop-4.7.5.0.msi, StyleCop-4.7.36.0.msi, StyleCop-4.7.40.0.msi not working with R#7.0.1 for me :(

Oct 4, 2012 at 1:05 PM

Solved,

R# also load plugins from StyleCop installing directory(mapped to SVN for CCNET build) in which we storing older plugins (into subfolder). When i removing this directory with oldest stylecop plugins, VS & StyleCop work fine.

Coordinator
Oct 4, 2012 at 1:27 PM
Edited Oct 4, 2012 at 2:25 PM
Ah.
That explains it then.
Stylecop is trying to load any dlls it finds in the same folder to see if they have extra rules in.
As it loads the ReSharper dll they have a dependency that it can't resolve.
You need to keep your ReSharper dlls out of your stylecop directories and then you'll be fine.


~A.