.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

WPF Initialization failure with TypeInitializationException in CModuleInitialize.LoadWpfGfx

Posted By:      Posted Date: September 19, 2010    Points: 0   Category :WPF
Hi there,

I started a thread, which displays a WPF form with the following code:

Thread thread = new Thread(() => {splasher.Show();});



I get this exception.  How do I fix this?

.NET Framework 3.5 SP1
Windows XP Professional SP3
Athlon 64 X2

Thanks in advance.


System.TypeInitializationException: The type initializer for '<Module>' threw an exception. ---> <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load during appdomain initialization.
 ---> System.ComponentModel.Win32Exception: The system cannot find the file specified
   at CModuleInitialize.LoadWpfGfx(CModuleInitialize* )
   at CModuleInitialize.{ctor}(CModuleInitialize* )
   at ?A0x0b283f3b.??__E?A0x0b283f3b@cmiStartupRunner@@YMXXZ()
   at _initterm_m((fnptr)* pfbegin, (fnptr)* pfend)

View Complete Post

More Related Resource Links

ManagementClass.GetInstances throw error Initialization Failure


HI, i use ManagementClass to get Ip adress, mac address and so on..

on my development pc there are no problem

however some of the production pc somehow the line of managementclass.getinstances throw error of Initiazation Failure

I know there are other ways to get mac address and ip, but somehow i cannot changed the current deployed build due to some policy and i need to find way how to manuevre this problem

here's the code i've wrote

  static void ListProp()
        Console.WriteLine("Initialize ManagementClass.Press Anykey");
        ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
        Console.WriteLine("Successfull initialize ManagementClass");
        Console.WriteLine("ManagementObject trying to GetInstances.Press Anykey");
        ManagementObjectCollection moc = mc.GetInstances();

Transactions: Build Scalable Systems That Handle Failure Without Losing Data


Systems that handle failure without losing data are elusive. Learn how to achieve systems that are both scalable and robust.

Udi Dahan

MSDN Magazine July 2008

Customize failure text for login control


Hi all,

I would like to show the failure text in a client-side alert box for login control in c#. Please help me if there is an easy way to convert it from vb.net to c#.net. Thanks a lot!

Protected Sub Login1_LoginError(ByVal sender As Object, ByVal e As System.EventArgs) Handles Login1.LoginError
'Display the failure message in a client-side alert box
ClientScript.RegisterStartupScript(Me.GetType(), "LoginError", _
String.Format("alert('{0}');", Login1.FailureText.Replace("'", "\'")), True)

 End Sub

 Converted, but it doesn't work.

protected void Login1_LoginError(object sender, System.EventArgs e)
    //Display the failure message in a client-side alert box
    ClientScript.RegisterStartupScript(this.GetType(), "LoginError", string.Format("alert('{0}');", Login1.FailureText.Replace("'", "\\'")), true);

How to get access to content database after server hardware failure


Sharepoint server 2007 and remote sql 2000 SP4 database, after ShraPoint server crash only content databases are available and intact. Trying to restore from backup fail, stsadm -o restore says that not valid backup is available on path. How to get access to available content database using a new installation with same server name, ip address and partitions configuration. How to recover site with content databases information.

Regards, thanks for help.

Victor Naranjo MCSE + Security MCSA + Security MCSE + Messaging MCSA + Messaging ITIL Certified Comptia Security+

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local appl

Hi ,From the last few days I am struggling with the error "Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed."I hav created an asp.net web application with membership shcema. It works fine an my developement machine but when I published it on my web server. It is giving me above error for which I searched but not found any help.Can anyone help me with this.

Net Framework 3.5 service pack Failure to instal

Microsoft .NET Framework 3.5 Service Pack 1 and .NET Framework 3.5 Family Update for .NET versions 2.0 through 3.5 (KB951847) x86 tries to instal but fails without any reason as I am running XP professional can anyone explain why as I have all the previos updates. after trying to instal I come up with this error Installation Failure Error Code: 0x80070645

Failure to reliably iterate through all elements of a COM Collection from C# .NET 4.0

In C#, .NET 4.0, I am making a call to a COM DLL to return a collection object. A foreach loop steps through each element of the collection. In the loop, a new .NET object is created for each element of the COM collection. The new object is added to a new .NET collection. This works fine in the development environment. In a deployed system, is works correctly most (about 90%) of the time.  However, sometimes (about 5% of the time) the foreach loop finds no items in the COM collection. Other times (also about 5%), it finds the first 2 or 3 or ... N items.  Somehow, the enumeration interface exposed by the COM object is failing. Here is a code snippet from the COM Object, which is called NameList.  NOTE that the VB6 cls file was opened in a text editor to show the class and method attributes. VERSION 1.0 CLASS BEGIN MultiUse = -1 'True Persistable = 0 'NotPersistable DataBindingBehavior = 0 'vbNone DataSourceBehavior = 0 'vbNone MTSTransactionMode = 0 'NotAnMTSObject END Attribute VB_Name = "NameList" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = True Attribute VB_PredeclaredId = False Attribute VB_Exposed = True Attribute VB_Ext_KEY = "SavedWithClassBuilder6" ,"Yes" Attribute VB_Ext_KEY = "Top_Level" ,"Yes" Option Explicit Private mCol As Collection ' <snip> Only code rela

