This assembly has not yet been processed by SmartAssembly

.NET obfuscator and automated error reporting

Moderators: Luke Jefferson, melvyn.harbour, dom.smith

This assembly has not yet been processed by SmartAssembly

Postby memeDeveloper » Tue Jun 26, 2012 8:15 pm

Hi,

I am trying to report handled exceptions in my application using ExceptionReporting.Report(ex). My solution is composed of multiple projects and ExceptionReporting.Report(ex) works fine in one project but not another. I have done the same steps, I have added SmartAssembly.ReportException.dll to the project reference and used ExceptionReporting.Report(ex) in the catch block to report the error using the dialog box.

However, for one of the projects at the point where the dialog box should appear I get the follwoing message box:


"An exception has been passed to SmartAssembly.ReportException. However, this assembly has not yet been processed by SmartAssembly" and on the same message box the exception details is provided.

I tried throwing different handled exception in this project and I always get the same message as above where in other projects it works.

I checked if the assembly of the project was embedded to Smart Assemby's project and it shown in the list of embedded assemblies.

I have tried to find the cause of this but nothing works.

Please let me know if you have any suggestions regarding the causes of this message.
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby Simon C » Wed Jun 27, 2012 9:37 am

Unfortunately, an embedded assembly isn't actually processed by SmartAssembly. You're getting that message because the exception reporting infrastructure required to route the exception to the right place hasn't been added to the assembly you're embedding. This infrastructure is only added when assemblies are merged, not when they're embedded.

You'll need to merge the assembly, instead of embed it.
Simon C
 
Posts: 140
Joined: Tue Feb 26, 2008 4:56 pm
Location: Red Gate Software

Postby memeDeveloper » Wed Jun 27, 2012 3:13 pm

Hi Simon,

Thanks for your reply. Merging the particular assembly that has the handeld exception error reporting fixes the issue and the normal error dialog box appear. However, when I select that assembly to be merged other assemblies get selected automatically for merging ( I am guessing these are needed by the one I selected). This cause another issue , I am getting an error "Could not load type from string value 'a.b.c.d,a.b.c'

a.b.c is one of the assemblies that gets selected for merging automatically when I select mine, where d is the type that should be loaded from assembly d ?

Any Ideas what is causing this to appear ?

Thanks
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby Simon C » Wed Jun 27, 2012 4:14 pm

When you merge in an assembly, the identity of that type changes. This message is because something is looking for that type in the old assembly, when it's been moved into the new assembly.

Unfortunately, there are many things that can be doing this. Maybe you've hard-coded the assembly name as a string somewhere in the code, or you're using reflection in some fashion? I can't be more specific than that I'm afraid, as it very much depends on what your code, and assemblies that are being referenced, actually does. Try doing a string search for the old assembly name in your codebase.
Simon C
 
Posts: 140
Joined: Tue Feb 26, 2008 4:56 pm
Location: Red Gate Software

Postby memeDeveloper » Wed Jun 27, 2012 4:24 pm

Hi Simon,

Thanks for your reply. Yes I think you are correct. I actually copied the physical files of the assemblies that got merged into the smart assembly poject folder and these errors are not there anymore which means that merging them cause these errors and all these error are spring related. I am not sure what should I do about it in code.

Now I am facing anotehr SA exception when I try to megre more assemblies, while the project is building in smart assembly I get the "OutofMemory" exception and it doesn't succeed. It reaches 98% sometime and it fails. I looked at the task manager and how much memory is Smart Assembly is using while the build project and it reaches 1,286,988K but still the systems memory is only around 48%.


I am using Smart Assembl7 6.7.0.239 on Windows 7 64bit operating system.

Please let me know if you have anyway to fix this memory exception because I am being diverted by all these Smart Assembly erros from my main tasks.

Thanks
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby memeDeveloper » Wed Jun 27, 2012 4:34 pm

One more thing , I did a search of the old assembly name as you told, which is the second string in the error "a.b.c" and it all appears as a "using" statement or a namespace. I am using spring as well and these errors has to do with it.
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby Simon C » Wed Jun 27, 2012 5:03 pm

Sorry you've having these problems; how big are the input assemblies, how many are you merging together, and what options have you got turned on? These can drastically affect how much memory SA uses.
Simon C
 
