I created a .NET class library in C# and exposed it to COM. It works fine as an in-proc COM server. However I want to use it as an out-proc COM server to have it in a separate process.
To do so I try to create a COM+ application. I created an empty COM+ application and added the classes implemented in the class library into it. When I call CoCreateInstance() to instantiate a class implemented in the library, the COM+ surrogate process encounters an access violation and terminates (crash dump folows).
Are there any special steps needed to be taken to create a class library that can be used as an out-proc COM server under COM+?
The COM+ surrogate process crashes with the following crash dump:
Exception: C0000005
Address: 0x000C1618
Call Stack:
! + 0xC1618
mscorwks!Ordinal79 + 0xE41C
mscorwks!Ordinal79 + 0xE4AD
mscorwks!CoInitializeEE + 0x563F
mscorwks!CoInitializeEE + 0x5672
mscorwks!CoInitializeEE + 0x57F1
mscorwks!CoInitializeCor + 0x210E
mscorwks!CoInitializeCor + 0x48D
mscorwks!Ordinal79 + 0x16D2
mscorwks!ReleaseFusionInterfaces + 0x20B28
COMSVCS! + 0xC29A2
COMSVCS! + 0xC2BDA
COMSVCS!CoCreateStdTrustable + 0xCB10
ole32!CoMarshalInterface + 0x2642
ole32!CoInstall + 0x673
ole32!CoQueryAuthenticationServices + 0x1F44
ole32!CoQueryAuthenticationServices + 0x2862
ole32!CoWaitForMultipleHandles + 0xC267
ole32!CoQueryClientBlanket + 0x16CE
ole32!CoCreateObjectInContext + 0xC8E
ole32!CoInstall + 0x87A
ole32!CoWaitForMultipleHandles + 0x10479
ole32!CoMarshalInterface + 0x2808
ole32!CoGetTreatAsClass + 0xBE7
ole32!CoGetTreatAsClass + 0xB9E
ole32!CoMarshalInterface + 0x28F2
ole32!CoMarshalInterface + 0x2642
COMSVCS!CoCreateStdTrustable + 0x106A4
ole32!CoMarshalInterface + 0x2642
ole32!CoPopServiceDomain + 0x14FE
RPCRT4!CheckVerificationTrailer + 0x70
RPCRT4!NdrStubCall2 + 0x215
RPCRT4!CStdStubBuffer_Invoke + 0x82
ole32!StgGetIFillLockBytesOnFile + 0xFC92
ole32!StgGetIFillLockBytesOnFile + 0xFC3C
ole32!CoRevokeClassObject + 0xA3E
ole32!CoRevokeClassObject + 0x963
ole32!StgGetIFillLockBytesOnFile + 0xF872
ole32!WdtpInterfacePointer_UserMarshal + 0x80E
ole32!StgGetIFillLockBytesOnFile + 0xF792
RPCRT4!NdrGetTypeFlags + 0x1C9
RPCRT4!NdrGetTypeFlags + 0x12E
RPCRT4!NdrGetTypeFlags + 0x5A
RPCRT4!CreateStubFromTypeInfo + 0x2D7
RPCRT4!CreateStubFromTypeInfo + 0x318
RPCRT4!NdrConformantArrayFree + 0x2CB
RPCRT4!NdrConformantArrayFree + 0x20F
RPCRT4!I_RpcBCacheFree + 0x61C
RPCRT4!I_RpcBCacheFree + 0x43E
RPCRT4!I_RpcBCacheFree + 0x604
kernel32!GetModuleFileNameA + 0x1B4
Perhaps going through the ServicedComponent example in this answer will help:
Create Out-Of-Process COM in C#/.Net?
I suggest you take a look at .Net Remoting instead.
Related
I'm trying to create a secondary tile, which shows pictures in rotation like in the photos app. I have tried something like this:
SecondaryTile tile = GenerateSecondaryTile("NewTile", "SecondaryTile");
await tile.RequestCreateAsync();
var ImageUrl = selectedFileList.ElementAt(0).Path;
string tileXmlString =
"<tile>"
+ "<visual>"
+ "<binding template='TileSmall'>"
+ "<image src='" + selectedFileList.ElementAt(0).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(1).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(2).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(3).Path + "' alt='image'/>"
+ "<image src='" + selectedFileList.ElementAt(4).Path + "' alt='image'/>"
+ "</binding>"
+ "</visual>"
+ "</tile>";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(tileXmlString);
TileNotification notifyTile = new TileNotification(xmlDoc);
TileUpdateManager.CreateTileUpdaterForSecondaryTile(tile.TileId).Update(notifyTile);
I have tried setting the type as both background and peek but it doesn't give the required result. And also I would not like to use a background task as my app already uses one and I wouldn't want to increase the overhead which might cause the task to fail entirely. I wouldn't mind if the images were limited to 5 like earlier in Windows phone 8.1.
For reference : check this out : Skip to 0:30
This is for Primary Tile, but it should work the same way. Make your own XML Template, then reference your image. Enable notification queue then update the Tile with the TileNotification. Do this up to five times to put five images on the Live Tile stack.
var myStorageFile = await Package.Current.InstalledLocation.GetFileAsync("LiveTileTemplate.xml");
string liveTileTemplate = await FileIO.ReadTextAsync(myStorageFile);
liveTileTemplate = liveTileTemplate.Replace("squareImageSource", FilePathFullPrefix + GetFilePathSquareTile(imageID));
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
TileUpdateManager.CreateTileUpdaterForApplication().Update(new TileNotification(mergedXML));
I have some toast notifications with alarm scenario. I used the following toast schema, but when notification is raised, there are no buttons(snooze or dismiss).
Here is my xml content. So why cant i use this toast commands?
var contentString = "<toast duration=\"long\">\n" +
"<visual>\n" +
"<binding template=\"ToastText02\">\n" +
"<text id=\"1\">" + alarmTitle + "</text>\n" +
"<text id=\"2\">" + alarmNote + "</text>\n" +
"</binding>\n" +
"</visual>\n" +
"<commands scenario=\"alarm\">\n" +
"<command id=\"snooze\"/>\n" +
"<command id=\"dismiss\"/>\n" +
"</commands>\n" +
"<audio src=\"ms-winsoundevent:Notification.Looping.Alarm2\"\n" +
"loop=\"true\"/>\n" +
"</toast>\n";
As is normal, Windows Phone 8 RT does not have the all features of Windows Store Apps.
There is a link on the MSDN that says what is not available on WinRT apps.
One of the entries is Alarms and reminders, so sadly you will not be able to use alarms on WP8.1.
I use in my application ScheduledTileNotifications and push 10 until 20 messages in the TileUpdateManager. But on the metro there are only 5 messages active. What can I do to display more than 5 notifications in the metro-Tile?
string tileXmlString = "<tile>"
+ "<visual>"
+ "<binding template='TileWideSmallImageAndText03' branding='name'>"
+ "<image id='1' src='ms-appx:///Assets/icons/cube_for_kachel.png'/>"
+ "<text id='1'>" + longSubject + "\n" + message.title + "</text>"
+ "</binding>"
+ "<binding template='TileSquareText04' branding='name'>"
+ "<text id='1'>" + shortSubject + "\n" + message.title + "</text>"
+ "</binding>"
+ "</visual>"
+ "</tile>";
XmlDocument tileXml = new XmlDocument();
tileXml.LoadXml(tileXmlString);
ScheduledTileNotification sceduleNotification = new ScheduledTileNotification(tileXml, DateTime.Now.AddSeconds(15));
TileUpdateManager.CreateTileUpdaterForApplication().EnableNotificationQueue(true);
TileUpdateManager.CreateTileUpdaterForApplication().AddToSchedule(sceduleNotification);
When I set the EnableNotificationQueue to true, five of my notification run in a circle. When I set it to false, my notification donĀ“t run in a circle. But I have 10 until 20 Notifications, which should run in a circle. Do you think it is possible.
When I use the AddToSchedule method an push 10 Notifications, each notification will show for one time.
The problem is related to the use of the EnableNotificationQueue method. In fact, as you can read at http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.notifications.tileupdater.enablenotificationqueue:
When queuing is enabled, a maximum of five tile notifications can
automatically cycle on the tile.
Try to pass false to this method.
According to the documentation, you can schedule up to 4096 notifications. Reref to http://hansstan.wordpress.com/2012/09/02/windows-8-advanced-tile-badge-topics/ for a working example.
Since yesterday, I try to run a sample of code to display a chart with FusionCharts and Mvc3 Razor and nothing works. Please.... help!!! :)
Here is what I have done:
I took the projet from Libero. here
After that, I used the project convertor here to upgrade the project from Mvc2 to Mvc3.
When I try to run to code (F5 and show the result in browser), that works fine; all graphics are displayed correctly.
If I just create a new view with razor (.cshtml) instead of the current .aspx (replacing a view from the old syntax to the new razor) and I try to displayed the same graphic, the page is displayed correctly but without graphic. When I look into the page source with firebug or any other tools, no code is behind the scene. I also don't have any errors while looking with the Web Developer tool in Firefox.
I just tried to add a Html.Raw in front of the code that generate the javascript to not encode the output and I have the same result. Also trying with returning HtmlString but again same result; no graphic is displayed.
The key to don't miss in this problem is that if I try the exact same code but with an .aspx file, all is correct.
In .aspx, the code looks like this:
<%=Html.FChart("Chart01", ViewData["MyChart"], 600, 400)%>
And in .cshtml:
#{Html.FChart("Chart01", ViewData["MyChart"], 600, 400); }
And finally, the html helper to generate this bunch of code:
private static string RenderChart(string controlId, string xmlData, FusionChartBase chart, int width, int height)
{
String sControlId = controlId;
String sJsVarId = "_lib_JS_" + controlId;
String sDivId = "_lib_DIV_" + controlId;
String sObjId = "_lib_OBJ_" + controlId;
String sWidth = width.ToString();
String sHeight = height.ToString();
StringBuilder oBuilder = new StringBuilder();
oBuilder.AppendLine(#"<div id=""" + sDivId + #""" align=""center""></div>");
oBuilder.AppendLine(#"<script type=""text/javascript"">");
oBuilder.AppendLine(#"var " + sControlId + #" = (function() {");
oBuilder.AppendLine(#" return {");
oBuilder.AppendLine(#" containerId: '" + sDivId + "',");
oBuilder.AppendLine(#" xmlData: '',");
oBuilder.AppendLine(#" chartType: '',");
oBuilder.AppendLine(#" showChart: function() {");
oBuilder.AppendLine();
oBuilder.AppendFormat(#" var chartURL = '{0}' + this.chartType.replace('Chart', '{1}');", UrlSWF, SufixSWF);
oBuilder.AppendLine(#" var " + sJsVarId + #" = new FusionCharts(chartURL, """ + sObjId + #""", """ + sWidth + #""", """ + sHeight + #""");");
oBuilder.AppendLine(#" " + sJsVarId + #".setDataXML(this.xmlData);");
oBuilder.AppendLine(#" " + sJsVarId + #".render(""" + sDivId + #""");");
oBuilder.AppendLine(#" }");
oBuilder.AppendLine(#" }");
oBuilder.AppendLine(#"})();");
oBuilder.AppendLine(#"setTimeout(function(){");
oBuilder.AppendLine(#" " + sControlId + #".xmlData = """ + xmlData.Replace(#"""", #"'") + #""";");
oBuilder.AppendLine(#" " + sControlId + #".chartType = """ + chart.ChartType + #""";");
oBuilder.AppendLine(#" " + sControlId + #".showChart();");
oBuilder.AppendLine(#"},0);");
oBuilder.AppendLine(#"</script>");
return oBuilder.ToString();
}
I don't know if I must set some configuration options in the web.config or what I don't understand in the behavior of Mvc2 compare to Mvc3, but it's very frustrating.
If you have any idea, a big thanx in advance.
It should be #Html.FChart("Chart01", ViewData["MyChart"], 600, 400) instead of #{Html.FChart("Chart01", ViewData["MyChart"], 600, 400); }
FusionCharts provides a .NET library which makes rendering charts a one liner - read through the FusionCharts Documentation.
They have a recent tutorial up on their blog - JavaScript Charts with ASP.NET (C#) Using FusionCharts XT
I'm trying to format a literal control on a code-behind page:
BillerLiteral.Text = "<p class="'no-margin'"/>" + attendee1.FirstName + " " +
attendee1.LastName + "</p> <p class=""no-margin"">" + attendee1.Address1 + "," +
attendee1.Address2 + "</p><p class=""margin"">" + attendee1.City + "," +
attendee1.State + " " + attendee1.ZipCode + "</p><p>" + attendee1.Email + "</p>";
Right after I added that line, I get compilation errors even though it compiles fine.
Compilation Error Description: An error occurred during the compilation of a
resource required to service this request. Please review the following specific
error details and modify your source code appropriately.
Compiler Error Message: The compiler failed with error code 1.
Here's the detailed compiler output:
c:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE> "c:\Window
\Microsoft.NET\Framework\v3.5\csc.exe" /t:library /utf8output /R:"C:\Windows
\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089
\System.ServiceModel.dll"
/R:"C:\Windows\assembly\GAC_MSIL\System.Web.Services\2.0.0.0__b03f5f7f11d50a3a
\System.Web.Services.dll" /R:"C:\Windows\assembly\GAC_32\System.Data
\2.0.0.0__b77a5c561934e089\System.Data.dll" /R:"C:\Windows\assembly\GAC_MSIL
\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089
\System.Runtime.Serialization.dll" /R:"C:\Windows\assembly\GAC_MSIL\System
\2.0.0.0__b77a5c561934e089\System.dll" /R:"C:\Windows\assembly\GAC_MSIL
\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll" /R:
"C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35
\System.WorkflowServices.dll" /R:"C:\Windows\assembly\GAC_32\
System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\
System.EnterpriseServices.dll"
/R:"C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a
\System.Configuration.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.IdentityModel
\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll" /R:"C:\Windows\assembly
\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll" /R:
"C:\Windows\assembly\GAC_MSIL\System.Web.Mobile\2.0.0.0__b03f5f7f11d50a3a
\System.Web.Mobile.dll" /R:"C:\Windows\assembly\GAC_MSIL\System.Xml
\2.0.0.0__b77a5c561934e089\System.Xml.dll" /R:"
C:\Windows\Microsoft.NET\Framework\v2.0.50727\mscorlib.dll"
/R:"C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web
\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll"
/R:"C:\Windows\assembly\GAC_MSIL\System.Web.Extensions\3.5.0.0__31bf3856ad364e35
\System.Web.Extensions.dll" /R:"C:\Windows\assembly\GAC_MSIL
\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089
\System.Data.DataSetExtensions.dll" /R:"C:\Users\jeffreyeas\AppData\Local
\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183\App_Code.fkizkk6y.dll"
/R:"C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089
\System.Xml.Linq.dll" /R:"C:\Windows\assembly\GAC_32\System.Web
\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll" /out:"C:\Users\jeffreyeas\AppData\Local
\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183
\App_Web_page_two.aspx.cdcab7d2.dkslispb.dll" /D:DEBUG /debug+ /optimize-
/win32res:"C:\Users\jeffreyeas\AppData\Local\Temp\Temporary ASP.NET Files\awchallenge
\ae85f60c\8aef9183\vuyv4kby.res" /w:4 /nowarn:1659;1699;1701 /warnaserror-
"C:\Users\jeffreyeas\AppData\Local\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c
\8aef9183\App_Web_page_two.aspx.cdcab7d2.dkslispb.0.cs" "C:\Users\jeffreyeas\AppData
\Local\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183
\App_Web_page_two.aspx.cdcab7d2.dkslispb.1.cs" "C:\Users\jeffreyeas\AppData\Local
\Temp\Temporary ASP.NET Files\awchallenge\ae85f60c\8aef9183
\App_Web_page_two.aspx.cdcab7d2.dkslispb.2.cs"
What am I missing?
Your quotes are wrong in "<p class="'no-margin'"/>"
BillerLiteral.Text = "<p class=\"no-margin\"/>" + attendee1.FirstName + " " + attendee1.LastName + "</p> <p class=\"no-margin\">" + attendee1.Address1 + "," + attendee1.Address2 + "</p><p class=\"margin\">" + attendee1.City + "," + attendee1.State + " " + attendee1.ZipCode + "</p><p>" + attendee1.Email + "</p>";
try this