Andreasx23
Andreasx23

Reputation: 19

C# Winforms designer crashes visual studio when opening the designer window

I've been dealing with this problem for awhile now and haven't managed to progress any further for the past few hours so I thought I'll ask here. When I'm opening the designer window in winforms I get to this error screen. Which after about 5 to 10 seconds freezes my Visual Studio and then crashes and reopens automatically. When this happens I can go to my event viewer and find the following two error messages

Level Error:

Log Name:      Application
Source:        Application Error
Date:          10/10/2021 16.19.22
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      w10-virt-aca.judex.net
Description:
Faulting application name: devenv.exe, version: 16.11.31727.386, time stamp: 0x615257fa
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1202, time stamp: 0x448a4f5d
Exception code: 0xe0434352
Fault offset: 0x0012b5b2
Faulting process id: 0x4314
Faulting application start time: 0x01d7bde1394d2a09
Faulting application path: C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe
Faulting module path: C:\WINDOWS\System32\KERNELBASE.dll
Report Id: 2d116bf6-eee2-471d-b458-5199c1cf7c30
Faulting package full name: 
Faulting package-relative application ID: 
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Version>0</Version>
    <Level>2</Level>
    <Task>100</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2021-10-10T14:19:22.2983088Z" />
    <EventRecordID>31817</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>w10-virt-aca.judex.net</Computer>
    <Security />
  </System>
  <EventData>
    <Data>devenv.exe</Data>
    <Data>16.11.31727.386</Data>
    <Data>615257fa</Data>
    <Data>KERNELBASE.dll</Data>
    <Data>10.0.19041.1202</Data>
    <Data>448a4f5d</Data>
    <Data>e0434352</Data>
    <Data>0012b5b2</Data>
    <Data>4314</Data>
    <Data>01d7bde1394d2a09</Data>
    <Data>C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\Common7\IDE\devenv.exe</Data>
    <Data>C:\WINDOWS\System32\KERNELBASE.dll</Data>
    <Data>2d116bf6-eee2-471d-b458-5199c1cf7c30</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>

Level Information:

Log Name:      Application
Source:        Windows Error Reporting
Date:          10/10/2021 16.20.48
Event ID:      1001
Task Category: None
Level:         Information
Keywords:      Classic
User:          N/A
Computer:      w10-virt-aca.judex.net
Description:
Fault bucket 125730739576, type 5
Event Name: PerfWatsonVS12Data
Response: Not available
Cab Id: 0

Problem signature:
P1: PerfWatsonTcdb
P2: 0
P3: 0
P4: 0
P5: 0
P6: 
P7: 
P8: 
P9: 
P10: 

Attached files:
\\?\C:\Users\aca\AppData\Local\Temp\VSTelem.Out\202110101420_D16.11_16.11.31727.386_8460_7747fac7-2021-4e3a-822b-736e4bab2863.tcdb
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2A96.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2AB7.tmp.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2AC7.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2AF7.tmp.txt

These files may be available here:
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_PerfWatsonTcdb_688f135dd185f2a8133a474a2518efc6ce6cc4a_00000000_c8109fff-f54e-4b17-ba40-d36334af35e8

Analysis symbol: 
Rechecking for solution: 0
Report Id: c8109fff-f54e-4b17-ba40-d36334af35e8
Report Status: 268435456
Hashed bucket: fb30d2b9a7acf0305d4da51668259751
Cab Guid: 0
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Windows Error Reporting" />
    <EventID Qualifiers="0">1001</EventID>
    <Version>0</Version>
    <Level>4</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2021-10-10T14:20:48.9503861Z" />
    <EventRecordID>31819</EventRecordID>
    <Correlation />
    <Execution ProcessID="0" ThreadID="0" />
    <Channel>Application</Channel>
    <Computer>w10-virt-aca.judex.net</Computer>
    <Security />
  </System>
  <EventData>
    <Data>125730739576</Data>
    <Data>5</Data>
    <Data>PerfWatsonVS12Data</Data>
    <Data>Not available</Data>
    <Data>0</Data>
    <Data>PerfWatsonTcdb</Data>
    <Data>0</Data>
    <Data>0</Data>
    <Data>0</Data>
    <Data>0</Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
    </Data>
    <Data>
\\?\C:\Users\aca\AppData\Local\Temp\VSTelem.Out\202110101420_D16.11_16.11.31727.386_8460_7747fac7-2021-4e3a-822b-736e4bab2863.tcdb
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2A96.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2AB7.tmp.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2AC7.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER2AF7.tmp.txt</Data>
    <Data>\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\NonCritical_PerfWatsonTcdb_688f135dd185f2a8133a474a2518efc6ce6cc4a_00000000_c8109fff-f54e-4b17-ba40-d36334af35e8</Data>
    <Data>
    </Data>
    <Data>0</Data>
    <Data>c8109fff-f54e-4b17-ba40-d36334af35e8</Data>
    <Data>268435456</Data>
    <Data>fb30d2b9a7acf0305d4da51668259751</Data>
    <Data>0</Data>
  </EventData>
</Event>

Does anyone have the sligtest idea how to solve this issue?

Upvotes: 1

Views: 1642

Answers (1)

cly
cly

Reputation: 708

The error message explains that your form during it's instantiation process (in constructor or somewhere called from there) is trying to access a ActionLogService.IActionLogService which is not available. If you click on Show Call Stack link you will see where is that code line.

I would open the code file without designer support, go to that line and change it like this:

if (!this.DesignMode) 
{
   // here comes the original ActionLogService lines
}
else
{
   // here optionally could be something mocking the ActionLogService during design time
}

E.g. I have a dialog with a dynamic list of actually available choices calculated and returned by a webservice call. During design time I do not want the webservice to be available but wanted to see some dummy values instead in the list. Here it is:

List<string> availableChoices;
if (!this.DesignMode)
{
   availableChoices = GetAvailableChoicesFromWebserviceCall();
}
else
{
   availableChoices = new List<string>() { "dummyDesignTimeOption1", "dummyDesignTimeOption2" };
}

Upvotes: 3

Related Questions