DataContractSerializer deserialization puzzle - by-pass member initialization.

Hi, I was using WCF and during the transmission of a object, of the type Book, see code below, the deserialization process throws a NullReferenceException. To isolate the problem, I uses a unit test like this rather than involving the full blown WCF marshalling. This appears to be solely a serialization/deserialization problem and has nothing to do with the communication issues in WCF. [Test] public void TestSerializeAndDeserializeBook() {     Book book = new Book( "Testing Serialization and Deserialization",                         new Person( 100, "Tom", "Smith" ),                         new Person( 101, "Peter", "Pan" ) );     DataContractSerializer ser = new DataContractSerializer( typeof(Book) );     using( Stream stm = new MemoryStream() )     {         ser.WriteObject( stm, book );         stm.Seek( 0, SeekOrigin.Begin );         Book regen = ser.ReadObject( stm ) as Book; // NullReferenceException here     &nb

SQL Server 2005 OWC11 Installation Failure

Hi, While installing SQL Server Developer Edition I am getting a setup failure for OWC11 component on my machine with XP SP2. When gone through various community sites found this is related with Office Web component. I have tried below solution but none of them worked: 1. Downloaded OWC11 from microsoft.com and tried to install but failed to install. Its coming with an error message 'setup can not remove the older version of the Microsoft Offfice web component can not be removed' 2. Tried to uninstall Microsoft Offfice web componen from control panel but failing to uninstall, its giving an erropackage could not found. 3. Tried uninstalling Microsoft office 2007  from machine but didn't worked. I have Microsoft visual studio 2005 and Microsoft office 2007 installed on my computer. Please help me to get rid of this OWC11 component. Thanks in Advance. Jagdish

Server connection failure

Hello everyone, I get the following error message when I try to run the ItemFinder C# application: "An error has occured while establishing a connection to the server. When connecting to SQL Server 205, this failure may be caused by the fact that under the default settings SQL server doe not allow remote connections. (provider: Named Pipes Provider, erorr:40 - Could not open a connectio to SQL Server)" I have sucessfully installed SQL Server 2005 and AdventureWorks. Test connection for AdventureWorks in VS 2005 was succesfull. How can I overcome this problem? Many thanks in advance. Alex-Victor

Intermittent Tabel Create Failure

Using the following code:             try {                 Server sv = _connectToServer( servername );                 Database db = sv.Databases[ databasename ];                 Table tb = new Table( db, tablename, "dbo" );                 for ( int x = 0; x < schemalist.Count; x++ ) {                     // get field                     SchemaColumn f = schemalist[ x ];                     // make column                     Column col = new Column( tb, f.Header );                     col.DataType.SqlDataType = (SqlDataType)f.DataType;  

SQL 2008 Upgrade Replication failure

we upgraded to Sql 2008 standard edition last night from 2000 and our replication is now failing, cannot delete it or enter new ones.   I found one article saying the following stored procedures need to be run to upgrade the replcation:   exec sp_vupgrade_replication  exec sp_vupgrade_repl_metadata   however the first one throws and error and the second one seems not to exists.  does anyone have any insight into this. or how to delete the replications?   the error from the stored proc sp_vupgrade_replication  is :   Upgrading subscription settings and system objects in database [SoxAuditSystem]. Attempting to copy article resolvers from SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL10.MSSQLSERVER\Replication\ArticleResolver Msg 25026, Level 16, State 1, Procedure sp_registercustomresolver, Line 82 The proc sp_registercustomresolver cannot proceed because it is not run in the context of the distribution database, or the distribution database is not properly upgraded.  

Failed to generate a user instance of SQL Server due to failure in retrieving the user's local appl

Hi,I spend two days looking for an anwser to this problem but no luck. I have a simple ASP.NET 2.0 application which run correctly on my local machine. But After uploading all files including web.config file on a Windows 2003 Server with SQLEXPRESS installed. I have this error. Please Help!!!!!! Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Failed to generate a user instance of SQL Server due to failure in retrieving the user's local application data path. Please make sure the user has a local user profile on the computer. The connection will be closed.

Failure in restoring an database from tape - SQL Server 2005

Hello everyone, we are trying to restore one of our datebase from tape using the T-Sql commands. Using the GUI results in an timeout. The command we are using to start the restore is: RESTORE DATABASE RECOV FROM Tape = '\\.\tape0' WITH  FILE=2, RECOVERY, NOUNLOAD, STATS=5, MOVE 'xxx_OPL_xxxx_ZEELAND' TO 'K:\RECOVER\data\RECOV.mdf', MOVE 'xxx_OPL_xxxx_ZEELAND' TO 'K:\RECOVER\log\RECOV_log.ldf', REPLACE the restore proces start without any problem, only ending with this: Processed 2598808 pages for database 'xxx_OPL_xxxx_ZEELAND', file 'xxxx_PROD_Data' on file 2. Processed 3 pages for database 'xxxx_OPL_xxxx_ZEELAND', file 'xxxx_PROD_Log' on file 2. Msg 3229, Level 16, State 2, Line 1 Request for device '\\.\tape1' timed out. Msg 3213, Level 16, State 1, Line 1 Unable to unload one or more tapes. See the error log for details. Msg 3013, Level 16, State 1, Line 1 RESTORE DATABASE is terminating abnormally. In the eventlog, the following is recorded: BackupTapeFile::UnloadTape: PrepareTape(UNLOCK) failure on backup device '\\.\tape0'. Operating system error 21(The device is not ready.). For as far we can judge, the tapedrive is functioning without problems. Using the same tape in an other tapedrive on an different server results in the same error. Hardware used: HP Proliant Server (DL580) with additional SCSI interface card HP StorageWorks LTO 4 tapedriv

Network failure in Cluster Environment,will it stop the SQL Server Instances?

Hi All I have problem with cluster Environment that is there is network failure in Cluster Environment,will it stop SQL Server Instances Event viewrer Information 6:22:09 The MSSQLSERVER service entered the stopped state. 6:22:05 The MSSQLSERVER service was successfully sent a stop control. 6:22:04 The SQLSERVERAGENT service entered the stopped state. 6:21:43 The node lost communication with cluster node 'MSSQL0002' on network 'LAN'. 6:22:02 The SQLSERVERAGENT service was successfully sent a stop control. 6:22:02 Cluster resource 'SQL IP Address1(SQLCLUSTER)' in Resource Group 'SQL' failed. 6:22:02 The TCP/IP interface for Cluster IP Address 'Cluster IP Address' has failed. 6:22:02 The TCP/IP interface for Cluster IP Address 'Cluster IP Address' has failed. 6:22:02 The TCP/IP interface for Cluster IP Address 'MSDTC IP address' has failed. 6:22:02 The TCP/IP interface for Cluster IP Address 'MSDTC IP address' has failed. 6:22:02 The TCP/IP interface for Cluster IP Address 'SQL IP Address1(SQLCLUSTER)' has failed. 6:21:58 The TCP/IP interface for Cluster IP Address 'SQL IP Address1(SQLCLUSTER)' has failed. 6:21:58 Cluster network 'LAN' is operational (up). All available server cluster nodes attached to the network can communicate using it. 6:21:58 The interface for cluster node 'MSSQL0002' on network 'LAN' failed. If the condition persist

Sql Compact Subscription failure - Win 7 Ultimate 64 Bit Sql 2008 64 bit, Sql Ce 3.5 sp1

Greetings,  Testing sql compact subscription setup on a single machine.  Can NOT get the subscription to initialize.  This works without fail on server 2003, 32 bit, and IIS 6.  I think it is security but not sure.  Using web syncConfigured publication and web sync went fine.  Key secret here was using sqlce 3.5 sp1 tools. the http://localhost/sync/sqlcesa35.dll?diag works fineThe create snapshot works fineAdded the IUSR with db_owner rights to the primary database.Added the IUSR to the publication access list.The Agent is running, I checked that.Created a new sql ce db in the management studio and configured the subscription through the wizard, like I do all the time in sql 2005.It fails with the following error codes, which I suspect are security related.  Below is the setup for the subscription:Publisher: My-PCPublisherDatabase: MyDBPublication: MyDB_PUBSubscriber: 0024HostName: 0024InternetUrl: http://localhost/sync/sqlcesa35.dllWeb Server Authentication: AnonymousPublisherSecurityMode: Windows AuthenticationError Message below:2010/03/11 15:20:07 == SQLCESA Version ==> 3.5.5692.02010/03/11 15:20:07 Hr=00000000 SQLCE Server Agent Loaded - Version 3.5.5692.002010/03/11 15:20:17 Thread=4A0 RSCB=1 Command=SCHK Hr=80045637 ERR:Initialize failed for DistributorSessionID =  02010/03/11 15:20:17 Thread=4A0 RSCB=1 Command=SCHK Hr=8004

SQL Server 2008 Install failure - Reporting Services Rule Failures

I'm installing SQL Server 2008 on Windows 7.  I'm going through the install and on the "Installation Rules" page I have two failures: Reporting Services Catalog Database File Existance Reporting Services Catalog Temporary Database File Existance Clicking on each of the failures they both say that each file exists "Select a reporting services file-only mode installation" Clicking the "Help" button tells me to "Rename, move, or delete the files" This is the only information I can find on this exact failure.  I'm not technical enough to know exactly where these files are or what they are named.  I cannot proceed any further without correcting this issue.  I'll include some of the shorter summary log files.  I can include other detail log files if that would help. Thank you so much for any help. Select Log Files: SUMMARY GLOBAL RULES LOG: Overall summary:   Final result:                  Passed   Exit code (Decimal):           0   Exit message:                  Passed   Start time:                &n
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend