Does LiteDB support long file names (>=260 char) in the connection string - system.io.file

Im using litedb as a file index, whereby I recreate the directory structure of a file share and drop a litedb.db file into each directory in my hierarchy. The problem I'm encountering seems to be where the directory structure is more than 260 characters long (see error message below). Is there a way to enable support for long file names in the connections string when connecting to litedb? Alternatively is there a way to instantiate my instance of litedb using some other approach (such as a file.open AlphaFS).
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\......\Some deep directory which is 260+ characters long\index.db'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at LiteDB.FileDiskService.Initialize(Logger log, String password)
at LiteDB.LiteEngine..ctor(IDiskService disk, String password, Nullable`1 timeout, Int32 cacheSize, Logger log, Boolean utcDate)
at LiteDB.LiteDatabase.<>c__DisplayClass11_0.<.ctor>b__0()
at LiteDB.LazyLoad`1.get_Value()
at LiteDB.LiteCollection`1.EnsureIndex(String field, String expression, Boolean unique)
at LiteDB.LiteCollection`1.EnsureIndex[K](Expression`1 property, Boolean unique)

LiteDB uses FileStream ctor to open data file, so it's could be a problem with long paths. But, you can use Stream as initializer to you database, so you can open in any platform.

Related

Slow Save in Entity Framework, very specific entity

I have a very interesting (and confusing) issue for quite a while, but cannot get to the bottom of it
I have a WPF Project built on Entity Framework, with about 100 different entities/tables, which all work smoothly. except for one entity type, named SaleProduct
Saving a SaleProduct takes about 5 minutes, sometimes even more (other entities take under 2 seconds usually). And only in the window.
For testing purposes, I put this code in app startup:
Using d = GetSystemContext(True)
Dim sp = d.Find(Of SaleProduct)(66246)
sp.DiscountAmount += 1
d.SaveChanges()
End Using
And saving there is OK(11 seconds, bearable).
But when I open a window with the SaleProduct as the DataContext and save there, it takes several minutes.
So, I would like to debug this. Maybe I have some bad code somewhere. But I'm not managing with this either. If I press pause in Visual Studio while the app is stuck saving, it freezes on the SaveChanges line, meaning not some custom code. So what difference should it make if we are in the app startup or in the window?
But lets take this a step further, I disabled Just My Code to get a better picture of whats freezing. And it gets stuck here:
InternalDispatcher.cs
try
{
interceptionContext.MutableData.SetExecuted(operation(target, interceptionContext));
}
Where the target is a pretty simple SQL statement
UPDATE [dbo].[Sales]
SET [LastEditedOn] = #0
WHERE ([ID] = #1)
SELECT [AutoPurchaseDate], [GrantingDate], [ReceivedOn], [Name], [TotalVatRate]
FROM [dbo].[Sales]
WHERE ##ROWCOUNT > 0 AND [ID] = #1
Running this in SSMS takes <1 seconds.
But looking at the complete call stack I see that actually its stuck someplace in System.Data.dll. Though try as I might I cant find its .pdb.
So I tried to use decompile, but I get an error
Unable to compile the module
Even though, in the modules window the status is "Symbols loaded".
So I cannot pinpoint precisely.
For kicks, I tried upgrading to .net 4.8 (from 4.7). same problem.
What can I do? How to proceed? Where more can I Investigate?
NOTES
Tables Sales and SaleProducts both have Clustered Primary Keys.
Running SELECT * FROM sys.sysprocesses WHERE open_tran = 1 in SSMS while the code is stuck, returns 0 rows.
InSaveChanges, ChangeTracker.Entries returns precisely 2 entities. The SaleProduct, and its parent Sale.
I've posted a Profiler Trace here https://pastebin.com/enLgE0Ln
Here's the full StackTrace if it might help someone
[Managed to Native Transition]
System.Data.dll!SNINativeMethodWrapper.SNIReadSyncOverAsync(System.Runtime.InteropServices.SafeHandle pConn, ref System.IntPtr packet, int timeout) Unknown
System.Data.dll!System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync() Unknown
System.Data.dll!System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket() Unknown
System.Data.dll!System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer() Unknown
System.Data.dll!System.Data.SqlClient.TdsParserStateObject.TryReadByte(out byte value) Unknown
System.Data.dll!System.Data.SqlClient.TdsParser.TryRun(System.Data.SqlClient.RunBehavior runBehavior, System.Data.SqlClient.SqlCommand cmdHandler, System.Data.SqlClient.SqlDataReader dataStream, System.Data.SqlClient.BulkCopySimpleResultSet bulkCopyHandler, System.Data.SqlClient.TdsParserStateObject stateObj, out bool dataReady) Unknown
System.Data.dll!System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() Unknown
System.Data.dll!System.Data.SqlClient.SqlDataReader.MetaData.get() Unknown
System.Data.dll!System.Data.SqlClient.SqlCommand.FinishExecuteReader(System.Data.SqlClient.SqlDataReader ds, System.Data.SqlClient.RunBehavior runBehavior, string resetOptionsString, bool isInternal, bool forDescribeParameterEncryption, bool shouldCacheForAlwaysEncrypted) Unknown
System.Data.dll!System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(System.Data.CommandBehavior cmdBehavior, System.Data.SqlClient.RunBehavior runBehavior, bool returnStream, bool async, int timeout, out System.Threading.Tasks.Task task, bool asyncWrite, bool inRetry, System.Data.SqlClient.SqlDataReader ds, bool describeParameterEncryptionRequest) Unknown
System.Data.dll!System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior cmdBehavior, System.Data.SqlClient.RunBehavior runBehavior, bool returnStream, string method, System.Threading.Tasks.TaskCompletionSource<object> completion, int timeout, out System.Threading.Tasks.Task task, out bool usedCache, bool asyncWrite, bool inRetry) Unknown
System.Data.dll!System.Data.SqlClient.SqlCommand.RunExecuteReader(System.Data.CommandBehavior cmdBehavior, System.Data.SqlClient.RunBehavior runBehavior, bool returnStream, string method) Unknown
System.Data.dll!System.Data.SqlClient.SqlCommand.ExecuteReader(System.Data.CommandBehavior behavior, string method) Unknown
> EntityFramework.dll!System.Data.Entity.Infrastructure.Interception.InternalDispatcher<System.Data.Entity.Infrastructure.Interception.IDbCommandInterceptor>.Dispatch<System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext<System.Data.Common.DbDataReader>, System.Data.Common.DbDataReader>(System.Data.Common.DbCommand target, System.Func<System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext<System.Data.Common.DbDataReader>, System.Data.Common.DbDataReader> operation, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext<System.Data.Common.DbDataReader> interceptionContext, System.Action<System.Data.Entity.Infrastructure.Interception.IDbCommandInterceptor, System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext<System.Data.Common.DbDataReader>> executing, System.Action<System.Data.Entity.Infrastructure.Interception.IDbCommandInterceptor, System.Data.Common.DbCommand, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext<System.Data.Common.DbDataReader>> executed) Line 138 C#
EntityFramework.dll!System.Data.Entity.Infrastructure.Interception.DbCommandDispatcher.Reader(System.Data.Common.DbCommand command, System.Data.Entity.Infrastructure.Interception.DbCommandInterceptionContext interceptionContext) Line 103 C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.Update.Internal.DynamicUpdateCommand.Execute(System.Collections.Generic.Dictionary<int, object> identifierValues, System.Collections.Generic.List<System.Collections.Generic.KeyValuePair<System.Data.Entity.Core.Mapping.Update.Internal.PropagatorResult, object>> generatedValues) Line 118 C#
EntityFramework.dll!System.Data.Entity.Core.Mapping.Update.Internal.UpdateTranslator.Update() Line 532 C#
EntityFramework.dll!System.Data.Entity.Core.Objects.ObjectContext.ExecuteInTransaction<int>(System.Func<int> func, System.Data.Entity.Infrastructure.IDbExecutionStrategy executionStrategy, bool startLocalTransaction, bool releaseConnectionOnSuccess) Line 2203 C#
EntityFramework.dll!System.Data.Entity.Core.Objects.ObjectContext.SaveChangesToStore(System.Data.Entity.Core.Objects.SaveOptions options, System.Data.Entity.Infrastructure.IDbExecutionStrategy executionStrategy, bool startLocalTransaction) Line 2148 C#
EntityFramework.SqlServer.dll!System.Data.Entity.SqlServer.DefaultSqlExecutionStrategy.Execute<int>(System.Func<int> operation) Unknown
EntityFramework.dll!System.Data.Entity.Core.Objects.ObjectContext.SaveChangesInternal(System.Data.Entity.Core.Objects.SaveOptions options, bool executeInExistingTransaction) Line 2046 C#
EntityFramework.dll!System.Data.Entity.Internal.InternalContext.SaveChanges() Line 483 C#
Machshevet.dll!Machshevet.Core.RecordContext.SaveChanges() Line 762 Basic
Machshevet.dll!Machshevet.Windows.RecordWindow.Save() Line 169 Basic
Machshevet.dll!Machshevet.Windows.RecordWindow.<closure>.<lambda35-0>() Line 44 Basic
PresentationCore.dll!System.Windows.Input.CommandBinding.OnExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) Unknown
PresentationCore.dll!System.Windows.Input.CommandManager.ExecuteCommandBinding(object sender, System.Windows.Input.ExecutedRoutedEventArgs e, System.Windows.Input.CommandBinding commandBinding) Unknown
PresentationCore.dll!System.Windows.Input.CommandManager.FindCommandBinding(System.Windows.Input.CommandBindingCollection commandBindings, object sender, System.Windows.RoutedEventArgs e, System.Windows.Input.ICommand command, bool execute) Unknown
PresentationCore.dll!System.Windows.Input.CommandManager.FindCommandBinding(object sender, System.Windows.RoutedEventArgs e, System.Windows.Input.ICommand command, bool execute) Unknown
PresentationCore.dll!System.Windows.Input.CommandManager.OnExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) Unknown
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Unknown
PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) Unknown
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.Input.RoutedCommand.ExecuteImpl(object parameter, System.Windows.IInputElement target, bool userInitiated) Unknown
PresentationCore.dll!System.Windows.Input.CommandManager.TransferEvent(System.Windows.IInputElement newSource, System.Windows.Input.ExecutedRoutedEventArgs e) Unknown
PresentationCore.dll!System.Windows.Input.CommandManager.OnExecuted(object sender, System.Windows.Input.ExecutedRoutedEventArgs e) Unknown
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Unknown
PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) Unknown
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.Input.RoutedCommand.ExecuteImpl(object parameter, System.Windows.IInputElement target, bool userInitiated) Unknown
PresentationFramework.dll!MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource commandSource, bool userInitiated) Unknown
PresentationFramework.dll!System.Windows.Controls.Primitives.ButtonBase.OnClick() Unknown
PresentationFramework.dll!System.Windows.Controls.Button.OnClick() Unknown
System.Windows.Controls.Ribbon.dll!System.Windows.Controls.Ribbon.RibbonButton.OnClick() Unknown
PresentationFramework.dll!System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs e) Unknown
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Unknown
PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) Unknown
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Unknown
PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args, System.Windows.RoutedEvent newEvent) Unknown
PresentationCore.dll!System.Windows.UIElement.OnMouseUpThunk(object sender, System.Windows.Input.MouseButtonEventArgs e) Unknown
PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate handler, object target) Unknown
PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(object target, System.Windows.RoutedEventArgs routedEventArgs) Unknown
PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(object source, System.Windows.RoutedEventArgs args, bool reRaised) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender, System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) Unknown
PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea() Unknown
PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input) Unknown
PresentationCore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport) Unknown
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd, System.Windows.Input.InputMode mode, int timestamp, System.Windows.Input.RawMouseActions actions, int x, int y, int wheel) Unknown
PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd, MS.Internal.Interop.WindowMessage msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback, object args, int numArgs) Unknown
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source, System.Delegate callback, object args, int numArgs, System.Delegate catchHandler) Unknown
WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, int numArgs) Unknown
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam) Unknown
[Native to Managed Transition]
[Managed to Native Transition]
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame) Unknown
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) Unknown
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) Unknown
The specific answer to this issue will require seeing the specific code responsible. It likely is not an issue with a single table beyond the relationships that table has defined within the DbContext and database schema, and the current state of what the DbContext is tracking. (And what the Database might be locking, though that is usually a more intermittent type of problem)
Some things to check:
In your App example, you appear to be getting a fresh instance of the DbContext and disposing it. (Good) Does the 11s time reflect the Find+Save, or just Save? The very first query that a DbContext executes in an application incurs a 1-off (think Static) spin-up cost to initialize the model. For a more accurate timing with a first run scenario, you could do something like:
Using d = GetSystemContext(True)
Dim dump = d.Sales.Any()
' Start timing here...
Dim sp = d.Find(Of SaleProduct)(66246)
sp.DiscountAmount += 1
d.SaveChanges()
' End timing here...
End Using
*Sorry, my VB.Net is sadly out of date.. :) In any case, using a quick operation against the DbContext like an Any() will incur the 1-off spin-up cost. Any operation after that should be a more pure representation of the time needed to load & save data.
In your problematic code, are DbContext's guaranteed to be short-lived like this? DbContexts that are alive longer accrue references to a number of entities and any time any entity is persisted, it will scour it's tree of entities to determine if any related ones may need to be updated. Short-lived, disposed DbContexts are the way to go.
Have you run a profiler against the database to capture the exact SQL being run? Your example SQL doesn't look like an EF query, and references a "Sales" table rather than "SalesProduct". Having a profiler running while debugging your EF application operations is invaluable for revealing stuff going on behind the scenes that you don't expect.
Other possibilities would really depend on the code in question, but a profiler combined with breakpoints will generally help spot issues. Is the delay confirmed to be just when DbContext.SaveChanges happens, or the whole save process? If it's something like from the time the user clicks a Save button, then a Profiler might reveal that your code is tripping a lot of lazy-load calls (loading data to check and update prior to saving) or loading unexpected data. (common issues I've seen are misplaced ToList() calls before filtering statements, usually because the devs want to do something that EF cannot translate and ToList() seems like a "fix") If the delay is just from SaveChanges then the profiler can confirm what Update statements and the like are being produced and how long they are taking to run.
In the end it seems that the error disappeared after a index rebuild. Even though I cant understand if it was an index issue, how come it worked flawlessly time and again via SSMS and EF without window. But for now its working just dandy. Thanks again for all posters, as you were extremely helpful in narrowing down and focusing.
Entity framework is slow , very slow
in production code you need to use c# SQL command

Peta poco - ExecuteReader requires an open and available Connection

In rare situations I experience some issues with petapoco.
Sometimes I get the following exception:
System.InvalidOperationException: ExecuteReader requires an open and available Connection. The connection's current state is connecting.
at System.Data.SqlClient.SqlConnection.GetOpenConnection(String method)
at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command)
at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at PetaPoco.Database.<Query>d__44`1.MoveNext()
I really dont know what to do about it. Has anyone seen this before? Any suggestions on why it happens and what to do about it?
I cannot reproduce it since it happens rarely(maybe 2-3% of the db calls)
I am using version 5.0.1 of petapoco.
Thanks! :)
EDIT:
I am using the following constructor to instantiate the Database:
public Database(string connectionString, string providerName)
{
_connectionString = connectionString;
_providerName = providerName;
CommonConstruct();
}
I am instantiating it as a singleton using dependency injection like below:
Container.Register(Component.For<IDatabase>().ImplementedBy<Database>().UsingFactoryMethod(() => new Database(configuration.ConnectionString, configuration.DbFactoryProvider)).LifestyleSingleton());
When I first read the post, I thought ah a threading bug. However, I didn't simply want to write it off, as such, without an explanation. FYI, any bug that is inconsistent like this in a web app, is most likely a threading bug.
Ok so why is it a threading bug. You're using PetaPoco as a singleton instance, which means one instance for the whole application. It works, mostly, because PetaPoco has internal smarts to know when to open/close a shared connection, and just by luck itself, the usages of PetaPoco aren't colliding, except 2-3% of the time.
In addition, there's an internal counter (smarts), which when zero will either create a new connection or close the existing one depending on the operation. Now given PetaPoco is not thread-safe, this internal counter could suffer form a threading related issue too, if two or more threads increment/de-increment the counter at the same time etc.
TDLR; In dotnet the general rule is to assume/make static methods thread-safe and everything else not thread-safe, excepted where clearly marked and where it makes sense. Your usage of PetaPoco would work if PetaPoco was thread-safe, but it is not. To fix this issue, create a new instance of PetaPoco for each request; a fairly cheap operation (more so with fluent configuration).
I see you're using PetaPoco 5.0.1, I suggest looking at the latest release as there's a new FluentConfiguration feature. And it just so happens that the documentation page for this feature, at the bottom of the page, has a sample container setup. I would suggest you check this out. Documentation
Happy PetaPoco'er'ing

Base-64 error when trying to execute vNext deployment script

Release Management 2013 writes "The input is not a valid Base-64 string" error message into the Application Event Log when it tries to execute my Power Shell DSC deployment script. Does anyone know what could be causing this error?
PS DSC Script:
$ConfigData = #{
AllNodes = #(
#{
NodeName = $env:COMPUTERNAME
}
)
}
Configuration WebAppServer
{
Node $AllNodes.NodeName
{
File WebApplicationFiles
{
Ensure = "Present"
Type = "Directory"
Recurse = $true
SourcePath = $applicationPath
DestinationPath = "C:\inetpub\wwwroot\Test"
}
}
}
WebAppServer -ConfigurationData $ConfigData
Error message from the Application Log:
Timestamp: 9/29/2015 5:19:32 PM
Message: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters. : \r\n\r\n at System.Convert.FromBase64_Decode(Char* startInputPtr, Int32 inputLength, Byte* startDestPtr, Int32 destLength)
at System.Convert.FromBase64CharPtr(Char* inputPtr, Int32 inputLength)
at System.Convert.FromBase64String(String s)
at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.GetDecryptedValue(String str, String containerName)
at Microsoft.TeamFoundation.Release.Data.Helpers.CryptoHelper.DecryptString(String str, String cryptoContainerName, String key, Encryption encryption)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.ReplaceConfigurationVariable(String content, Boolean isHideEncryptedVariable, String value, String token, Boolean isPassword)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.ReplaceConfigurationVariablesImplementation(String content, Boolean isHideEncryptedVariable)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.InstallComponentImplementation(Func`3 replaceConfigurationVariables, IDictionary`2 installers)
at Microsoft.TeamFoundation.Release.DeploymentAgent.Services.Deployer.ComponentProcessor.DeployComponent()
Category: General
Priority: -1
EventId: 0
Severity: Error
Title:
Machine: CAE-ATX-TFS01
Application Domain: ReleaseManagementMonitor.exe
Process Id: 1932
Process Name: D:\Program Files (x86)\Microsoft Visual Studio 12.0\Release Management\bin\ReleaseManagementMonitor.exe
Win32 Thread Id: 10148
Thread Name:
Extended Properties:
I've seen this in the past. When you enter the password, make sure the password asterisks (*****) changes in length to a really long value. That's the indication that it properly encrypted the password. I've seen cases where the encryption event doesn't fire for whatever reason.
You can work around it by saving the template, closing it, reopening it, then typing the password again.
Did you migrate your server or restore an older database?
Try re-entering the password (any encrypted value) in the vNext action in the release definition.
Release Management is trying to invoke the powershell action and is failing there, and it has nothing to do with your script. Possibly, the encrypted password field has been encrypted with a different key from what RM has now.