Posts: 140
Joined: Tue Feb 26, 2008 4:56 pm
Location: Red Gate Software

Postby memeDeveloper » Wed Jun 27, 2012 5:15 pm

Hi Simon,

My solution is around 1 GB in size and I am merging around 35 assemblies and embedding 24 assemblies. I have automated error reporing, assembly embedding and merging turned on. Does smart assembly have any input size limitation ?


When I was embedding all of them , no issues or errros were there except for the ExceptionReporting. Report error message so I took your advice and merged the assembly that has the handled exception it was getting built sometimes and giving that exception other times. It fixed the ExceptionReporting. Report but cause the spring errors I told you about that had to do with types not found etc. So I thought I will merge all the assemblies that has to do with the application (excluding third party tools which I am embedding) but I was not successful because of the memroy exceptipon.

Thanks
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby memeDeveloper » Wed Jun 27, 2012 5:27 pm

All of these problems came from me trying to do error reporting for handled exceptions.

Let me give you a background, I was trying to report errors (handled or unhandled) for some of them I need to show the dialog box and for others just report silently in the background. So I got this reply ( http://www.red-gate.com/MessageBoard/vi ... hp?t=15425 ) and it worked, I just modified the OnReportException method as mentioned. Then came the problem of handled exceptions and that they are reported using ExceptionReporting.Report which calls the dialog box (and I needed it to be in the background for some which I am not sure if it can be done because I don't know if ExceptionReporting.Report call goes to the OnReportException method where I am doingthe silent reporting ). Then the problem of ExceptionReporting.Report came and you know the rest.

Sorry for the long description but I thought you should the details.
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby Simon C » Thu Jun 28, 2012 10:46 am

That's a very, very big solution! The reason embedding works but merging throws an OOM exception is that SA has to do very little to embed an assembly; simply take the assembly bytes, compress and encrypt them, and put them into the final assembly resources.

However, to merge an assembly, it needs to build up several layers of datastructures representing the input and output assemblies, and then transform those in a consistent way according to the options selected. This takes far more memory than simply embedding a raw assembly. There's no hardcoded limitation, it's only limited by the amount of available RAM in your computer and various limitations imposed by the CLR itself.

With regards to your exception problems, there is likely a workaround for your specific situation. I recommend you contact support to open a proper support ticket; they'll be able to help you more specifically. You can contact them using the support page at https://www.red-gate.com/supportcenter/ContactSupport
Simon C
 
Posts: 140
Joined: Tue Feb 26, 2008 4:56 pm
Location: Red Gate Software

Postby memeDeveloper » Thu Jun 28, 2012 1:57 pm

Hi Simon,

thank you for your patience and replies. I was just able to build the project with merging all assemblies with no OOM exception , I have closed all the other applications on my system to achieve that, it happened once only. Anyway, merging all didn't solve all these dependencies, types errors I only get when I use merge. Is there any other way to make ExceptionReporting.Report work without merging that sepcific assembly (this is what started the merge option and honestly I think merging assemblies can cause lots of failures in my solution).

If not, all I am trying to do is report handled exceptions (exceptions which has a try/catch) I was thinking if there is a way to call the OnReportException method in the UnhandledExceptionHandlerWithAdvancedUI class (which takes care of unhandeld exceptions). because it is working for unhandled exceptions without the need of merge. I noticed that there is a method UnhandledExceptionHandler.ReportException(Exception e, int methodID, object[] objects) , is it possible to use that and what are the method id and the object parameters?

I guess I am trying to make reporting handled exceptions take the same path as unhandled exceptions using the Unhandled Exception Handler because it is working without the need of a merge.

Can you suggest anything regarding that ?
memeDeveloper
 
Posts: 17
Joined: Fri Jun 22, 2012 7:49 pm

Postby Simon C » Thu Jun 28, 2012 3:19 pm

If you contact our support group at https://www.red-gate.com/supportcenter/ContactSupport, they'll be able to give you help and possibly a workaround for your specific situation.
Simon C
 
Posts: 140
Joined: Tue Feb 26, 2008 4:56 pm
Location: Red Gate Software


Return to SmartAssembly 6

Who is online

Users browsing this forum: No registered users and 0 guests