I'm starting with a new application using silverlight and the first problem I have with Resharper is in my unit test project.
My configuration is:
-> Resharper 5.1.1727.12
-> MyProject.Tests (CLR 4.0)
nunit.framework.dll (CLR 2.0)
moq.dll (CLR 4.0)
MyProject.Silverlight (Silverlight 4.0)
The test project compiles, no errors and the tests run fine in Reshaper, NUnit Gui, TestDriven.Net
The problem I have is that Resharper keeps telling me to import the System.dll version 2.0 (red line under all silverlight assembly objects/methods like a compiler error, but the project compiles).
The complete message is:
“Module ‘System. Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e’ should be referenced.”
I believe the problem is not related to tests, but that resharper is getting lost when mixing CLR 4.0 and Silverlight 4.0 assemblies.
Is there a way to get rid of this annoying message?
Thanks,
André
EDIT:
Steps to reproduce:
create a silverlight 4 class library
add a class Foo that extends INotifyPropertyChanged
create a CLR 4 class library and reference the silverlight class library
add any class and declare a Foo object as a field or whatever
The project will compile, but resharper will tell you need to import System.dll v2.0.
If you disable resharper, no error message is displayed.
EDIT2:
Installed resharper 5.1.1751.8, no success :(
I have created bug request and you are welcome to monitor its status at
youtrack.jetbrains.net/issue/RSRP-191461
Thank you!
Thanks for the post. Please accept out apologies for the bad experience you have had with our tools. I' m going to reproduce this ASAP and let you know about the status.
UPDATE: We have fixed this in R# 6.0 EAP builds. We are not able to backport it to R# 5.1.x
Related
During migration of our existing project targeting .NET framework 4.8 we encountered starnge error:
MC1000 Unknown build error, 'Could not find type 'System.Web.PreApplicationStartMethodAttribute' in assembly 'C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\6.0.5\ref\net6.0\System.Web.dll'.'
error message image
Basically we have one big class library targeting net6.0-windows that has been used across multiple different smaller projects.
This class library is compileable as a stanalone porject with no errors, but as soon as we reference it in our WPF project, also targeting same net6.0-windows, we got this error.
Does anyone experiencing sme problem?
Any help appreciated...
Eventually I found that mixing of ASP.NET components together with WinForm or WPF is not allowed anymore. So solution was to split our library file into two separate DLL assemblies each targeting proper SDK.
I have an old project with workflow (Appfabric) files in xaml and that project was targeting framework 4.0. We needed to update framework version so we changed the framework to 4.8 and suddenly some of our xaml files stop working.
I could see that there had been no change in the files but still we got errors saying that it can not load some of our custom activity because it could not find files that were in the project.
When looking at the imports it said that Namespace [Namespace.Name] cannot be resolved for those namespace where our custom activity was.
The code for the activity had not change and it was working but somehow the xaml file could not resolve it any more.
The only thing we did was to change the target framework to 4.8 for the project.
I am stuck and wounder if anyone else has had the same problem?
If this is still an issue:
Can you please confirm that the error is coming from AppFabric and
post the full error message
The same
Error Assembly '' can not be resolved. Please add a reference to this assembly in the project that is being built. [Project] [Path].xaml
After following several blogs detailing how to get xUnit working with Team Services Build vNext:
http://tech.trailmax.info/2014/01/run-xunit-in-hosted-team-foundation-service/
Running unit tests in TFS/VSO Build vNext using xUnit adapter
http://www.donovanbrown.com/post/2015/06/15/how-to-run-xunit-test-with-vnext-build
None of which worked for me. From examining the build logs I get the following warnings for each of my test assemblies.
--------------------
Warning: [xUnit.net 00:00:00.1644156] Exception discovering tests from CHO.SAM.Business.Test: System.BadImageFormatException:
Could not load file or assembly 'c:\_Work\473cef3c\CHO\CHO.ALL\Tests\CHO.SAM.Business.Test\CHO.SAM.Business.Test\bin\Debug\xunit.execution.desktop.dll' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
--------------------
Has anyone seen this before? and if so did you figure out a solution?
My thoughts are; my test projects are compiled using .NET Framework 4.6, I was wondering if this could be causing the problem? If so I would have to move over to nUnit or something as I don't feel it's right to change the compilation just to use a single test framework.
Add "/Framework:Framework45" to "Advanced/Other console options" (to run under .NET 4.5)
or
Add "/Framework:Framework40" to "Advanced/Other console options" (to run under .NET 4.0)
or
Change "Advanced/VSTest version" to "Visual Studio 2013" (to run under .NET 3.5)
This error is normally caused by a x64 compiled assembly running on x86 test runner or vice versa. Check the solution build configuration that is being run.
I had this same issue. Adding a UI test did not fix it for me. I found two alternatives that work:
use .net 4.5
OR
Set the advanced options of the VSTest task to use 2013 instead of 2015.
Hopefully this will be fixed soon.
In the end, I added a Visual Studio Coded UI test project and removed all it's contents (a class), it's empty!
I'm assuming it's added a reference or something that the build server felt it needed.
I am now getting my unit tests discovered, running and with code coverage.
Wierd!
It works, but I don't know why...
I ran into this issue when using a .Net Core class library to run my xUnit tests against a .Net Core Web Project (.Net Framework). What solved the issue for me was to change the default processor for running test to X64 in VS2015 via:
Menu Bar -> Test -> Test Settings -> Default Processor Architecture -> X64
This solution was posted by #RehanSaeed here https://github.com/dotnet/cli/issues/3103
When I create a new Silverlight Application (C# if that matters) using Silverlight 4 (with or without WCF RIA Services Checked) and open the MainPage.xaml in the designer I receive an Unhandled Exception has occurred. Stack is below. This is on an unmodified project.
I have uninstalled all Silverlight and reinstalled the tools listed above. I the same error when I open the App.xaml file as well. When I compile it completes without error, however when I run the application it always comes up that Silverlight is not installed.
I have installed Visual Web Developer Express 2010 (v10.0.30319.1 RTMRel) and Silverlight Tools for VS2010 (v10.0.30319.332) on a 32bit Windows XP machine. The IDE works fine in other regards, only issue seems to be with xaml files.
Anybody run into this?
System.NullReferenceException
Object reference not set to an instance of an object.
at Microsoft.Expression.Platform.Silverlight.SilverlightDomainManager.CreateDomainCore()
at Microsoft.Expression.Platform.Silverlight.SilverlightDomainManager.CreateDomainInitial()
at Microsoft.Expression.Platform.Silverlight.SilverlightPlatformCreator.Initialize()
at MS.Internal.Platform.SilverlightPlatformImpl.Initialize()
at MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.EnsurePlatformInitialized()
at MS.Internal.Package.VSIsolationProviderService.RemoteReferenceProxy.EnsurePlatformInitialized()
at MS.Internal.Package.VSIsolationProviderService.CreateIsolationProvider(String originalIdentifier, Boolean isGlobal, String identity, FrameworkName frameworkName, AssemblyName appAssemblyName, IVsHierarchy hierarchy)
at MS.Internal.Package.VSIsolationProviderService.CreateIsolationProviderWorker(String identifier, IServiceProvider provider)
at MS.Internal.Package.VSIsolationProviderService.CreateIsolationProvider(String identifier, IServiceProvider provider)
at MS.Internal.Providers.VSDesignerContext.CreateIsolationProvider(IServiceProvider provider, IVsHierarchy hierarchy)
at MS.Internal.Providers.VSDesignerContext.<>c__DisplayClass1.b__0(IsolationProviderProxy i)
at MS.Internal.Providers.IsolationProviderProxy.get_RealProvider()
at MS.Internal.Providers.IsolationProviderProxy.add_UnhandledException(UnhandledExceptionEventHandler value)
at MS.Internal.Designer.DesignerPane.LoadDesignerView()
After hours of pulling my hair out I found the following post that led me on the path to solving my problem. I had to uninstall the standard version of silverlight and then install the developer runtime and it solved all my problems. Go Figure.
Posted by Microsoft on 2/26/2010 at
12:40 PM Is what is likely
happening is that you have the
standard version of the Silverlight
runtime and you need to install the
developer runtime for Silverlight.
Blend will install and run with the
standard verison of the silverlight
runtime, but Visual Studio requires
the developer version of the runtime.
This issue is fixed in the RTM version
of Visual Studio.
For now, if you hit this issue, please
install the silverlight developer
runtime from this link:
http://go.microsoft.com/fwlink/?LinkId=146060
download Silverlight_Developer.exe
Did you install the latest Silverlight SDK?
http://www.microsoft.com/downloads/details.aspx?FamilyID=40ef0f31-cb95-426d-9ce0-00dcfabf3df5&displaylang=en
I was having issues in log4net when I updated my solutions to .net 4.0 , and then I downloaded the source of it and built log4net and targeted it to .net 4.0 and used it in my projects.
Initially when I referred log4net that is targeted to run time 2.0 it complied and run the application but log did not work.
Now when I run my project with log4net targeted to .net 4.0 I get the error "The type initializer for 'Log4NetTest.TestLog' threw an exception."
Any Idea how to solve this?
Edit: this is the inner exception:
InnerException: System.TypeLoadException Message=Inheritance security rules violated while overriding member:
'log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'.
Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Source=log4net
TypeName=log4net.Util.ReadOnlyPropertiesDictionary.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
StackTrace:
at log4net.Repository.Hierarchy.Hierarchy..ctor(ILoggerFactory loggerFactory)
at log4net.Repository.Hierarchy.Hierarchy..ctor() in C:\src\Repository\Hierarchy\Hierarchy.cs:line 150
In the log4net source code, add a [SecurityCritical] attribute to the
Util.ReadOnlyPropertiesDictionary.GetObjectData method and build.
Just compiled the source for target framework 4.0 (not client). Source code of version 1.2.11 already contains this attribute, but be sure to use 'NET_4_0' as a compiler argument. Otherwise, this attribute will not be added.
I've found a compiled version of log4net for .NET client profile here:
http://gosheg.blogspot.com/2011/04/log4net-in-net-40-c-applications-net.html
This worked for me:
In the log4net source code, add a [SecurityCritical] attribute to the Util.ReadOnlyPropertiesDictionary.GetObjectData method and build.
There might be some other things you'll need to do to get it to build for the 4.0 framework.
See this post:
Weird override problem with Fluent NHibernate and .NET 4
I have fixed the similar issue by simply updating the Log4Net package from Visual Studio package manager.
Thanks,
Khachatur
I Fixed it by adding [assembly: System.Security.SecurityRules(System.Security.SecurityRuleSet.Level1)]
to log4net AssemblyInfo but now its not logging