Can't add related entities in CRM 3.0

The story so far:
A couple weeks ago, a field completely disappeared from the AccountExtensionBase table but remained in the Account and FilteredAccount views. This caused the Main Info form in CRM itself (which draws from that table) to stop working completely.
To fix the above, I manually removed said field from the definitions of said views, and I edited the Main Info form to no longer reference the missing field.
That left in more-or-less working condition. The only thing that's still broken is adding related entities from an already-open Main Info form. When I try, it throws exception 0x80044150. After learning this, I manually removed the field from the METABASE database and manually removed all references to it in the OrganizationUIBase table. Nothing. CRM won't let me just recreate the field, and I also can't seem to convince it to actually write to the trace log so I can get any more information about what's going on. I know this sometimes comes up when you exceed the 2155 option limit for picklist fields within an entity, but I don't think that's it, because the first thing I tried when the original issue manifested itself was to remove two entire picklist fields that were no longer needed, and that clearly hasn't helped.
So any ideas about what could be causing this, or what I can do to fix it, or even what a possible next step might be? I'm kind of stumped here.
Edit: got the trace logging to work...
at ErrorInformation.LogError()
at ErrorInformation..ctor(Exception exception, Uri requestUrl)
at MainApplication.Application_Error(Object sender, EventArgs e)
at EventHandler.Invoke(Object sender, EventArgs e)
at HttpApplication.RaiseOnError()
at HttpApplication.RecordError(Exception error)
at HttpApplication.ResumeSteps(Exception error)
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
>MSCRM Platform Error Report:
Error: Exception of type System.Web.HttpUnhandledException was thrown.
Error Number: 0x80044150
Error Message: Exception from HRESULT: 0x80044150.
Error Details: Exception from HRESULT: 0x80044150.
Source File: Not available
Line Number: Not available
Request URL: http://crmserv/userdefined/edit.aspx?_CreateFromType=1&_CreateFromId={94892C13-A23E-DB11-BBF1-0014221C4264}&etc=10059
Stack Trace Info: Exception of type System.Web.HttpUnhandledException was thrown.
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain()
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at Microsoft.Crm.Platform.ComProxy.CRMCustomizationClass.Transform(CUserAuth& Caller, CObjectName& SourceObject, Int32 TargetObjectType, Int32 TargetFieldType)
at Microsoft.Crm.Application.Platform.Entity.CreateFrom(Int32 sourceEntityType, String sourceEntityId, TransformType transformType)
at Microsoft.Crm.Application.Forms.EndUserForm.PopulateDefaultDataIfAvailable()
at Microsoft.Crm.Application.Forms.EndUserForm.RetrieveParams()
at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity)
at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, String formId, String formType)
at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity)
at Microsoft.Crm.Application.Pages.UserDefined.DetailPage.ConfigureForm()
at Microsoft.Crm.Application.Controls.AppPage.OnPreRender(EventArgs e)
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain()
Type: Platform
This might be the more useful error report, actually. The above showed up twice, but this one is getting thrown scores of times every minute:
at User.GetPrivilege(String priv, PRIVILEGE_DEPTH depth)
at User.GetPrivilege(Int32 objectType, PrivilegeId privilegeId)
at AppMenuBar.BuildNewObjectMenu(Menu menuObject, Boolean buildAsSubMenu)
at AppFormMenuBar.BuildFileMenu(String formName)
at AppFormMenuBar.Execute(PrivilegeCheck privilegeCheck, String formName)
at AppFormMenuBar.Execute(PrivilegeCheck privilegeCheck)
at AccountDetailPage.ConfigureMenus()
at AppPage.OnPreRender(EventArgs e)
at Control.PreRenderRecursiveInternal()
at Page.ProcessRequestMain()
at Page.ProcessRequest()
at Page.ProcessRequest(HttpContext context)
at CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
at HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
at HttpApplication.ResumeSteps(Exception error)
at HttpApplication.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData)
at HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr)
at HttpRuntime.ProcessRequest(HttpWorkerRequest wr)
at ISAPIRuntime.ProcessRequest(IntPtr ecb, Int32 iWRType)
Privilege Check Failed For user: , User Does Not Have Privilege: {9f2b415e-8a0c-430c-bdd1-ad2052b86b02}
Lots of different users show up in the last line. Anything?
It sounds like you are making unsupported direct SQL modifications to the database. If that is the cause of the errors, you are likely in trouble. You say tracing will not turn on, did you add the following keys to the registry and perform IIS reset? - http://support.microsoft.com/kb/907490
EDIT:
Can you run the following query replacing the database name with that from your instance and let me know if a privilege comes up. You are likely missing that privilege for the users security role for whom it is throwing that error.
SELECT [PrivilegeId]
,[Name]
,[CanBeLocal]
,[CanBeDeep]
,[VersionNumber]
,[CanBeGlobal]
,[CanBeBasic]
,[AccessRight]
,[IsDisabledWhenIntegrated]
FROM [MyCrmDatabase_MSCRM].[dbo].[PrivilegeBase]
WHERE privilegeid='9f2b415e-8a0c-430c-bdd1-ad2052b86b02'

