Error Create ASP.net MVC Razor Project - mono

I am trying to create a razor MVC project
When creating an error occurs, already I searched but found nothing
This is the error
An error occurred while applying transformation to 'Web.config' in project 'teste2': Argument cannot be null.
Parameter name: key
The log:
System.IO.InvalidDataException: An error occurred while applying transformation to 'Web.config' in project 'teste2': Argument cannot be null.
Parameter name: key ---> Microsoft.Web.XmlTransform.XmlNodeException: Argument cannot be null.
Parameter name: key ---> System.ArgumentNullException: Argument cannot be null.
Parameter name: key
at System.Xml.NameTable.Add (System.String key) [0x00000] in <filename unknown>:0
at System.Xml.XmlAttribute.set_Prefix (System.String value) [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.XmlElementContext.ScrubTransformAttributesAndNamespaces (System.Xml.XmlNode node) [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.XmlElementContext.ScrubTransformAttributesAndNamespaces (System.Xml.XmlNode node) [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.XmlElementContext.CreateCloneInTargetDocument (System.Xml.XmlNode sourceNode) [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.XmlElementContext.get_TransformNode () [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.Transform.get_TransformNode () [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.Insert.Apply () [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.Transform.ApplyOnce () [0x00000] in <filename unknown>:0
at Microsoft.Web.XmlTransform.Transform.Execute (Microsoft.Web.XmlTransform.XmlElementContext context, System.String argumentString) [0x00000] in <filename unknown>:0
--- End of inner exception stack trace ---
Anyone have any idea what's going on?
I am using Ubuntu 15.10
Thank you
[EDIT]
I could solve the problem by installing the package mono-devel according to here

I could solve the problem by installing the package mono-devel according to here

Related

Specflow - GenerateFeatureFileCodeBehindTask has failed unexpectedly

I have a problem with SpecFlow. We are using Azure Devops and when I build solution on my local machine it works perfectly but during Azure Devops build I am getting following error:
[error]C:\Windows\ServiceProfiles\NetworkService\.nuget\packages\specflow.tools.msbuild.generation\3.1.86\build\SpecFlow.Tools.MsBuild.Generation.targets(93,5): Error MSB4018: The "GenerateFeatureFileCodeBehindTask" task failed unexpectedly.
System.IO.FileNotFoundException: Could not load file or assembly 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'. The system cannot find the file specified.
File name: 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'
at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttributes(Assembly element, Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType, Boolean inherit)
at System.Attribute.GetCustomAttribute(Assembly element, Type attributeType)
at TechTalk.SpecFlow.Generator.Plugins.GeneratorPluginLoader.LoadPlugin(PluginDescriptor pluginDescriptor)
at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.LoadPlugins(ObjectContainer container, GeneratorPluginEvents generatorPluginEvents, UnitTestProviderConfiguration unitTestProviderConfiguration, IEnumerable`1 generatorPlugins)
at TechTalk.SpecFlow.Generator.GeneratorContainerBuilder.CreateContainer(SpecFlowConfigurationHolder configurationHolder, ProjectSettings projectSettings, IEnumerable`1 generatorPluginInfos, IObjectContainer parentObjectContainer)
at SpecFlow.Tools.MsBuild.Generation.WrappedGeneratorContainerBuilder.BuildGeneratorContainer(SpecFlowConfigurationHolder specFlowConfigurationHolder, ProjectSettings projectSettings, IReadOnlyCollection`1 generatorPluginInfos, IObjectContainer rootObjectContainer)
at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTaskExecutor.Execute()
at SpecFlow.Tools.MsBuild.Generation.GenerateFeatureFileCodeBehindTask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
<PackageReference Include="FluentAssertions" Version="5.10.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.1.0" />
<PackageReference Include="MSTest.TestFramework" Version="2.1.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="Selenium.Support" Version="3.141.0" />
<PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
<PackageReference Include="SpecFlow" Version="3.1.86" />
<PackageReference Include="SpecFlow.MsTest" Version="3.1.86" />
<PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.1.86" />
I have tried using it with nUnit, MsTest, xUnit and it alway fails.
Target framework: .NET Core 3.1.
Build agent: vs2019-win2019
We've encountered same problem, after longer digging I found that there is an issue created for this in their git repo https://github.com/SpecFlowOSS/SpecFlow/issues/1912.
Quoting from git issue:
MSBuild 16.5 has a new assembly loading approach for tasks that may have side effects. (which has been an ask for years, but it behaves a bit differently when loading dependencies)
You can try to set MSBUILDSINGLELOADCONTEXT=1 (env var) to get the old behavior.
Try to set it in your build pipeline as:
variables:
...
MSBUILDSINGLELOADCONTEXT: '1'
...
This helped in our case.
EDIT:
This issue seems to be fixed in newer version of SpecFlow (3.3.15+).
Had the same problem for SpecFlow 3.4.8 after migration from SpecFlow 2.
Since After version SpecFlow 3.3.30 don’t need to add the SpecFlow.Tools.MSBuild.Generation package anymore
so i have removed SpecFlow.Tools.MSBuild.Generation package, however issue still there.
After that i have added specflow.json to test project and issue gone
Had the same problem, turned out that it was version issues between .net core SDK and Specflow. We downgraded .net core sdk to 3.1.102 and that helped
Uninstalling and reinstalling specflow and SpecFlow.Tools.MsBuild.Generation worked for me
I had this issue after specflow runner installation. Removing it solved the problem
The error message says:
Could not load file or assembly 'TechTalk.SpecFlow, Version=3.1.0.0, Culture=neutral, PublicKeyToken=0778194805d6db41'. The system cannot find the file specified.
File name: 'TechTalk.SpecFlow, Version=3.1.0.0
You have SpecFlow v3.1.86 installed. I would expect it to be loading TechTalk.SpecFlow 3.1.86, which matches the NuGet package version.
Either:
Uninstall and reinstall the SpecFlow package using the Package Manager Console:
uninstall-package SpecFlow -force -project NameOfYourTestProject
install-package SpecFlow -version 3.1.86 -project NameOfYourTestProject
Edit the .csproj file for your test project and ensure the <Reference> element importing the DLL file is pointing to the correct file
<Reference Include="TechTalk.SpecFlow, Version=3.0.0.0, Culture=neutral, PublicKeyToken=..., processorArchitecture=MSIL">
<HintPath>..\packages\SpecFlow.3.1.86\lib\FRAMEWORK_VERSION\TechTalk.SpecFlow.dll</HintPath>
</Reference>
Note: Replace FRAMEWORK_VERSION with net45, netstandard2.0, etc depending on the .NET framework version of your test project.
You can always open Windows File Explorer and browse to the DLL file in order to discover the correct path.
Last ditch effort, try restoring NuGet packages manually from the command line, assuming you have NuGet.exe available in your %PATH% (See https://learn.microsoft.com/en-us/nuget/install-nuget-client-tools for more info)
nuget restore Path/To/YourSolution.sln
So glad this post exists. The tests would run on my machine but not in azure pipeline.
I upgraded to the latest specflow and SpecFlow.NUnit and this solved the issue ... updated from 3.7.13 to 3.9.8. I don't understand but glad it worked.

Monogame missing method exception with monodevelop

I have follow the installation guide in here but it seems don't working for me. Here is the exception message when I run the program:
System.MissingMethodException has been thrown
Method not found: 'OpenTK.NativeWindow.set_CursorVisible'.
System.MissingMethodException: Method not found: 'OpenTK.NativeWindow.set_CursorVisible'.
at Microsoft.Xna.Framework.GamePlatform.set_IsMouseVisible (Boolean value) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.OpenTKGamePlatform..ctor (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.GamePlatform.Create (Microsoft.Xna.Framework.Game game) [0x00000] in <filename unknown>:0
at Microsoft.Xna.Framework.Game..ctor () [0x00000] in <filename unknown>:0
at testing.Game1..ctor () [0x00000] in <filename unknown>:0
at testing.Program.Main () [0x00000] in /home/user/testing/testing/Program.cs:20
You can just install using the installer available here http://monogame.codeplex.com/releases/view/102870
Then create a new project from Visual Studio
I solved the problem by download monodevelop-monogame dependencies.

NHibernate 3.3 and SysCache

The current version of SysCache does not appear to work with NHibernate 3.3. I replaced the NHibernate dlls in my web/bin directory and left the SysCache dll (which works with 3.2) untouched. Now when IIS tries to do a pre-bind it loads the SysCache dll and tries to bind it to NHibernate 3.2.0.4000 and fails.
[FileLoadException: Could not load file or assembly 'NHibernate,
Version=3.2.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4'
or one of its dependencies. The located assembly's manifest definition
does not match the assembly reference. (Exception from HRESULT:
0x80131040)] System.RuntimeTypeHandle.GetTypeByName(String name,
Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName,
ObjectHandleOnStack type) +0
System.RuntimeTypeHandle.GetTypeByName(String name, Boolean
throwOnError, Boolean ignoreCase, Boolean reflectionOnly,
StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +95
System.RuntimeType.GetType(String typeName, Boolean throwOnError,
Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
+54 System.Type.GetType(String typeName) +50 NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName
name, Boolean throwOnError) +338
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary`2
properties) +175
[HibernateException: could not instantiate CacheProvider:
NHibernate.Caches.SysCache.SysCacheProvider,
NHibernate.Caches.SysCache]
NHibernate.Cfg.SettingsFactory.CreateCacheProvider(IDictionary2
properties) +256
NHibernate.Cfg.SettingsFactory.BuildSettings(IDictionary2 properties)
+3449 NHibernate.Cfg.Configuration.BuildSettings() +29 NHibernate.Cfg.Configuration.BuildSessionFactory() +44
If I comment out the configuration in the web.config all is well:
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache" >true</property>
<property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
The download site for NHibernate caches at NHibernate Contrib does not have a download for the latest version.
A different and slightly simpler approach is to override the reference to the 3.2 version of NHibernate in your web.config or app.config with a reference to the desired version 3.3 like so:
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="NHibernate" culture="neutral" publicKeyToken="aa95f207798dfdb4" />
<bindingRedirect newVersion="3.3.0.4000" oldVersion="0.0.0.0-3.3.0.4000" />
</dependentAssembly>
</assemblyBinding>
</runtime>
I've just tried this myself and it works as expected.
The issue probably is that the SysCache Dll is built using NHibernate 3.2.0 and it is not compatible with NHibernate 3.3.0. An easy way around this is to checkout the trunk of the nhibernate config project or the Cache solution only from https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Caches
update the NHibernate reference to use the version that you are using and then rebuild and use the latest cache dlls. Since its a minor upgrade there shouldnt be any code changes required and you should be safe.
Try it and let me know how it goes.

NHibernate under SharePoint 2010

I am having trouble getting NHibernate up and running under SharePoint 2010.
My config code works as I have an integration test project running fine.
The problem is to do with gac assemblies and NHibernate references resulting in this error:
[FileNotFoundException: Could not load file or assembly 'NHibernate.ByteCode.Castle' or one of its dependencies. The system cannot find the file specified.]
System.Reflection.Assembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection) +0
System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +416
System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +166
System.Reflection.Assembly.Load(String assemblyString) +35
NHibernate.Util.ReflectHelper.TypeFromAssembly(AssemblyQualifiedTypeName name, Boolean throwOnError) +641
NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String typeName) +67
[UnableToLoadProxyFactoryFactoryException: Unable to load type 'NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle' during configuration of proxy factory class.
Possible causes are:
- The NHibernate.Bytecode provider assembly was not deployed.
- The typeName used to initialize the 'proxyfactory.factory_class' property of the session-factory section is not well formed.
Solution:
Confirm that your deployment folder contains one of the following assemblies:
NHibernate.ByteCode.LinFu.dll
NHibernate.ByteCode.Castle.dll]
NHibernate.Bytecode.AbstractBytecodeProvider.SetProxyFactoryFactory(String typeName) +336
NHibernate.Cfg.Configuration.ConfigureProxyFactoryFactory() +179
NHibernate.Cfg.Configuration.BuildSessionFactory() +23
FluentNHibernate.Cfg.FluentConfiguration.BuildSessionFactory() +50
FYI, NHibernate.ByteCode.Castle is registered in the gac. I also have these two item in web.config:
<compilation batch="false" debug="true">
<assemblies>
<add assembly="NHibernate.ByteCode.Castle, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4" />
....
&
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="NHibernate.ByteCode.Castle, Version=3.1.0.4000, Culture=neutral" fullName="NHibernate.ByteCode.Castle, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4" />
...
Any clues as to the extra wiring required?
The "or one of its dependencies" remark might be worth further investigation. Get Dependency Walker and check whether NHibernate.ByteCode.Castle.dll depends on anything else, and if it does, whether it's in the GAC or not.
this was the key bit, not specifying culture or version in the partialName:
<qualifyAssembly partialName="NHibernate.ByteCode.Castle" fullName="NHibernate.ByteCode.Castle, Version=3.1.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4" />
did the trick

RhinoMocks breaking the compiler in recent versions of Mono / MonoDevelop

I'm not sure exactly what broke this as I've been sporadic with my Mono/Monotouch development, but I believe it's the latest update to the mono framework. All of a sudden building my Unit Test project (which itself is a MonoTouch Library project) now breaks the compiler and it seems to be the RhinoMocks DLL (removing the reference fixes it). It looks like the RM DLL is referencing the wrong System DLL (not the MT one) but what is confusing is why this never broke before and my tests used to run fine.
I've put a simple sample SLN up on Github that reproduces the error:
https://github.com/briandonahue/MonoIssue
And here is the build ouput:
Building: Sample (Debug|iPhoneSimulator)
Building Solution Sample
Building: Test (Debug|iPhoneSimulator)
Performing main compilation...
/Developer/MonoTouch/usr/bin/smcs /noconfig "/out:/Users/brian/development/Sample/Test/bin/iPhoneSimulator/Debug/Test.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" "/r:/Users/brian/development/Sample/lib/Rhino.Mocks.dll" /nologo /warn:4 /debug:+ /debug:full /optimize- /codepage:utf8 "/define:DEBUG" /t:library "/Users/brian/development/Sample/Test/Test.cs"
The class System.Diagnostics.EventLog could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089The class System.Diagnostics.TraceSource could not be loaded, used in System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Unhandled Exception: System.Reflection.ReflectionTypeLoadException: The classes in the module cannot be loaded.
at (wrapper managed-to-native) System.Reflection.Assembly:GetTypes (bool)
at System.Reflection.Assembly.GetTypes () [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespaces (System.Reflection.Assembly assembly, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.RootNamespace.ComputeNamespace (Mono.CSharp.CompilerContext ctx, System.Type extensionType) [0x00000] in <filename unknown>:0
at Mono.CSharp.GlobalRootNamespace.ComputeNamespaces (Mono.CSharp.CompilerContext ctx) [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.LoadReferences () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Compile () [0x00000] in <filename unknown>:0
at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] in <filename unknown>:0
Build complete -- 1 error, 0 warnings
---------------------- Done ----------------------
Build: 1 error, 0 warnings
Seeing the same thing with mono 2.10.1 and monotouch 4.0 on the simulator. But only when Linker options are set to link all assemblies.
Works fine with Linker options set to don't link or Link SDK assemblies only.
It was mentioned that the compiler has been enhanced in latest Mono release, so I guess now the compiler can tell you "well, I just find out I should report this as an error". :)
Same problem here. You do have to Link SDK assemblies in order to run it on the device. So, if this issue is not resolved, your app won't work.