We are trying to upgrade from CodeEffects 4.3.7.2 to 5. However, our existing rule xml fail when executing CodeEffects.Rule.Common.Xml.IsRuleValid. We are just loading the Xml into an XmlDocument and calling Xml.IsRuleValid. This is all existing and working code in CodeEffects 4. Below is the exception thrown.
Value cannot be null. Parameter name: input
at System.Xml.XmlReaderSettings.CreateReader(Stream input, Uri baseUri, String baseUriString, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(Stream input, XmlReaderSettings settings, String baseUri)
at CodeEffects.Rule.Common.RuleXmlValidator.AddSchema(XmlSchemaSet schemas, String schemaName, Assembly assembly)
at CodeEffects.Rule.Common.RuleXmlValidator..ctor()
at CodeEffects.Rule.Common.Xml.IsRuleValid(XmlDocument ruleXml)
Here is a sample xml of a rule now failing in this check. "CustomerSince" and "SystemDate" are DateTime.
<?xml version="1.0" encoding="utf-8"?>
<codeeffects xmlns="http://codeeffects.com/schemas/rule/41" xmlns:ui="http://codeeffects.com/schemas/ui/4">
<rule id="ab686e3c-e896-420c-9f8b-5fd09943c939" webrule="4.3.2.71" utc="2016-12-16T07:49:18.9753" type="CompanyABC.Domain.ICustomer, CompanyABC.Domain.State, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" eval="true">
<definition>
<or>
<condition type="isNull">
<property name="CustomerSince" />
</condition>
<condition type="lessOrEqual">
<property name="CustomerSince" />
<property name="SystemDate" />
</condition>
</or>
</definition>
<format><lines /></format>
</rule>
</codeeffects>
I tried using the CodeEffects 5 Classic MVC Rule Editor and generated the below Xml but I still see the same error.
<?xml version="1.0" encoding="utf-8"?>
<codeeffects xmlns="http://codeeffects.com/schemas/rule/41" xmlns:ui="http://codeeffects.com/schemas/ui/4">
<rule id="aecdeec9-9b06-4cb1-910d-8b62c311c72f" webrule="5.0.12.4" utc="2020-05-11T22:04:19.8510" type="CompanyABC.Domain.ICustomer, CompanyABC.Domain.State, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" eval="true">
<definition>
<or ui:block="true">
<condition type="isNull">
<property name="CustomerSince" />
</condition>
<condition type="lessOrEqual">
<property name="CustomerSince" />
<property name="SystemDate" />
</condition>
</or>
</definition>
<format><lines /></format>
</rule>
</codeeffects>
We are using the following libraries from CodeEffects Downloader:
CodeEffects.Rule.Common.dll (5.0.4.2)
CodeEffects.Rule.Engine.Standard.dll (5.0.9.6)
And below from Nuget packages:
CodeEffects.Rule.Editor.Mvc.dll (5.0.12.4)
CodeEffects.Rule.Editor.Net.dll (5.0.12.4)
Any assistance would be appreciated.
This issue has been fixed in the latest minor version released earlier today.
We decided to migrate from SQL Server Compact to SQL Server Express (possibly LocalDB) as Compact is no longer supported and we believe Express is more feature rich and likely performs better.
I made the changes necessary (although clearly missed something :) ) and the database is recreated as an .mdf file. The problem seems to be when the database is accessed. I get the error I have pasted below. The upshot is that somehow, somewhere I seem to have a reference to a provider with invariant name System.Data.SqlServerCe.4.0 when I have no intention of doing so.
I have done research and found these two relevant posts, which are not fully answered:
MVC app erroring on SqlServerCe.4.0 provider after converting to Sql Express
and
Entity Framework using the wrong connection provider
I have tried deleting the migrations and have modified the app.config file. I have also deleted on references to SQL Server Compact from the project references. What else should I be looking at? I'm tearing my hair out over this one.
What other information can I provide?
Thanks,
Dave
P.S. Another way to ask the question would be pointing out that https://stackoverflow.com/users/183934/erikej commented in the links above:
"Obviously you reference sqlce somewhere, either in .settings or in code based configuration DbConfiguration class... – ErikEJ Sep 13 '14 at 6:09 "
Where are all possible places that Compact could be referenced?
Exception thrown: 'System.Data.DataException' in EntityFramework.dll
Exception thrown: 'System.Data.DataException' in mscorlib.dll
The thread 0x2df0 has exited with code 0 (0x0).
05.01.2017 21:50:50: Fatal [line: 18 StartupErrorViewModel -> .ctor()]: System.Data.DataException: An exception occurred while initializing the database. See the InnerException for details.
System.Data.Entity.Core.MetadataException: Schema specified is not valid. >
Errors:
(0,0) : error 0152: No Entity Framework provider found for the ADO.NET provider with invariant name 'System.Data.SqlServerCe.4.0'. Make sure the provider is registered in the 'entityFramework' section of the application config file. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.ThrowOnNonWarningErrors()
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader.LoadItems(IEnumerable1 xmlReaders, IEnumerable1 sourceFilePaths)
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection.Loader..ctor(IEnumerable1 xmlReaders, IEnumerable1 sourceFilePaths, Boolean throwOnError, IDbDependencyResolver resolver)
at System.DThe thread 0x6d84 has exited with code 0 (0x0).
ata.Entity.Core.Metadata.Edm.StoreItemCollection.Init(IEnumerable1 xmlReaders, IEnumerable1 filePaths, Boolean throwOnError, IDbDependencyResolver resolver, DbProviderManifest& providerManifest, DbProviderFactory& providerFactory, String& providerInvariantName, String& providerManifestToken, Memoizer2& cachedCTypeFunction)
at System.Data.Entity.Core.Metadata.Edm.StoreItemCollection..ctor(IEnumerable1 xmlReaders)
at System.Data.Entity.Utilities.XDocumentExtensions.GetStorageMappingItemCollection(XDocument model, DbProviderInfo& providerInfo)
at System.Data.Entity.Migrations.Infrastructure.EdmModelDiffer.Diff(XDocument sourceModel, XDocument targetModel, Lazy1 modificationCommandTreeGenerator, MigrationSqlGenerator migrationSqlGenerator, String sourceModelVersion, String targetModelVersion)
at System.Data.Entity.Internal.InternalContext.ModelMatches(VersionedModel model)
at System.Data.Entity.Internal.ModelCompatibilityChecker.CompatibleWithModel(InternalContext internalContext, ModelHashCalculator modelHashCalculator, Boolean throwIfNoMetadata, DatabaseExistenceState existenceState)
at System.Data.Entity.Internal.InternalContext.CompatibleWithModel(Boolean throwIfNoMetadata, DatabaseExistenceState existenceState)
at System.Data.Entity.CreateDatabaseIfNotExists1.InitializeDatabase(TContext context)
at System.Data.Entity.Internal.InternalContext.<>c__DisplayClassf1.<CreateInitializationAction>b__e()
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
--- End of inner exception stack trace ---
at System.Data.Entity.Internal.InternalContext.PerformInitializationAction(Action action)
at System.Data.Entity.Internal.InternalContext.PerformDatabaseInitialization()
at System.Data.Entity.Internal.LazyInternalContext.<InitializeDatabase>b__4(InternalContext c)
at System.Data.Entity.Internal.RetryAction1.PerformAction(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabaseAction(Action1 action)
at System.Data.Entity.Internal.LazyInternalContext.InitializeDatabase()
at System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType)
at System.Data.Entity.Internal.Linq.InternalSet1.Initialize()
at System.Data.Entity.Internal.Linq.InternalSet1.GetEnumerator()
at System.Data.Entity.Infrastructure.DbQuery1.System.Collections.Generic.IEnumerable.GetEnumerator()
at System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source)
at Med.Vax.DataAccess.Repositories.LocalDbRepository1.GetAll() in C:\MedRepo\vax-box-sw\App\DataAccess\Repositories\LocalDbRepository.cs:line 68
at Med.Vax.App.d__28.MoveNext() in C:\MedRepo\vax-box-sw\App\App\App.xaml.cs:line 198
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task ta'Vax.exe' (CLR v4.0.30319: Vax.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'Vax.exe' (CLR v4.0.30319: Vax.exe): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemCore\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemCore.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
sk)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at Med.Vax.App.d__30.MoveNext() in C:\MedRepo\vax-box-sw\App\App\App.xaml.cs:line 503
ADDITIONAL INFO BASED ON COMMENTS
There are two app.config files, and perhaps this is part of the problem. One in the main app part, and one in the data access layer. Notice the code that is commented out with <!-- --> I asssume this is perfectly fine to do as these are just xml files?
Here's the one in the main app:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="TruMed.AccuVax.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<appSettings>
<add key="LoggingVerbosity" value="Debug" />
<add key="StartMaximized" value="True" />
<add key="AllowMultipleInstances" value="False" />
<add key="ScreenSaverTimeoutSeconds" value="60" />
<add key="TranslationFile" value="Translation\TranslationData.xml" />
<add key="SoftwareUpgradeDirectory" value="C:\TruMed\SoftwareUpgrade" />
<add key="FirmwareUpgradeDirectory" value="C:\TruMed\FirmwareUpgrade" />
<add key="PerformDatabaseMaintenance" value="False" />
<add key="AWSRegion" value="us-west-2"/>
<add key="AWSProfilesLocation" value="C:\TruMed\AccuVax\credentials"/>
</appSettings>
<!--
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
-->
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
<userSettings>
<TruMed.AccuVax.Properties.Settings>
<setting name="RobotZParkingLocation" serializeAs="String">
<value>0</value>
</setting>
</TruMed.AccuVax.Properties.Settings>
</userSettings>
</configuration>
and here is the one from the data access layer:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
</configSections>
<!--
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
<parameters>
<parameter value="System.Data.SqlServerCe.4.0" />
</parameters>
</defaultConnectionFactory>
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0" />
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
</DbProviderFactories>
</system.data>
-->
<entityFramework>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
</providers>
</entityFramework>
</configuration>
Except for the commented out sections, I do not believe I am mentioning SQL Server Compact!
ADDITIONAL INFO IN RESPONSE TO COMMENTS 2
The configuration string used is pulled from a .json file and looks like this:
LocalDbConnection:
Server=(LocalDB)\\MSSQLLocalDB;Integrated Security=true;Initial Catalog=Vax3
Previously I was using:
Data Source=C:\ProgramData\TruMed\AccuVax\AccuVax.sdf;
Clearly there is some concern I'm using the wrong connection string and/or adapter as I'm getting messages about SQL Server Compact. I have searched the code for AccuVax.sdf and have not found any instances. Again, database is created no problem; the problem seems to be accessing it.
We also had the same problem. We tried to migrate from SQL Compact to SQL Express. We chased and removed any reference to SQL Compact in the solution but that was not enough.
Our final move was to clean completely the solution (any visual studio that are not needed to open the solution):
remove obj, debug, release...
remove .vs folder (that's probably the one)
Finally we reopened the solution, tried again and got it work.
Hope it helps.
I have installed the following NuGets : Specflow.Nunit,specflow ,Specrun.Nunit along with NUnit 2.6.3.
I am trying to execute runtests.cmd(automatically generated by specrun.nunit) but I am getting the following error :
TechTalk.SpecRun.Framework.SpecRunException: At least one test thread aborted. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.MissingMethodException: Method not found: 'Void TechTalk.SpecRun.SpecRunner.Initialize()'.
My default.srprofile contains :
<?xml version="1.0" encoding="utf-8"?>
<TestProfile xmlns="http://www.specrun.com/schemas/2011/09/TestProfile">
<Settings projectName="<PROJECTNAME>" projectId="{------}" />
<Execution stopAfterFailures="3" testThreadCount="2" testSchedulingMode="Sequential" />
<!-- For collecting by a SpecRun server update and enable the following element. For using the
collected statistics, set testSchedulingMode="Adaptive" attribute on the <Execution> element.
<Server serverUrl="http://specrunserver:6365" publishResults="true" />
-->
<TestAssemblyPaths>
<TestAssemblyPath>projectname.dll</TestAssemblyPath>
</TestAssemblyPaths>
<DeploymentTransformation>
<Steps>`enter code here`
<!-- sample config transform to change the connection string-->
<!--<ConfigFileTransformation configFile="App.config">
<Transformation>
<![CDATA[<?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<connectionStrings>
<add name="MyDatabase" connectionString="Data Source=.;Initial Catalog=MyDatabaseForTesting;Integrated Security=True"
xdt:Locator="Match(name)" xdt:Transform="SetAttributes(connectionString)" />
</connectionStrings>
</configuration>
]]>
</Transformation>
</ConfigFileTransformation>-->
</Steps>
</DeploymentTransformation>
</TestProfile>
Also on the VS Output window I am getting this error :
Could not load file or assembly 'TechTalk.SpecRun, Version=1.3.0.76, Culture=neutral, PublicKeyToken=d0fc5cc18b3b389b' or one of its dependencies. The system cannot find the file specified.
Can someone please help me with this ?
You would to change this strings:
<RelocateConfigurationFile target="CustomConfig.{TestThreadId}.config" />
<ConfigFileTransformation configFile="App.config">
Full answer:
https://github.com/techtalk/SpecFlow/issues/954
I'm unable to get Azure Diagnostics to spit out any of my Trace messages - even in the near-as-is VS2012 project template. Here is what I did:
In an empty VS2012, created a new Cloud project (called it "Azure.Diag")
In the wizards next step, added the default template for "WCF Service Web Role" (called it "WCFService.WebRole")
Editted Web.Config to enable Diagnostics (details below)
Editted WebRole.cs to spit a Diagnostic Trace message (details below)
Ran it locally in Azure Emulator (ServiceConfiguration.Local.cscfg: Diagnostics.ConnectionString is "UseDevelopmentStorage=true")
Look at C:\Users\<Username>\AppData\Local\dftmp\Resources\<Instance GUID>\directory\WCFService.WebRole.svclog => see nothing!
There is also nothing in the Local Storage Blog either (not surprising given the folder before move-to-blob is empty)
How can I get this working? I'm trying to avoid my own handwritten .txt logs to leverage the in built trace listener framework (and parsing tools).
WebRole.cs
using System.Diagnostics;
namespace WCFService.WebRole
{
public class WebRole : RoleEntryPoint
{
public override bool OnStart()
{
// To enable the AzureLocalStorageTraceListner, uncomment relevent section in the web.config
DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
diagnosticConfig.Directories.DataSources.Add(AzureLocalStorageTraceListener.GetLogDirectory());
string message = "Houston, tracing is broken!";
Trace.TraceError(message);
Trace.TraceInformation(message);
Trace.TraceWarning(message);
Trace.WriteLine(message);
return base.OnStart();
}
}
}
Web.Config:
I used the standard template one but uncommented the top portion (had to merge the two system.diagnostic portions to avoid HTTP 500)
<system.diagnostics>
<sharedListeners>
<add name="AzureLocalStorage" type="WCFService.WebRole.AzureLocalStorageTraceListener, WCFService.WebRole" />
</sharedListeners>
<!--<sources>
<source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
</sources>-->
<trace autoflush="true">
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.7.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
Here is my class declaration:
public class XmlMembershipProvider : MembershipProvider
{....}
and my web.config snipit:
<membership defaultProvider="CustomXmlMembershipProvider">
<providers>
<add name ="CustomXmlMembershipProvider" type="XmlMembershipProvider" xmlFilePath="App_Data\Userstore.xml"/> .....
I am not sure what to do from this point. I have done a ton of google searching but cannot find out why I am getting the following error:
Parser Error Message: Could not load type 'XmlMembershipProvider'.
The type string should also include the assembly name that contains the XmlMembershipProvider.
<add name="..." type="XmlMembershipprovider, MyAssembly" .../>
Only adding the reference to the assembly (as below) still gave errors, although it is a step in the right direction:
<add name="..." type="XmlMembershipprovider, MyAssembly" .../>
I found that the fully qualified reference to the assembly should ALSO be added as follows:
<add name="..." type="MyAssembly.XmlMembershipprovider, MyAssembly" .../>
Now it works.