Using Prism Scultpure I am facing this problem
Can some one help me what to do. I have R1 Region but it raise the follwoing error
The bold line in the following code is the error
public virtual void StartAction()
{
global::System.ComponentModel.BackgroundWorker backgroundWorker = new global::System.ComponentModel.BackgroundWorker();
backgroundWorker.WorkerReportsProgress = true;
backgroundWorker.DoWork += new global::System.ComponentModel.DoWorkEventHandler(this.StartActionWorker);
backgroundWorker.RunWorkerAsync();
CandidateView candidateView = null;
foreach (object view in **this.RegionManager.Regions["R1"].Views**)
{
if (true == view is CandidateView)
{
candidateView = view as CandidateView;
break;
}
}
if (null == candidateView)
{
candidateView = this.Container.GetExportedValue<CandidateView>();
this.RegionManager.Regions["R1"].Add(candidateView);
}
this.RegionManager.Regions["R1"].Activate(candidateView);
}
The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information. 1) The region manager does not contain the R1 region. Resulting in: An exception occurred while initializing module 'CandidateMModule'. - The exception message was: The region manager does not contain the R1 region. - The Assembly that the module was trying to be loaded from was:Candidate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null Check the InnerException property of the exception for more information. If the exception occurred while creating an object in a DI container, you can exception.GetRootException() to help locate the root cause of the problem. Resulting in: An exception occurred while calling the 'OnImportsSatisfied' method on type 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'. Resulting in: Cannot activate part 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'. Element: Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> AssemblyCatalog (Assembly="Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35") Resulting in: Cannot get export 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager (ContractName="Microsoft.Practices.Prism.Modularity.IModuleManager")' from part 'Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager'. Element: Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager (ContractName="Microsoft.Practices.Prism.Modularity.IModuleManager") --> Microsoft.Practices.Prism.MefExtensions.Modularity.MefModuleManager --> AssemblyCatalog (Assembly="Microsoft.Practices.Prism.MefExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35")
You are probably trying to populate the region before it's loaded. Check if the region is registered with RegionManager.Regions.ContainsRegionWithName("R1")
Related
I am trying to port code that had been using Microsoft.WindowsAzure.Storage classes to use the newer classes in Azure.Data.Tables, Azure.Storage.Queues, etc. From what I have been able to discern, the StorageException class has been replaced by RequestFailedException. Unfortunately, there are some properties in StorageException that do not exist in RequestFailedException, making it difficult to log appropriate messages when an exception is encountered (for example: RequestId, RequestInformation, etc.).
The migration document does not address the differences between StorageException and the new RequestFailedException, or how to get error details from it.
It seems that either the new libraries are not yet mature enough for prime time, or maybe it is just because the documentation is lacking the relevant information and I can't find the appropriate methodologies for getting all of the error information from the RequestFailedException.
Does anyone know how to get more data out of the new class? Here are some examples of what we used to do:
catch (StorageException e)
{
operation.Telemetry.Properties.Add("AzureServiceRequestID", e.RequestInformation.ServiceRequestID);
Changing the above to use RequestFailedException is a problem because RequestInformation is not a property of RequestFailedException.
Here is another case:
catch (StorageException se)
{
var ri = se.RequestInformation;
if (ri.ErrorCode == "TableNotFound")
{
Logger.Info(
$"{SJResult.MakeInfo(64)} {ri.HttpStatusCode} {ri.HttpStatusMessage}, Storage Service code={ri.ErrorCode} This is OK if HL7 has not yet received messages."); // 60240040
}
else
{
Logger.Error(
$"{SJResult.MakeError(65)} HttpStatusCode: {ri.HttpStatusCode}, HttpStatusMessage: {ri.HttpStatusMessage}, Storage Service code={ri.ErrorCode}, " +
$"Extended.ErrorCode: {ri.ExtendedErrorInformation.ErrorCode} Extended.ErrorMessage: {ri.ExtendedErrorInformation.ErrorMessage}"); // E0240041
throw;
}
Again, RequestInformation is not available in RequestFailedException.
How do we get access to all the detailed information (RequestInformation) about an exception from the new RequestFailedException class?
As you can see the definition of RequestFailedException Class (Azure) and constuctors in the latest version of azure sdk.
RequestFailedException(Int32, String, String, Exception) : gives HTTP status code ,specified error message, error code, and a reference to the inner exception .
And
RequestFailedException(Response)
Gives error message, HTTP status code, error code obtained from the specified response.
The response in the argument represents the HTTP response from the service which has ClientRequestId as one of the properties as shown in the table which gets client request id that was sent to server in the form of x-ms-client-request-id headers.You can try the same while catching the error in the try-catch block.
In exception class you can give
public class RequestFailedException : Exception
{
...
public RequestFailedException(int status, string message, string? errorCode, Exception? innerException) : base(message , innerException) { }
}
Or use RequestFailedException(Response) from which you can get ClientRequestId.
I’ve not tested it myself, but please check if below can be worked around which is taken from the below references or check if something similar can give an idea.Also see if content property can be retrieved as a part of response.
try
{
...
}
catch (Exception aex)
{
foreach (var ex in aex.InnerExceptions)
{
if (ex is RequestFailedException except)
{
var innerException = excep.InnerException;
if (innerException != null && innerException.GetType() == typeof(WebException))
{
WebException webEx = innerException as WebException;
WebResponse resp = webEx.Response;
var responseHeaders = resp.Headers;
string requestId = responseHeaders["x-ms-request-id"];
Console.WriteLine("Request Id: " + requestId);
Console.WriteLine(except.InnerException.Message);
}
else
{
// (not a RequestFailedException)
Console.WriteLine($"{ex.Message}");
}
}
References:
How can I get Request ID when an exception occurs? (microsoft.com)
c# - How can you catch a RequestFailedException if making multiple
DownloadToAsync calls in parallel? - Stack Overflow
I am using this brilliant piece of code to get the stacktrace in a custom error page
var stackTrace = "";
var trace = requestScope.error.getStackTrace();
for (var i = 0; i < trace.length; i++){
stackTrace += trace[i]+ "<br />" ;
}
return stackTrace;
But it seem like this is not returning any extlib errors
The following fault is only seen if I use the default runtime error page:
"Invalid component id dynC for partial refresh"
any way to modify my code to also return the extlib errors?
It depends on what kind of exception is throwed. Not all exceptions have a 'getStackTrace()'. See here for more info about Xpages error management: http://www-10.lotus.com/ldd/ddwiki.nsf/dx/error-management-in-xpages.htm. Take a look at the comment from "Dominykas Kardokas" on that page.
i got this errors
Error 1 The type 'System.Data.SqlServerCe.SqlCeTransaction' is defined in an assembly is not referenced That. You Must add a reference to assembly 'System.Data.SqlServerCe, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = 89845dcd8080cc91'.
WHERE DO I DOWNLOAD VERSION 4.0.0.0? I didn't find it.
Error 2 The type 'System.Data.SqlServerCe.SqlCeConnection' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'.
same problem..
Error 3 The best overloaded method match for 'ErikEJ.SqlCe.SqlCeBulkCopy.WriteToServer (System.Data.DataTable)' Some invalid arguments have
overloaded? only i want to use it :s
Error 88 The best overloaded method match for 'ErikEJ.SqlCe.SqlCeBulkCopy.WriteToServer(System.Data.DataTable)' has some invalid arguments
?? it DOES allow datatable . i dont understand it..
Error 94 Argument '1': cannot convert from 'System.Data.DataTable [c:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\WindowsCE\System.Data.dll]' to 'System.Data.DataTable []'
convert to datatable[]?? what?
well this is my method code.
private void DoBulkCopy(bool keepNulls, System.Data.DataTable tabla, string nombretabla)
{
if (tabla.Rows.Count > 0)
{
ErikEJ.SqlCe.SqlCeBulkCopyOptions options = new ErikEJ.SqlCe.SqlCeBulkCopyOptions();
if (keepNulls)
{
options = options |= ErikEJ.SqlCe.SqlCeBulkCopyOptions.KeepNulls;
}
//using (SqlCeBulkCopy bc = new SqlCeBulkCopy(connectionString, options))
using (SqlCeBulkCopy bc = new SqlCeBulkCopy(Resco.Data.Database.Instance.ConnectionString,options))
{
bc.DestinationTableName = nombretabla;
try
{
bc.WriteToServer(tabla);
}
catch(Exception ex) { }
}
}
}
Easy way -> install to project using Package Manager Console.
PM> Install-Package ErikEJ.SqlCeBulkCopy
See http://nuget.org/packages/ErikEJ.SqlCeBulkCopy
I needed to add text to the AudienceEditor Control everywhere and so I created a custom
class inheriting from `Microsoft.Office.Server.WebControls.AudienceEditor` class
public class AudienceEditorText : Microsoft.Office.Server.WebControls.AudienceEditor
{
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Label lblText = new Label();
lblText.ID = "Note";
lblText.Visible = true;
lblText.Text = "Text Needs to be changed";
lblText.Attributes.Add("style", "color: red");
Controls.Add(lblText);
}
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
}
protected override void CreateChildControls()
{
base.CreateChildControls();
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
}
and added the following tags in web.config
<tagMapping>
<add tagType="Microsoft.Office.Server.WebControls.AudienceEditor, Microsoft.Office.Server, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" mappedTagType="Hub.AudienceEditorProject.AudienceEditorText, Hub.AudienceEditorProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=df1f6b11d06cf6ca" />
</tagMapping>
I was expecting the AudienceEditor control to be replaced by the new class in the EditForm.aspx and NewForm.aspx, but this is not working. I tried to debug the custom class, but execution doesn't enter the project, which means the AudienceEditor control doesn't get replaced.
The view source tells that the Audience field is rendered by the Microsoft.Office.Server.WebControls.FieldTypes.SPFieldTargetTo class, which contains the Microsoft.Office.Server.WebControls.FieldTypes.SpFieldTaretToControl, which in turn houses the AudienceEditor control. I have tried inheriting from all these 3 controls and tagmapped them, but it is simply not working.
Just to test I have mapped the TextBox control too and that works fine on the same page. It also comes into Debug. But the AudienceEditor is simply not working.
All I can think of is that you are seeing this behaviour because the tagMappings are applied at compile time, and the parent control that instantiates the AudienceEditor as a child control is already compiled into it's own dll.
Some alternative solutions that I think would do the job.
use css to display an image with your text as a background image,
positioned where you want it.
use javascript to inject the text when
the document has been loaded in the browser
use control adapters to
control rendering of the Audience Editor control (not very easy to
deploy when we're talking SharePoint)
My solution contains 4 Silverlight projects - one main, two module projects and last one share project (for common interfaces etc).
Main and module projects don't have references to each other (just to share project).
You can find definitions of my modules below:
[ModuleExport("ServiceModule", typeof(ServiceModule), InitializationMode = InitializationMode.WhenAvailable)]
public class ServiceModule : IModule
[ModuleExport("ViewModule",
typeof(ViewModule),
DependsOnModuleNames = new string[] { "ServiceModule" },
InitializationMode = InitializationMode.WhenAvailable)]
public class ViewModule : IModule
And I added modules to ModuleCatalog into derived MefBootstrapper class of main project (I used code registration of modules instead of CreateFromXaml method):
protected override void ConfigureModuleCatalog()
{
ModuleCatalog.AddModule(
new ModuleInfo()
{
ModuleName = "ServiceModule",
ModuleType = "SilverlightEnabledService.ModuleDefinitions.ServiceModule, SilverlightEnabledService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea",
Ref = "SilverlightEnabledService.xap",
InitializationMode = InitializationMode.WhenAvailable
}
);
ModuleCatalog.AddModule(
new ModuleInfo()
{
ModuleName = "ViewModule",
ModuleType = "RedOrBlackModule.ModuleDefinitions.ViewModule, RedOrBlackModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea",
Ref = "RedOrBlackModule.xap",
InitializationMode = InitializationMode.WhenAvailable,
DependsOn = (new Collection<string>(new string[] { "ServiceModule" }))
}
);
}
As see from code above, ModuleCtalog module name is the same as module name in ModuleExportAttribute, but I get exception below:
Uncaught Error: Unhandled Error in Silverlight Application Unable to locate the module with type 'SilverlightEnabledService.ModuleDefinitions.ServiceModule, SilverlightEnabledService, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ca4f032071a86aea' among the exported modules. Make sure the module name in the module catalog matches that specified on ModuleExportAttribute for the module type. в Microsoft.Practices.Prism.Modularity.ModuleInitializer.HandleModuleInitializationError(ModuleInfo moduleInfo, String assemblyName, Exception exception)...
It seems very easy issue but I cannot find solution yet.
There are several reasons why the module might not be found. See this blog post for an overview of what they are and how to debug them: How to Debug and Diagnose MEF Failures.