What does an IsolatedStorage_Operation_ISFS error thrown from the IsolatedStorageFileStream constructor mean?

I have a Silverlight 4 application (plug... http://audioorchard.com ...end plug) that is occasionally throwing an exception in the IsolatedStorageFileStream constructor.
System.IO.IsolatedStorage.IsolatedStorageException: [IsolatedStorage_Operation_ISFS] Arguments: Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50524.0&File=mscorlib.dll&Key=IsolatedStorage_Operation_ISFS at System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, IsolatedStorageFile isf) at AudioOrchard.Client.Utility.DiskManager.CreateNewFile(String fileName, Boolean wasDiskSpaceRequested) at... (enter's not SL runtime code here)
The url in the stack trace doesn't provide any help and neither did a google search. Where can I learn more about IsolatedStorage_Operation_ISFS and what would cause it?
It means you are hitting a file length limit in Silverlight isolated storage. The base storage location for isolated storage can be in a path with a very long name - it looks something like:
C:\\Users\\kevind\\AppData\\LocalLow\\Microsoft\\Silverlight\\is\\1325qaxz.ekn\\xyro13wm.cn0\\1\\s\\qc4wuhalx4ciu4u5hbqqfohd3y3y4m1guyj5xuv5ml5y5qjbjmaaaeea\\f
(and can be even longer on XP, where the base is C:\Documents and Settings)
Given that, it doesn't take much to hit the 260 character file path limit. The base path plus the internal path (inside isolated storage) plus the file name has to be less than 260 characters.
I've seen two different failure modes in this case:
Trying to create a directory where the total path length (base path plus new path) is longer than 260 characters. This results in a PathToLongException raised by IsolatedStorageFile.CreateDirectory
Trying to create a file using IsolatedStorageFileStream, where the total path length (base path plus internal path plus file name) is greater than 260 characters. This results in an IsolatedStorageException (IsolatedStorage_Operation_ISFS) raised by the IsolatedStorageFileStream constructor.
As far as I can tell, there's no real solution to this problem aside from catching the exceptions and carrying on. It's an unfortunately limitation of Silverlight.
There's a good article about the issue here:
http://msdn.microsoft.com/en-us/magazine/dd458794.aspx
Actually there is no constructor for IsolatedStorageFileStream with same parameters list:
System.IO.IsolatedStorage.IsolatedStorageFileStream..ctor(String
path, FileMode mode, FileAccess
access, FileShare share, Int32
bufferSize, IsolatedStorageFile isf)
Int32 bufferSize parameter is really excess here. Please check documentation for IsolatedStorageFileStream constructors.
I think there is some third party component which try to use non supported IsolatedStorageFileStream constructor.
I actually had this issue and to fix it I cleared my Silverlight cache. If you to to Program Files --> Microsoft Silverlight and click on the Application Storage tab, you can delete any or all of the sites listed there. I removed the site in question and was able to get right in next time.

Resources