System.Windows.Interactivity, Version=3.8.5.0 breaks call to OnApplyTemplate() - windows-phone-7

I have a complex Windows Phone 7 class library which has been working well for months. However, making only a one line change to the class library, in the csproj file, causes failure of the code. The one line in question is this one:
from:
<Reference Include="System.Windows.Interactivity, Version=3.7.5.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" />
to:
<Reference Include="System.Windows.Interactivity, Version=3.8.5.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35,
processorArchitecture=MSIL" />
the failure I refer to is the fact that the OnApplyTemplate() overload, essential to the correct functioning of our class library, is no longer called.
Can anybody please give me any insight into this problem?
Many thanks.

You're not "making only a one line change to the class library". You're referencing a different version of an external, albeit system, library.
If there were two different versions of a library I would expect there to be a difference between them. (Otherwise have the 2 versions?) It just so happens that the change between the 2 versions appears to be a breaking change for you.
Why change to v 3.8.5.0 in the first place?

Related

Unit tests not discovered in Visual Studio 2019

The tests are present at Test Explorer but run command has no effect.
Looking at Output windows, for Test outputs it shows many errors like this:
MSTestAdapter failed to discover tests in class 'UnitTests.Adhoc' of assembly 'some test.dll' because Method not found: 'System.String Microsoft.VisualStudio.TestTools.UnitTesting.TestMethodAttribute.get_DisplayName()'..
Found out that had some assembly conflict not signal by visual studio as usual on the references tree node.
Removing Microsoft.VisualStudio.TestPlatform.TestFramework reference and adding again did the trick.
Here de difference at the project file:
Before:
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\MSTest.TestFramework.2.0.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\MSTest.TestFramework.2.0.0\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
After:
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
For me, the other solutions didn't work as I e.g. did not have a reference to the package 'Microsoft.VisualStudio.TestPlatform.TestFramework'. It turned out that the solution for me was updating the Target Framework of the test projects from .NET Core 2.0 to .NET Core 3.1. Everything was working as before when changing that.
I'm not sure what caused the issue, but I think it was a combination of three packages.
For full reference, these are the ones (with version) I am now using with .NET Core 3.1:
Microsoft.NET.Test.SDK
MSTest.TestAdapter 2.1.1
MSTest.TestFramework 2.1.1
On Visual Studio 16.5.2
My problem was that I had tests in one specific class that weren't recognized.
Turns out I'd cut and pasted a TestInitialize method that contained a TestContext that I wasn't using. For instance:
[TestInitialize]
public void ClassInitialize(TestContext context)
When I removed the unused TestContext all my tests were recognized:
[TestInitialize]
public void ClassInitialize()
You can go to the test options (Test -> Options) and turn up the logging level to trace, and then you might find more information. for me, it was because the test classes were not public, even though te.exe (https://learn.microsoft.com/en-us/windows-hardware/drivers/taef/) found the tests fine even when the classes were non public
[MSTest][Discovery][C:\Users\mgrandi\Code\git\blah\src\Services\blah\Test\blah.Tests\bin\Debug\net472\blah.Tests.dll] UTA001: TestClass attribute defined on non-public class blah.Tests.blah.Common.BondObjectSanitizerTest

Using PrecompiledMvcEngine FindView throws InvalidOperationException and looks for View cshtml files

I got an InvalidOperationException when the MVC controller tried to FindView while using the PrecompiledMvcEngine.
Using on a machine that has VS2012, MVC4 and deployed to IIS
After looking at the source code of ControllerBase.FindView to ViewEngineCollection.FindView to VirtualPathProviderViewEngine to PrecompiledMvcEngine, found that _mappings in PrecompiledMvcEngine had a count of 0. (Tx to Reflection and Open source.)
The reason is that there was not Type assignable to WebPageRenderingBase in my project's DLL. On decompiling my dll, it actually had the compiled views, and the views extended from WebPageRenderingBase.
After writing a unit test to do the same thing that PrecompiledMvcEngine does to load views, found that they are using different versions of the WebPageRenderingBase class. RazorGenerator.Mvc uses System.Web.WebPages v1.0.0.0 to precompile at build time. The PrecompiledMvcEngine uses System.Web.WebPages v2.0.0.0 when loading types from the compiled assembly. Fixed this by changing my MVC csproject to also load v1.0.0.0 at runtime.
Changed
<Reference Include="System.Web.WebPages" />
which picked up 2.0.0.0 to
<Reference Include="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
forcing it to always pick up 1.0.0.0. This problem will often be faced if you are deploying precompiled views to a machine with VS2012 and MVC4 installed, without specifying the correct version in the csproj file

CrystalReports error

I inherited a web app which I'm tasked with maintaining. The application has a dozen or so crystal reports, but I couldn't open them (well, I -could- but they were mostly numeric in nature).
I installed this: http://scn.sap.com/people/coy.yonce/blog/2010/11/12/crystal-reports-for-visual-studio-2010-production-release-now-available
Then, I could open them properly. I made the necessary adjustments to some of them, saved, and attempted to test locally. Before installing crystal reports (above), I ran the application locally and it worked fine.
The problem: Now that I've installed it and made my changes (very minor stuff and only to the rpts, not to any aspx files), I'm getting this error:
Parser Error Message: Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
Source Error: [No relevant source lines]
Here's what I have in Web.config pertaining to Crystal Reports:
<assemblies>
<add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
<add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>
<add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>
The versions here match the version in the reference's properties.
There are no dlls in the bin folder beyond the application's own dll.
There are the following 'Crystal' related references: CrystalDecisions.CrystalReports.Engine, CrystalDecisions.ReportSource, CrystalDecisions.Shared, CrystalDecisions.Web
I've researched the problem, and some say I need to add an ajax dll. Which one? Also, in what way does that relate?
This was supposed to be a tiny adjustment and it's turning into a big thing at this point. Any help you are able to offer is greatly appreciated.
Thanks!
The problemi is tied to System.Web.Extensions dll, it's not a Crystal Reports problem.
Try removing System.Web.Extensions line in web.config.

How to use wizard assemblies attached in VsixMainfest in project templates?

I have a vsixmanifest file that has an assembly attribute. The file looks like:
<Content>
<ProjectTemplate>Solution</ProjectTemplate>
<Assembly AssemblyName="SolutionNameWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c39bfcc-223f-4c12-a5dc-55eeca7c61f7">
Assemblies\SolutionNameWizard.dll
</Assembly>
I know that the assembly name and public key are correct.
Now, I am trying to use this assembly in one of my templates. Right now I have:
<WizardExtension>
<Assembly>SolutionNameWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c39bfcc-223f-4c12-a5dc-55eeca7c61f7</Assembly>
<FullClassName>SolutionNameWizard.IWizardImplementation</FullClassName>
</WizardExtension>
Is there something that I am missing? When I run the vsix I get the following error:
A problem was encountered creating the sub project 'test.Web' Error: this template
attemtped to load component assembly 'SolutionNameWizard, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1c39bfcc-223f-4c12-a5dc-55eeca7c61f7'.
I know that templates require the assembly to be in the GAC, is that also the case when I am using vsix? I was hoping to avoid the GAC and still use my wizard.
EDIT: I changed the public key to the proper string as suggested in the answers, but am still having the issue.
Edit 2: in addition to the helpful answer below, here is a blog that I wrote after I finished this process. It links to a bunch of articles that I found to be very helpful: https://thebhwgroup.com/blog/2013/10/visual-studio-templates
If your assembly is being provided via your VSIX, it does not need to be in the GAC.
Your PublicKeyToken is definitely not correct. You're using a Guid when it should be a 16-character hex string (8 bytes). See the following example:
MyAssembly, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
You can find the PublicKeyToken value for your assembly by running sn.exe -T MyAssembly.dll from a VS command prompt.
If anyone else happens to stumble upon this question, I ended up following this guide: http://blog.tonysneed.com/2011/09/14/build-a-multi-project-visual-studio-template/
It made the process (mostly) very easy. If anyone happens to run into similar issues, feel free to contact me and I can try to share what I learned.
Edit: here is short blog article I wrote after completing this process. It might be helpful for someone who stumbles upon this: http://www.thebhwgroup.com/blog/2013/10/visual-studio-templates/

System.Web.Helpers does not exist in namespace: WebImage

While I know this has been "answered" about 50 million times, I haven't found an answer that fixes the issue for me, so I feel like I have no choice but to ask again.
Previous suggestions:
Razor pages in MVC are giving a compile error with System.Web.Helpers not being found
<add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
I have added this to my web.config, but the issue remains.
Type or namespace name does not exist
I only have one project, and the targetFramework is 4.0.
I installed Microsoft.Web.Helpers 1.15 (2.0 is incompatible with MVC3.) The Microsoft.Web.Helpers.dll is in my bin folder.
The odd thing is that there's Microsoft.Web.Helpers and System.Web.Helpers. I need System.Web.Helpers in this case, because I'm using WebImage in my code.
As I keep telling people, it's when I ask for help that I find the answer. In my case, somehow in the process of destroying my Solution earlier by upgrading to Microsoft ASP.NET Helper Library 2.0 and then trying to undo that action, System.Web.Helpers stopped being a referenced assembly in my project. Simple fix!
Of course, fixing that led me to the next Assembly Reference error. I think I'll be here all night.

Resources